Repository navigation
Conversation
|
Azure Pipelines: Successfully started running 1 pipeline(s). 1 pipeline(s) were filtered out due to trigger conditions. There may be pipelines that require an authorized user to comment /azp run to run. |
There was a problem hiding this comment.
🔵 Needs a closer look
Shared generated-SDK deserialization changes need confirmed regression-test results and final human review; execution was not verified here.
No open issues 🎉
What changed in this PR
Fixes the Python emitter so SDK model and TypedDict annotations preserve nullable properties and collection elements without making required constructor arguments optional.
Changes:
- Carries element nullability through the emitter and Python annotation generation, including nested collections.
- Keeps collection-element nullability separate from XML field optionality and preserves delimited-array decoding.
- Adds regression tests and a changelog entry.
| File | Description |
|---|---|
packages/http-client-python/tests/unit/test_nullable_properties.py |
Tests nullable annotations and constructor requiredness. |
packages/http-client-python/tests/unit/test_nullable_collections.py |
Tests collection annotations, imports, nesting, and forward references. |
packages/http-client-python/tests/unit/test_nullable_collection_deserialization.py |
Tests XML defaults, nullable items, and delimited decoding. |
packages/http-client-python/generator/pygen/codegen/templates/model_base.py.jinja2 |
Separates field optionality from element nullability during decoding. |
packages/http-client-python/generator/pygen/codegen/models/property.py |
Preserves property nullability in annotations and imports. |
packages/http-client-python/generator/pygen/codegen/models/list_type.py |
Adds nullable list-element annotations and documentation. |
packages/http-client-python/generator/pygen/codegen/models/dictionary_type.py |
Adds nullable dictionary-value annotations and documentation. |
packages/http-client-python/emitter/test/nullable-collections.test.ts |
Tests nested nullability and shared-type isolation. |
packages/http-client-python/emitter/src/types.ts |
Emits collection-element nullability metadata. |
.chronus/changes/python-nullable-type-annotations-2026-10-24.md |
Documents the annotation fix. |
Review effort: Balanced
|
sorenqh please read the following Contributor License Agreement(CLA). If you agree with the CLA, please reply with the following information.
Contributor License AgreementContribution License AgreementThis Contribution License Agreement (“Agreement”) is agreed to by the party signing below (“You”),
|
…oft#12402) The Dependabot policy currently approves and enables auto-merge for human-authored PRs too. For example, the policy [approved microsoft#12395](microsoft#12395 (review)) despite it not being a Dependabot PR. `issueAuthor: true` makes the sender condition match the PR author rather than restrict it to the configured bot login. Set it to `false` so approval, labeling, and auto-merge remain limited to Dependabot PRs targeting `main`. Fixes a regression introduced by microsoft#12129. Existing approvals, labels, and auto-merge requests are not retroactively removed.
The Python emitter drops nullability from required model properties and collection element types. For example,
string | nullbecomesstr, and(Child | null)[]becomeslist[Child], so generated type annotations contradict the API contract.Preserve nullability in SDK model and TypedDict annotations, including nested lists and dictionaries, while keeping required constructor arguments required. Keep collection-element nullability separate from the containing field so required unwrapped XML lists still deserialize missing items as empty lists. Preserve delimited-array decoding when nullable elements introduce an
Optionalwrapper.