Content-Length: 253153 | pFad | http://github.com/Azure/azure-sdk-for-python/issues/41398

EF [mgmt][typespec migration] `as_dict` behavior change for hierarchy model · Issue #41398 · Azure/azure-sdk-for-python · GitHub
Skip to content

[mgmt][typespec migration] as_dict behavior change for hierarchy model #41398

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
msyyc opened this issue Jun 3, 2025 · 2 comments
Open

[mgmt][typespec migration] as_dict behavior change for hierarchy model #41398

msyyc opened this issue Jun 3, 2025 · 2 comments
Assignees
Labels
AVS Mgmt This issue is related to a management-plane library. needs-discussion

Comments

@msyyc
Copy link
Member

msyyc commented Jun 3, 2025

When try to migrate azure-mgmt-avs from swagger to typespec, I find the following breakings for hierarchy model:

  • Before
from azure.mgmt.avs.models import CloudLink

model = CloudLink(linked_cloud="hello")
model_dict = model.as_dict(keep_readonly=False)
print(model_dict) # output: {'linked_cloud': 'hello'}
  • After
from azure.mgmt.avs.models import CloudLink

model = CloudLink(linked_cloud="hello")
model_dict = model.as_dict(exclude_readonly=True)
print(model_dict) # output: {'properties': {'linkedCloud': 'hello'}}

We can see there are 3 breakings:

  1. keep_readonly is renamed to exclude_readonly with reverse meaning
  2. key is changed from snake_case to camelCase
  3. old as_dict hide the hierarchy structure to follow model structure while new as_dict respect the hierarchy structure to keep consistent with REST API layer.
@msyyc msyyc self-assigned this Jun 3, 2025
@msyyc msyyc added Mgmt This issue is related to a management-plane library. needs-discussion labels Jun 3, 2025
@github-actions github-actions bot added AVS needs-team-attention Workflow: This issue needs attention from Azure service team or SDK team Service Attention Workflow: This issue is responsible by Azure service team. labels Jun 3, 2025
@msyyc msyyc removed Service Attention Workflow: This issue is responsible by Azure service team. needs-team-attention Workflow: This issue needs attention from Azure service team or SDK team labels Jun 3, 2025
@msyyc msyyc changed the title [mgmt] as_dict behavior change for hierarchy model [mgmt][typespec migration] as_dict behavior change for hierarchy model Jun 3, 2025
@Azure Azure deleted a comment from github-actions bot Jun 3, 2025
@Azure Azure deleted a comment from github-actions bot Jun 3, 2025
@msyyc
Copy link
Member Author

msyyc commented Jun 3, 2025

1 and 2 are easy to fix for SDK users. While for 3, the breaking is relatively bigger since the output structure changes.

@msyyc
Copy link
Member Author

msyyc commented Jun 5, 2025

proposal to mitigate the breakings to least : https://gist.github.com/iscai-msft/aeff44a16b1367f2807a7b8186f2cd00

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
AVS Mgmt This issue is related to a management-plane library. needs-discussion
Projects
None yet
Development

No branches or pull requests

1 participant








ApplySandwichStrip

pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

Fetched URL: http://github.com/Azure/azure-sdk-for-python/issues/41398

Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy