fix(rest): Make NamespaceResponse.properties optional and nullable#3212
Closed
jamesbornholt wants to merge 1 commit intoapache:mainfrom
Closed
fix(rest): Make NamespaceResponse.properties optional and nullable#3212jamesbornholt wants to merge 1 commit intoapache:mainfrom
jamesbornholt wants to merge 1 commit intoapache:mainfrom
Conversation
…r Iceberg REST spec The IRC spec's GetNamespaceResponse schema only requires the 'namespace' field; namespace property support is optional and the 'properties' field is nullable. The pyiceberg NamespaceResponse model declared properties as required with no default, causing pydantic validation failures when servers omit the field or set it to null. Add default_factory=dict so that an omitted field defaults to an empty dict, and a field_validator to coerce null to an empty dict. Add tests for both cases.
Contributor
|
Looks like this might be a duplicate of #3169 |
Contributor
Author
|
Yep, sure is. Sorry about that! |
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.
Rationale for this change
The IRC spec's GetNamespaceResponse schema only requires the 'namespace' field; namespace property support is optional and the 'properties' field is nullable. The pyiceberg NamespaceResponse model declared properties as required with no default, causing pydantic validation failures when servers omit the field or set it to null.
Add default_factory=dict so that an omitted field defaults to an empty dict, and a field_validator to coerce null to an empty dict. Add tests for both cases.
For comparison, in the Java code, Jackson leaves
propertiesasnullwhen absent or explicitly null, and then the getter returns an empty map.Are these changes tested?
Yes, new unit tests.
Are there any user-facing changes?
No.