Skip to content

Fix Python client dropping external catalog subtype fields during deserialization (#5409) - #5457

Open
SHIVANSH-ux-ys wants to merge 1 commit into
apache:mainfrom
SHIVANSH-ux-ys:feature-5409-external-catalog-deserialization
Open

Fix Python client dropping external catalog subtype fields during deserialization (#5409)#5457
SHIVANSH-ux-ys wants to merge 1 commit into
apache:mainfrom
SHIVANSH-ux-ys:feature-5409-external-catalog-deserialization

Conversation

@SHIVANSH-ux-ys

Copy link
Copy Markdown

Rationale for this change

Fixes #5409.

When deserializing ConnectionConfigInfo subclasses in the Python client SDK (IcebergRestConnectionConfigInfo, HadoopConnectionConfigInfo, HiveConnectionConfigInfo), OpenAPI Generator's Python discriminator mapper drops subtype-specific properties (remoteCatalogName, warehouse) if they are declared as sibling properties alongside allOf instead of inside an object schema within allOf.

What changes are included in this PR?

  1. Modified spec/polaris-management-service.yml to nest subtype properties inside a second - type: object block under allOf for IcebergRestConnectionConfigInfo, HadoopConnectionConfigInfo, and HiveConnectionConfigInfo (matching existing AwsStorageConfigInfo pattern).
  2. Regenerated management client SDK models so remote_catalog_name and warehouse are generated as top-level fields on the respective models.
  3. Added unit tests in client/python/tests/test_connection_config_deserialization.py verifying deserialization of external catalog subtype fields.

Are these changes tested?

Yes. Added unit test in client/python/tests/test_connection_config_deserialization.py and verified all 202 Python unit tests pass cleanly (uv run pytest tests/).

…alization (apache#5409)

Move properties of IcebergRestConnectionConfigInfo, HadoopConnectionConfigInfo,
and HiveConnectionConfigInfo inside an object schema within allOf in
spec/polaris-management-service.yml so openapi-generator maps subtype fields
correctly. Regenerate management client SDK models and add unit test.

Signed-off-by: SHIVANSH-ux-ys <singaser78@gmail.com>
this is specified as the 'warehouse' when multiple logical catalogs are served under the same base
uri, and often translates into a 'prefix' added to all REST resource paths
- type: object
properties:

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This fix (nesting properties inside a second allOf object) is correct, but I believe the same issue exists in:

  • OAuthClientCredentialsParameters for tokenUri/clientId/clientSecret/scopes
  • BearerAuthenticationParameters for bearerToken
  • SigV4AuthenticationParameters for roleArn/signingRegion
  • AwsIamServiceIdentityInfo for iamArn

AuthenticationParameters and ServiceIdentityInfo are discriminated the same way as ConnectionConfigInfo, so these will hit the exact bug. Maybe worth fixing in this PR.

# under the License.
#

from apache_polaris.sdk.management import (

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These tests cover the 3 ConnectionConfigInfo subtypes fixed in this PR.

As mentioned earlier, as AuthenticationParameters/ServiceIdentityInfo share the same pattern and have the issue, we could add the corresponding tests for these ones as well.

@MonkeyCanCode

Copy link
Copy Markdown
Contributor

Maybe I missed something here but I thought we already have a PR for this: #5410

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Python client drops external catalog subtype fields during deserialization

3 participants