Commit 0615eb4
authored
fix: Handle optional properties in load namespace properties response (#3169)
Closes #3167
# Rationale for this change
The rest spec model `GetNamespaceResponse` defines the `properties`
field as optional, and nullable. Also, following the description if the
rest catalog doesn't support ns properties they should return null.
Link:
https://github.com/apache/iceberg/blob/0a73da119ff38ee3a98f248b42180caa51001cec/open-api/rest-catalog-open-api.yaml#L4146-L4163
```yaml
GetNamespaceResponse:
type: object
required:
- namespace
properties:
namespace:
$ref: '#/components/schemas/Namespace'
properties:
type: object
description:
Properties stored on the namespace, if supported by the server.
If the server does not support namespace properties, it should return null for this field.
If namespace properties are supported, but none are set, it should return an empty object.
additionalProperties:
type: string
example: { "owner": "Ralph", 'transient_lastDdlTime': '1452120468' }
default: { }
nullable: true
```
Looks like the pydantic models raise a `ValidationError` in the optional/null cases as seen in the issue above. So this PR adds a fix to handle these cases.
## Are these changes tested?
Yes, added tests and tested with s3tables api
## Are there any user-facing changes?
Not really1 parent 1a54e9c commit 0615eb4
File tree
2 files changed
+41
-1
lines changed- pyiceberg/catalog/rest
- tests/catalog
2 files changed
+41
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
337 | 337 | | |
338 | 338 | | |
339 | 339 | | |
340 | | - | |
| 340 | + | |
| 341 | + | |
| 342 | + | |
| 343 | + | |
| 344 | + | |
| 345 | + | |
| 346 | + | |
| 347 | + | |
341 | 348 | | |
342 | 349 | | |
343 | 350 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
922 | 922 | | |
923 | 923 | | |
924 | 924 | | |
| 925 | + | |
| 926 | + | |
| 927 | + | |
| 928 | + | |
| 929 | + | |
| 930 | + | |
| 931 | + | |
| 932 | + | |
| 933 | + | |
| 934 | + | |
| 935 | + | |
| 936 | + | |
| 937 | + | |
| 938 | + | |
| 939 | + | |
| 940 | + | |
| 941 | + | |
| 942 | + | |
| 943 | + | |
| 944 | + | |
| 945 | + | |
| 946 | + | |
| 947 | + | |
| 948 | + | |
| 949 | + | |
| 950 | + | |
| 951 | + | |
| 952 | + | |
| 953 | + | |
| 954 | + | |
| 955 | + | |
| 956 | + | |
| 957 | + | |
925 | 958 | | |
926 | 959 | | |
927 | 960 | | |
| |||
0 commit comments