Repository navigation
feat(gen): space delimited query style - #1716
Merged
Merged
Conversation
Contributor
Author
|
@ernado May I ask for a review? |
ernado
pushed a commit
that referenced
this pull request
Aug 7, 2026
inferParamExplode picked the default from the parameter location instead of the style, so
every query and cookie parameter without an explicit "explode" got explode: true. For
spaceDelimited and pipeDelimited arrays that is the form serialization, and the declared
style is silently dropped. Three array parameters with styles form, pipeDelimited and
spaceDelimited, none of them setting explode, RawQuery observed on the wire:
before: fm=1&fm=2&fm=3&pd=1&pd=2&pd=3&sp=1&sp=2&sp=3
after: fm=1&fm=2&fm=3&pd=1%7C2%7C3&sp=1+2+3
OpenAPI 3.0.3 and 3.1 both say the default is true only when style is form, which is what
the comment in the function already quoted.
The shorthand dates to 6b48c0f (2022-04-14), which introduced the inference.
pipeDelimited arrays were already supported at that commit — uri/query_encoder.go
implemented the style and gen.isSupportedParamStyle rejected pipeDelimited for objects
only — so pipeDelimited has been serialized as form since v0.26.0, four years.
spaceDelimited returned ErrNotImplemented until #1716 enabled it for arrays, extending the
same defect to a second style.
Take the style, not the location. Query and cookie parameters default to style form, so
their default explode is unchanged; path and header parameters default to simple and were
already false. Only an explicitly declared non-form style changes, and only when the spec
does not set explode itself.
The Encoding Object shares the inference, so a urlencoded or multipart body property with
a declared non-form style is corrected the same way. Body observed for an encoding entry
of {tags: {style: pipeDelimited}} over an array of "a", "b", "c":
before: tags=a&tags=b&tags=c
after: tags=a%7Cb%7Cc
deepObject keeps defaulting to true. The style/explode table in validateParamStyle accepts
{deepObject, true} only, so a literal reading of the spec (false for every style but form)
would make a bare "style: deepObject" fail to parse, which three checked-in specs use
(_testdata/positive/parameters.json, _testdata/positive/additionalPropertiesPatternProperties.yml
and the encoding object in _testdata/positive/form.json).
make generate examples produces no diff.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
robsonpeixoto
pushed a commit
to robsonpeixoto/ogen
that referenced
this pull request
Aug 30, 2026
inferParamExplode picked the default from the parameter location instead of the style, so
every query and cookie parameter without an explicit "explode" got explode: true. For
spaceDelimited and pipeDelimited arrays that is the form serialization, and the declared
style is silently dropped. Three array parameters with styles form, pipeDelimited and
spaceDelimited, none of them setting explode, RawQuery observed on the wire:
before: fm=1&fm=2&fm=3&pd=1&pd=2&pd=3&sp=1&sp=2&sp=3
after: fm=1&fm=2&fm=3&pd=1%7C2%7C3&sp=1+2+3
OpenAPI 3.0.3 and 3.1 both say the default is true only when style is form, which is what
the comment in the function already quoted.
The shorthand dates to 6b48c0f (2022-04-14), which introduced the inference.
pipeDelimited arrays were already supported at that commit — uri/query_encoder.go
implemented the style and gen.isSupportedParamStyle rejected pipeDelimited for objects
only — so pipeDelimited has been serialized as form since v0.26.0, four years.
spaceDelimited returned ErrNotImplemented until ogen-go#1716 enabled it for arrays, extending the
same defect to a second style.
Take the style, not the location. Query and cookie parameters default to style form, so
their default explode is unchanged; path and header parameters default to simple and were
already false. Only an explicitly declared non-form style changes, and only when the spec
does not set explode itself.
The Encoding Object shares the inference, so a urlencoded or multipart body property with
a declared non-form style is corrected the same way. Body observed for an encoding entry
of {tags: {style: pipeDelimited}} over an array of "a", "b", "c":
before: tags=a&tags=b&tags=c
after: tags=a%7Cb%7Cc
deepObject keeps defaulting to true. The style/explode table in validateParamStyle accepts
{deepObject, true} only, so a literal reading of the spec (false for every style but form)
would make a bare "style: deepObject" fail to parse, which three checked-in specs use
(_testdata/positive/parameters.json, _testdata/positive/additionalPropertiesPatternProperties.yml
and the encoding object in _testdata/positive/form.json).
make generate examples produces no diff.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
robsonpeixoto
pushed a commit
to robsonpeixoto/ogen
that referenced
this pull request
Sep 26, 2026
inferParamExplode picked the default from the parameter location instead of the style, so
every query and cookie parameter without an explicit "explode" got explode: true. For
spaceDelimited and pipeDelimited arrays that is the form serialization, and the declared
style is silently dropped. Three array parameters with styles form, pipeDelimited and
spaceDelimited, none of them setting explode, RawQuery observed on the wire:
before: fm=1&fm=2&fm=3&pd=1&pd=2&pd=3&sp=1&sp=2&sp=3
after: fm=1&fm=2&fm=3&pd=1%7C2%7C3&sp=1+2+3
OpenAPI 3.0.3 and 3.1 both say the default is true only when style is form, which is what
the comment in the function already quoted.
The shorthand dates to 6b48c0f (2022-04-14), which introduced the inference.
pipeDelimited arrays were already supported at that commit — uri/query_encoder.go
implemented the style and gen.isSupportedParamStyle rejected pipeDelimited for objects
only — so pipeDelimited has been serialized as form since v0.26.0, four years.
spaceDelimited returned ErrNotImplemented until ogen-go#1716 enabled it for arrays, extending the
same defect to a second style.
Take the style, not the location. Query and cookie parameters default to style form, so
their default explode is unchanged; path and header parameters default to simple and were
already false. Only an explicitly declared non-form style changes, and only when the spec
does not set explode itself.
The Encoding Object shares the inference, so a urlencoded or multipart body property with
a declared non-form style is corrected the same way. Body observed for an encoding entry
of {tags: {style: pipeDelimited}} over an array of "a", "b", "c":
before: tags=a&tags=b&tags=c
after: tags=a%7Cb%7Cc
deepObject keeps defaulting to true. The style/explode table in validateParamStyle accepts
{deepObject, true} only, so a literal reading of the spec (false for every style but form)
would make a bare "style: deepObject" fail to parse, which three checked-in specs use
(_testdata/positive/parameters.json, _testdata/positive/additionalPropertiesPatternProperties.yml
and the encoding object in _testdata/positive/form.json).
make generate examples produces no diff.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Enables the
spaceDelimitedquery parameter style, which was previously rejected by the generator withErrNotImplemented.It was originally disabled because the old implementation joined items on the literal string
"%20"and then ran that throughurl.Values.Encode(), which double-encoded the%(producing%2520). This takes the same approach as the existingpipeDelimitedsupport: join array items with a real space and leturl.Values.Encode()handle the encoding.Details
explode: truealready behaved likeform(repeated keys); this fills in theexplode: falsecase for arrays.+(theapplication/x-www-form-urlencodedform). Decoding accepts both+and%20, so round-trips are stable.Tests
spaceDelimitedencoder/decoder unit tests, plus a%20decode case.spaceDelimitedoperation to the parameters integration test.