You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
OpenAPI v2 is not read properly when Produces/Consumes is not provided #842
The OpenAPI v2 specification is not clear that Produces/Consumes are required to be able to completely describe an API request/response.
This means that when OpenAPI v2 documents are read in, if they don't have a produces/consumes then there is no media type object created and there is nowhere to put any schema that has been specified.
By adding a defaultContentType property to the OpenApiReaderSettings object we can use that to create a content object if there is no produces/consumes and we will not lose the schema information. This will not change the default behavior of library.
It turns out we already have code that assumes application/json for a body or application/x-url-encoded-form for form data. The only thing that was missing was a check for an empty consumes/produces array. Considering this feature only causes issues for V2 I am reluctant to add another reader setting unless we have customers asking for it.
Activity
darrelmiller commentedon Jul 4, 2022
It turns out we already have code that assumes application/json for a body or application/x-url-encoded-form for form data. The only thing that was missing was a check for an empty consumes/produces array. Considering this feature only causes issues for V2 I am reluctant to add another reader setting unless we have customers asking for it.
MaggieKimani1 commentedon Jul 6, 2022
I concur on not adding a new reader setting if we can retain the schema info by adding the missing check.
Merge pull request #926 from /issues/842