python icon indicating copy to clipboard operation
python copied to clipboard

Support dict[...] syntax in ApiClient.__deserialize

Open mohsinm-dev opened this issue 1 month ago • 3 comments

Summary

  • Adds support for modern dict[str, str] syntax in ApiClient.__deserialize()
  • Maintains backward compatibility with existing dict(str, str) syntax
  • Enables Pydantic adapter compatibility for openapi_types

Changes

  • Added post-generation patch scripts/api_client_dict_syntax.diff
  • Updated scripts/update-client.sh to apply patch during client generation
  • Added comprehensive unit tests covering both syntaxes and nested dicts

Test plan

  • [x] Unit test test_deserialize_dict_syntax_compatibility passes
  • [x] Legacy dict(str, str) syntax continues to work
  • [x] New dict[str, str] syntax works correctly
  • [x] Nested dict[str, dict[str, str]] syntax works
  • [x] No breaking changes to existing functionality

Fixes #2463

mohsinm-dev avatar Nov 01 '25 11:11 mohsinm-dev

Adding the "do-not-merge/release-note-label-needed" label because no release-note block was detected, please follow our release note process to remove it.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

k8s-ci-robot avatar Nov 01 '25 11:11 k8s-ci-robot

Keywords which can automatically close issues and at(@) or hashtag(#) mentions are not allowed in commit messages.

The list of commits with invalid commit messages:

  • 1a3a022 client: accept dict[...] in ApiClient.__deserialize (keep dict(...) support)

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. I understand the commands that are listed here.

k8s-ci-robot avatar Nov 01 '25 11:11 k8s-ci-robot

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: mohsinm-dev Once this PR has been reviewed and has the lgtm label, please assign yliaog for approval. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found here.

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment Approvers can cancel approval by writing /approve cancel in a comment

k8s-ci-robot avatar Nov 01 '25 11:11 k8s-ci-robot