Skip to content

fix(openapi): explode object query parameters - #7234

Closed
benclarkeio wants to merge 1 commit into
google:mainfrom
benclarkeio:fix/openapi-query-object-serialization
Closed

benclarkeio wants to merge 1 commit into
google:mainfrom
benclarkeio:fix/openapi-query-object-serialization

Conversation

@benclarkeio

Copy link
Copy Markdown
Contributor

Link to Issue or Description of Change

1. Link to an existing issue (if applicable):

Problem:

OpenAPI object-valued query parameters using the default form style with explode: true were passed to the HTTP client as dictionaries. The client encoded each dictionary as one string value instead of serializing its properties as separate query parameters.

Solution:

Read the query parameter's style and explode settings from the parsed operation. Expand dictionary properties into the request query mapping when form-style exploded serialization applies. Existing filtering continues to omit null values while preserving false and zero values.

Testing Plan

Unit Tests:

  • I have added or updated unit tests for my change.
  • All unit tests pass locally.

82 passed, 17 warnings:

.venv/bin/pytest tests/unittests/tools/openapi_tool/openapi_spec_parser/test_rest_api_tool.py -q

Formatting, import ordering, and lint checks also pass for both changed files.

Manual End-to-End (E2E) Tests:

N/A. The regression test verifies the final request parameters at the HTTP client boundary.

Checklist

  • I have read the CONTRIBUTING.md document.
  • I have performed a self-review of my own code.
  • I have commented my code, particularly in hard-to-understand areas.
  • I have added tests that prove my fix is effective or that my feature works.
  • New and existing unit tests pass locally with my changes.
  • I have manually tested my changes end-to-end.
  • Any dependent changes have been merged and published in downstream modules.

Additional context

The implementation intentionally handles only the OpenAPI form plus explode: true object case described in the linked issue. Other serialization styles are unchanged.

- Apply OpenAPI form-style exploded serialization to object query values.
- Preserve false and zero values while omitting null object properties.
- Add regression coverage for default query object serialization.
@benclarkeio

Copy link
Copy Markdown
Contributor Author

Superseded by #7208, which covers the default form/explode object case and the additional query serialization styles tracked in #7204. The regression test from this PR passes unchanged against #7208.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Object-valued OpenAPI query parameters are serialized as dictionary strings

2 participants