Uh oh!
There was an error while loading. Please reload this page.
Handle map-style query parameters with None values - #666
Handle map-style query parameters with None values#666Bart Koelman (bkoelman) wants to merge 2 commits into
Conversation
b78a3c3 to
ea0c6e2Compare
Vincent Biret (baywet)
left a comment
There was a problem hiding this comment.
Thanks for the contribution!
Vincent Biret (baywet)
commented
Jul 23, 2026
Bart Koelman (@bkoelman) can you fix the formatting as reported by this action run please? after that I think we'd be good to go |
There was a problem hiding this comment.
Pull request overview
This PR updates RequestInformation URL building to safely handle map/dictionary-style query parameters whose values include None, aligning behavior with RFC 6570 “undefined” semantics and preventing StdUriTemplate from raising when encountering None inside map expansions.
Changes:
- Sanitize
dictvalues passed into URI template expansion by droppingNoneentries and recursively sanitizing remaining values. - Add new unit tests covering map query expansion behavior (including omission of
Nonevalues and preservation of empty strings), plus a dataclass-basedset_query_string_parameters_from_raw_object()path.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| packages/abstractions/kiota_abstractions/request_information.py | Adds dict/map sanitization to omit None entries before URI template expansion. |
| packages/abstractions/tests/test_request_information.py | Adds test coverage for RFC 6570 map-style query parameter expansion and edge cases. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Uh oh!
There was an error while loading. Please reload this page.
Dict values used as map/dictionary query parameters (from an OpenAPI `type: object` with `additionalProperties` field) are now sanitized before being passed to StdUriTemplate. None values are silently dropped per RFC 6570 §2.3 "undefined" semantics, preventing a ValueError when StdUriTemplate tries to convert None to a string. An empty string must be set explicitly to send `key=`. Adds seven test cases covering map expansion, None-value omission, empty-string inclusion, empty dicts, all-None dicts, mixed scalar+map parameters, and the set_query_string_parameters_from_raw_object() path. Co-authored-by: Cursor <cursoragent@cursor.com>
…ery parameters Address build check feedback by fixing yapf formatting in request_information.py and isort ordering in date_utils.py. Also ignore None keys when sanitizing map query parameters. Co-authored-by: Cursor <cursoragent@cursor.com>
ea0c6e2 to
79db213CompareBart Koelman (bkoelman)
commented
Jul 24, 2026
pushed fixes and rebased on latest main |
Vincent Biret (baywet)
left a comment
There was a problem hiding this comment.
Thank you for making the changes!
| elif isinstance(value, dict): | ||
| # Map-style query parameter: drop None entries per RFC 6570 §2.3 "undefined" | ||
| # semantics, then normalise remaining values. StdUriTemplate raises ValueError | ||
| # when it encounters None inside a map, so we strip them here. | ||
| sanitized_value = { | ||
| str(k): self._get_sanitized_value(v) | ||
| for k, v in value.items() if k is not None and v is not None | ||
| } |



Contributes to microsoft/kiota#3800.
Dict values used as map/dictionary query parameters (from an OpenAPI
type: objectwithadditionalPropertiesfield) are now sanitized before being passed to StdUriTemplate. None values are silently dropped per RFC 6570 §2.3 "undefined" semantics, preventing a ValueError when StdUriTemplate tries to convert None to a string. An empty string must be set explicitly to sendkey=.Adds seven test cases covering map expansion, None-value omission, empty-string inclusion, empty dicts, all-None dicts, mixed scalar+map parameters, and the set_query_string_parameters_from_raw_object() path.