-
Notifications
You must be signed in to change notification settings - Fork 9.1k
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
Clarification on support for application/json encoded object properties in application/x-www-form-urlencoded messages #3331
Comments
To add, Postman always does comma delimted for the explode:false and explode:false, contentType:application/json. SwaggerUI on the other hand, also does json for the property value. It feels like I should be able to have either by using contentType attribute and it seems like the default should be application/json and not csv?? |
I agree that this is not very clear. My reading is that this is the key part:
This tells me that the text around defaults is a bit incomplete. An explicit This is shown by the example, which has a JSON object for This is further supported by the Support for x-www-form-urlencoded Request Bodies, which uses a similar
I think we should show the result of applying those examples (and probably clean up that text in the field table as well). The confusion seems to have been introduced in OAS 3.1, as the text in 3.0.3 does not say anything about interactions with |
PR merged for 3.0.4 and ported to 3.1.1 via PR #3921! |
I have been trying to read the spec and understand this to understand if some tools are "broken" or if the spec is just ... unclear (or I am reading it wrong). I need to support an application/x-www-form-urlencoded message where some properties are application/json encoded objects. From what I can read in the spec, this should be the expected, default serialization. The section on Encoding Object says: "The Content-Type for encoding a specific property. Default value depends on the property type: for object - application/json; ". I will say that I am very confused by that line when reading the section on "explode":
That doesn't make sense to me since if I want my property to simply be a json string, then I need to set it to explode: false but then it ignores contentType so ... I guess I have to assume it is application/json but then what would be the point of this parameter.
So, could someone tell me how to make the system accept a application/x-www-form-urlencoded message where one of the properties is a json encoded object. I attached a sample spec I created which I tested in Postman and SwaggerUI and they behave differently. I also tried with a codegen tool to see what they did and it was different also. I want to know what is "right" and then maybe I can fix something :)
Thanks
NestedOpenAPISpec.yml.txt
The text was updated successfully, but these errors were encountered: