-
Notifications
You must be signed in to change notification settings - Fork 199
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Content negotation - "content-type" is being skipped during conversion #361
Comments
@VShingala The problem lies with the requests without any body, since then there is no content-type header set in Postman, which for APIs with content negotiation is required, otherwise they return HTML. This is why we define the content type explicitly in the openapi spec, via an Enum with a default set to application/json |
Patch related to the stripping of "content-type" defined in OpenAPI postmanlabs#361
@thim81 Got it and it makes sense, Thanks for pointing it out. So would you say adding Also, this change was initiated because OpenAPI specification specifically added to ignore such definition. But what you pointed out makes sense. Is there any reference that states this? Alternatively, you can just add |
I would make the OpenAPI document leading, during the generation
with regards to: https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#fixed-fields-10 It is not clear what they mean with "SHALL be ignored"? Ignore for what? For display in documentation or for SDK generation? |
I think what they mean by that is corresponding parameter definition should be discarded entirely. Meaning we can ignore it as a parameter. |
@VShingala since they are now skipped, means that we have manually re-add the required "Content-Type" and "Authorization" headers. Is it not possible to keep these headers based on a setting? I created a PR #383 to have the option to manage the implicit headers |
@thim81 Thanks for the contribution! I Will take a look at PR later on. |
@VShingala Did you had some more comments or remarks on the PR #383 ? |
Hey @thim81, there are a couple of more changes that might be needed from |
@VShingala Did you had some time to look into the PR? And did you have any remarks or comments, I should work on? |
Closing this item, since it solved in the 2.11.0 release, which includes the PR #383 |
Thanks @VShingala for the review and all the tips to make this land in the release 🙇 |
In an OpenAPI, users will explicitly define the "content-type", since users can document multiple "content-type"s in the requests to facilitate content negotiation.
Example OpenAPI
But since the latest release, the content-types gets stripped out, because of this addition in the
schemaUtils.js
where
IMPLICIT_HEADERS
refers to:Can you give some insights why you want to strip out any explicitly defined content-types during the conversion from OpenAPI to Postman? Since by stripping them out, requests made to an API that explicitly validates them start to report errors.
The text was updated successfully, but these errors were encountered: