1
Generate JSON Schema from OpenAPI YAML
Question asked by Charles Wilt - 8/7/2024 at 6:28 PM
Unanswered
I've got a JSON document that originated as a API response that I need to convert to a XML document.

I can download the YAML doc, but there doesn't seem to be anyway to extract the schema from the YAML as a stand-a-lone JSON schema that I can use in the data mapper.  Besides "inferring" the schema from r the actual response JSON; which doesn't seem like the best idea.

I tried pointing the "Web Service Call" component of the DM to my YMAL.  But that break out the properties very well...seemingly putting most as KV pairs under "AdditionalProperties"



8 Replies

Reply to Thread
0
Liquid Support Replied
Employee Post
Hi,

If you point the data mapper 'Web Service' component at the swagger.json it should provide a complete JSON or (if the web service supports it) XML response.


Will give the option to call "Find Books By status (GET)"...

With multiple option for the Response type...


Selecting "application/json" produces "Web Service 1" component, selecting "application/xml" produces Web Service 2" component...

Either can then be mapped onto an XML component.


0
Charles Wilt Replied
As mentioned I tried that...
Didn't return much that was usable...

I found a python tool that generated JSON schema's from Open API, but while the resulting schemas look good when I open them directly.  Trying to use them in the data mapper gives me the same "everything in KV pairs" that I saw with the web service component.  I suspect it's a limitation due to the complexity of the schema, in particular the "Customer isOneOf (Business, Individual)"


0
Liquid Support Replied
Employee Post
OK, what do you see if when you expand the node "Value (Object)"?
0
Charles Wilt Replied

0
Charles Wilt Replied
Feels like it's being dynamically generated...and might not actually end...
This is 38 levels deep...
0
Liquid Support Replied
Employee Post
Hmm, yes that's not much use.

Would it be possible to provide the schema? If this is commercially sensitive, please create a support ticket.
0
Charles Wilt Replied
ticket number 240-2E4CCC9D-0004 
1
Liquid Support Replied
Employee Post
This issue was fixed in v20.7.13:

Updated Data Mapper Web Services Components to expand nodes for AnyOf, OneOf, AllOf YAML schema and JSON Schema values.

Reply to Thread