Skip to content

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

@LGraber

Description

@LGraber

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions