Expand my Community achievements bar.

AEM Forms FDM OpenAPI response data does not have structure

Avatar

Level 4

We are trying to use a published API from the UK Revenues team - it is defined as an openapi yaml file - very simple API - provide a VAT number and it returns with the data of the organisation.

 

I have added the YAML as a cloud service and build an FDM from it. When I test the Service it sucessfully brings back data as in the attached image.

 

However, when I try to use this service in the rules editor the response fields are not available. What it offers is just one item called response. The openapi definition has different responses per status type and for 200 it mandates the structure in the example below {target.... name.... etc}

I have had similar issues with openapi and had to build the api using Swagger V2, but I'd rather not have to do this.

 

Does anyone have any suggestions for what I might be doing incorrectly?

 

IainClucas_0-1704466022969.png



IainClucas_1-1704466061114.png

 

3 Replies

Avatar

Level 1

Hi IainClucas,
Form Data Model as of today does not parse all the response data per status type mentioned in open api definition, it only parses for success response type. It had nothing to do with swagger 2.0 definition and open api 3.0 definition.
Rule editor mapping with response fields works for me, i just tested it out and tried to reproduce it with the same response structure which you just posted and with this open api definition also https://petstore3.swagger.io/api/v3/openapi.json. What setup you are on and please share the open api definition also.

Doc link : https://experienceleague.adobe.com/docs/experience-manager-cloud-service/content/forms/integrate/use...

Avatar

Level 1

Looks like form data model is having some issue while parsing response structure directly from schema. If you refer the response structure from components/schema it'll work fine. You have to modify the swagger a bit to refer the response structure.
1.) Create a response structure which is expected in /components/schema. Refer attached image named "response_schema".
2.) refer this in 200 response of the operation. Refer image named "referring_response".
3.) Use it in rule editor, it'll display the response structure. Refer image name "rule_editor"