Skip to content

Add JSON query parameter conversion helpers - #215

Merged
czechboy0 merged 6 commits into
apple:mainfrom
ayush-that:json-query-parameters
Oct 6, 2026
Merged

czechboy0 merged 6 commits into
apple:mainfrom
ayush-that:json-query-parameters

Conversation

@ayush-that

@ayush-that ayush-that commented Sep 26, 2026 •

Copy link
Copy Markdown
Contributor

Motivation

Generator issue #853 produces calls for JSON query parameters, but the runtime does not provide the matching helpers.

Modifications

Add client and optional and required server helpers that encode a JSON value as one named query item. Keep the generated style and explode arguments for compatibility. Use a dedicated compact JSON encoder with sorted keys, unescaped slashes, and the configured date transcoder.

Result

Generated clients and servers can encode and decode content: application/json query parameters. Missing required parameters retain the existing error behavior.

Test Plan

swift build and the full swift test suite passed locally: 239 tests, 0 failures.

Related generator PR: apple/swift-openapi-generator#956

@czechboy0 czechboy0 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, @ayush-that 🙏

@czechboy0 czechboy0 added the 🔨 semver/patch No public API change. label Oct 6, 2026
@czechboy0
czechboy0 enabled auto-merge (squash) October 6, 2026 08:25
@czechboy0
czechboy0 merged commit 50ad797 into apple:main Oct 6, 2026
52 checks passed
czechboy0 added a commit to apple/swift-openapi-generator that referenced this pull request Oct 6, 2026
### Motivation

The generator already emits JSON query helper calls. This change covers
those calls with reference and consumer tests for issue
[#853](#853).

### Modifications

Add a required inline parameter snippet test and an optional referenced
JSON query parameter to Petstore. Update the generated references,
compiled client and server tests, and conversion documentation.

### Result

The tests cover both required and optional generated calls, including
the JSON query value sent and received by Petstore.

### Test Plan

`swift build` and the full default `swift test` suite passed locally
with the runtime fork as a local dependency: 334 tests reported, 0
failures, 18 skipped. The 17 opt-in compatibility tests also passed.

Related runtime PR: apple/swift-openapi-runtime#215

Closes #853

---------

Co-authored-by: Honza Dvorsky <honza@apple.com>
@ayush-that
ayush-that deleted the json-query-parameters branch October 6, 2026 16:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

🔨 semver/patch No public API change.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants