AEM Forms Cloud | FMD not creating Schema properly using YAML configs
Hi Everyone,
I am facing an issue with the FDM regarding the swagger configuration.
I want to have a flat structure JSON Model request for the API and it is working fine in the Swagger Editor (Version 2) but for some reason when I use this YAML to create a FDM it encapsulates the flat json into a parent object.
Expected (Working in Swagger Editor 2.0):
{
"created": "2023-01-19T12:01:16.734Z",
"noteAdministration": "xyz",
"noteCustomer": "abc",
"origin": "Homepage",
"person": {
"firstname": "abc",
"lastname": "xyz"
},
"productId": "0000"
}
Generated (By FDM):
{
"lead": {
"created": "2023-01-19T12:01:16.734Z",
"noteAdministration": "xyz",
"noteCustomer": "abc",
"origin": "Homepage",
"person": {
"firstname": "abc",
"lastname": "xyz"
},
"productId": "0000"
}
}
Notice that "lead" key has been added at the top of the JSON. This shouldn't be there.
This is the swagger config I'm using as a datasource to create FDM:
swagger: '2.0'
info:
version: '1.0'
title: LEAD
host: test-lead-url
basePath: /api
securityDefinitions:
Bearer:
type: apiKey
name: Authorization
in: header
description: Passes the Access-Token to the service call.
schemes:
- https
consumes:
- application/json
produces:
- application/json
paths:
/leads:
post:
summary: Creates new lead.
operationId: createLead
deprecated: false
produces:
- application/json
consumes:
- application/json
parameters:
- name: body
in: body
required: true
description: ''
schema:
$ref: '#/definitions/Lead'
responses:
'201':
description: Created
headers: {}
'500':
description: Internal server error
headers: {}
security:
- Bearer: []
definitions:
Lead:
title: Lead
type: object
properties:
created:
type: string
format: date-time
noteAdministration:
type: string
noteCustomer:
type: string
origin:
type: string
person:
$ref: '#/definitions/Person'
productId:
type: string
required:
- created
- person
- productId
Person:
title: Person
type: object
properties:
firstname:
type: string
lastName:
type: string
required:
- firstName
- lastName
Not sure if there is some issue in the YAML or in the FDM itself. Could anyone pls help with this!