Skip to content
This repository has been archived by the owner on Jul 16, 2020. It is now read-only.

Fix: body parameter - empty schema to be set to empty object #4

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

tehcyx
Copy link
Contributor

@tehcyx tehcyx commented Nov 11, 2016

Hi,

We, a team from SAP working on API Hub and YaaS, started using this converter to convert our RAML definitions into Swagger. We found that some of our RAML files were failing to convert so we had to make some changes, and we wanted to share these changes with you. We collected the list of changes we made in this CHANGELOG and will provide each fix as a different pull request for you so that you can pick the ones that you want to support.

The issue to fix
A schema is mandatory as per Open API spec for body parameters but in RAML it can be empty or undefined.

The fix
A schema of type object is added in case the schema is empty or undefined.

Best regards,
Daniel Roth - SAP Hybris

};

if (!bodyRequest.schema) {
bodyRequest.schema = {type: "object"};
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@tehcyx You workaround not work for non-object body, for example array.
In Swagger/JSON Schema empty schema mean anyting.
Can I replace {type: 'object'} with {}?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+ style issue I use ' for JS code and " in JSON and JSONPath

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wouldn't know from the top of my head if that works. But if the output will be valid Swagger we're totally fine with it.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants