fix(java): Array query params are treated as exploded: true#7506
Merged
fix(java): Array query params are treated as exploded: true#7506
Conversation
Contributor
| if (request.getLimit().isPresent()) { | ||
| QueryStringMapper.addQueryParameter( | ||
| httpUrl, "limit", request.getLimit().get().toString(), false); | ||
| httpUrl, "limit", request.getLimit().get(), false); |
Collaborator
There was a problem hiding this comment.
@dsinghvi Given that this change to not stringify args will impact types other than array, should we test this further before pushing it out?
dsinghvi
approved these changes
Jun 13, 2025
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.
Description
A regression of the Java SDK generator occurred at some point where query params formatting for array type params were malformed. By default the generator treats array query params as if they have openapi's explode property set to true. In future we may want to modify this behavior to distinguish between these two specifications, but for now we're simply fixing the bug where the params were malformed.
Examples
Open API Spec for param:
Previous formatting:
Malformed formatting url encoded:
Malformed formatting unencoded:
Potential future formatting if we don't treat array types as
explode: true(per open API) orallowMultiple: true(per fern-ar):Changes Made
addQueryParameterto not stringify the param before sending it to the methodqueryParamProperty.allowMultiple()toaddQueryParametermethod'sarraysAsRepeatsparameter instead of always passingfalseTesting
Tested manually locally by creating a very simple fern config and openapi spec, running the java generator against that with seed, and then running a manually created test within the generated java sdk to verify that the url string looked correct after adding the query params.