Repository navigation
Python: fix OpenAPI plugin sending array and boolean parameters as Python repr - #14789
Open
Jeevan Babu Gotru (jeevan1098) wants to merge 2 commits into
Open
Jeevan Babu Gotru (jeevan1098) wants to merge 2 commits into
Jeevan Babu Gotru (jeevan1098) wants to merge 2 commits into
Conversation
Jeevan Babu Gotru (jeevan1098)
requested a review
from a team
as a code owner
November 12, 2026 15:42
Jeevan Babu Gotru (jeevan1098)
deployed
to
github-app-auth
November 12, 2026 15:42 — with
GitHub Actions
Active
Contributor
There was a problem hiding this comment.
🟢 Approval recommended
There are no active review issues for the query-array and boolean serialization changes.
No open issues 🎉
What changed in this PR
Fixes #14788 by updating the Python OpenAPI plugin to serialize array query parameters and booleans in wire-compatible formats rather than Python representations.
Changes:
- Encodes query arrays as repeated keys using
doseq=True. - Serializes booleans as lowercase
true/falsein query, path, and header parameters. - Adds four regression tests. Parsing explicit OpenAPI
style/explodesettings remains out of scope.
| File | Description |
|---|---|
python/tests/unit/connectors/openapi_plugin/test_sk_openapi.py |
Adds regression coverage for query arrays and boolean query, path, and header values. |
python/semantic_kernel/connectors/openapi_plugin/models/rest_api_operation.py |
Adds boolean serialization and repeated-key query array encoding. |
Review effort: Balanced
This branch was successfully deployed
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.
Purpose
Fixes #14788
The Python OpenAPI plugin built query strings with
urlencode(segments)and passed argument values through unchanged. Withoutdoseq=True,urlencodecallsstr()on each value, so anarrayquery parameter was sent as the Python list repr (tags=%5B%27red%27%2C+%27blue%27%5D) and abooleanasactive=True— neither is parseable by the API. OpenAPI's default for query parameters isstyle: form, explode: true, i.e.?tags=red&tags=blue&active=true, which is also how the .NET plugin serializes arrays.Description
RestApiOperation.build_query_stringnow encodes withdoseq=True, so list/tuple values become repeated keys._serialize_parameter_valuehelper serializes booleans with the JSON spelling (true/false); it is applied to query values (including items inside arrays), and to path and header parameters, which had the samestr(argument)boolean problem.style/explodefrom the spec are still not parsed (as noted on the issue); this implements the OpenAPI default only.Reproduced with the issue's offline repro (httpx MockTransport) on main at 25bd1bb: before the fix the captured URL was
https://93.184.216.34/items?tags=%5B%27red%27%2C+%27blue%27%5D&active=True; after the fix it ishttps://93.184.216.34/items?tags=red&tags=blue&active=true.Regression tests
Four new tests in
test_sk_openapi.py: array + boolean query parameters,false+ boolean-array query parameters, a boolean path parameter, and a boolean header parameter. All four fail without the source fix. The mapped test file passes (83 tests); the fulltests/unit/connectors/openapi_plugin/suite shows only the pre-existing DNS-pinning failures, which are identical on clean main in this sandbox. Ruff check and format are clean on both changed files.This change was prepared with AI assistance; all steps above were run and verified by the contributor.