Preserve nullable response and event fields - #2
Merged
Merged
Conversation
Use model field exclusion metadata instead of blanket null filtering for response codecs, SSE, and problem responses. Omit absent standard problem fields individually and cover nullable fields, aliases, nesting, and valid empty values.
Construct test models with their typed Python field names and annotate the expected JSON mapping. Preserve alias assertions on the serialized wire output.
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.
Response codecs, server-sent events, and Litestar problem responses applied blanket null exclusion, dropping explicit null even when a generated field permits or requires it. Preserve nullable values and let field-level Pydantic metadata decide which absent properties to omit. Standard RFC problem fields keep individual null-omission metadata.
Companion runtime fix for outfoxx/sunday-generator#220, discovered while auditing outfoxx/sunday-generator#219 across all generated languages. Request and merge-patch presence behavior is unchanged. The generator change adds omission metadata for optional non-nullable fields; deploy regenerated models with the updated runtime for complete response behavior.
Validation: Ruff lint and format checks, mypy across source, tests, and tools (40 files), and all 119 pytest tests passed with 91.75% coverage. Regression coverage includes required/optional nullable fields, aliases, nested values, empty/zero/false values, SSE, and nullable problem extensions.