Skip to content
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

Forms data with json encoded properties support (willing to do work if someone says that the feature is expected / desired) #981

Open
LGraber opened this issue Jul 19, 2023 · 1 comment
Labels
enhancement New feature or request openapi-features OpenAPI features support issues

Comments

@LGraber
Copy link

LGraber commented Jul 19, 2023

Description

We need to support an application/x-www-form-urlencoded message which contains object properties that are json encoded (application/json). Currently, the ogen tool, if "explode" is set to false, is hardcoded to assume csv encoding (https://github.com/ogen-go/ogen/blob/main/uri/query_param_decoder.go#L156). I would like to be able to indicate that it is json encoded via the contentType attribute on the Encoding object which is currently marked as NotImpl (https://github.com/ogen-go/ogen/blob/main/gen/gen_contents.go#L192).

I started playing with adding this but actually wanted to see if this would be something that was desired.

References

The spec is a bit unclear here. I read https://swagger.io/specification/#encoding-object to indicate that the default should be application/json. However, other parts of the spec seem to indicate csv. SPecifically the style value for the Parameter object says that when the value is form "Form style parameters defined by RFC6570. This option replaces collectionFormat with a csv (when explode is false) or multi (when explode is true) value from OpenAPI 2.0." I tried other tools and found that Postman always does csv and I couldn't get it to change while SwaggerUI always generated application/json in the "Try it Out" option. So ... I am not sure what the spec is exactly expecting

@LGraber LGraber added enhancement New feature or request openapi-features OpenAPI features support issues labels Jul 19, 2023
@LGraber LGraber changed the title Forms data with json encoded properties support Forms data with json encoded properties support (willing to do work if someone says that the feature is expected / desired) Jul 24, 2023
@LGraber
Copy link
Author

LGraber commented Jul 24, 2023

also note that I am trying to get clarification on the spec as it confuses me. If others in this group know the answer, let me know: OAI/OpenAPI-Specification#3331

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request openapi-features OpenAPI features support issues
Projects
None yet
Development

No branches or pull requests

1 participant