-
Notifications
You must be signed in to change notification settings - Fork 65
Fix bug in subtype deserialization #2
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
Conversation
|
@annatisch no test for that? You sure it still works with current generated code? |
|
It's mostly tested via the AutoRest tests - though I can add more deserialization tests to msrest now that we no longer have that verification... In the older generator: Attribute name, subtype key and attribute mapping (i.e. service name) were all identical - so the attribute could be identified by the subtype key. Older generator: _attribute_map = {
'Name': {'key': 'Name', 'type': 'str' },
'location': {'key': 'Location', 'type': 'str'}
}
_subtype_map = {'Name': {'subClassA': 'SubClassA', 'subClassB': 'SubClassB'}Now with the new generator, the subtype key and the attribute mapping are the same, but the attribute name will be pythonic (so it might be the same by chance, but likely will have alternative casing). New generator: _attribute_map = {
'name': {'key': 'Name', 'type': 'str' },
'location': {'key': 'Location', 'type': 'str'}
}
_subtype_map = {'Name': {'subClassA': 'SubClassA', 'subClassB': 'SubClassB'}So the new behavior should work with both old and new generation. |
|
@annatisch I think I remember you told me to wait on this? What's the status now? |
|
@lmazuel |
|
@annatisch given your message, it's not what I see: _attribute_map = {
'odatatype': {'key': 'odata\\.type', 'type': 'str'},
}
_subtype_map = {
'odatatype': {'Microsoft.Azure.Management.Insights.Models.ThresholdRuleCondition': 'ThresholdRuleCondition', 'Microsoft.Azure.Management.Insights.Models.LocationThresholdRuleCondition': 'LocationThresholdRuleCondition', 'Microsoft.Azure.Management.Insights.Models.ManagementEventRuleCondition': 'ManagementEventRuleCondition'}
}special case because of the escaping? |
|
Same with Machine Learning: _attribute_map = {
'package_type': {'key': 'packageType', 'type': 'str'},
}
_subtype_map = {
'package_type': {'Graph': 'WebServicePropertiesForGraph'}
}It seems both keys in both dicts are Pythonic |
|
@annatisch I think this is included in #12? I commited you doc update directly on master: |
No description provided.