-
Notifications
You must be signed in to change notification settings - Fork 98
expose a callback to let client side perform extra logics #80
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
|
//cc: @lmazuel @derekbekoe |
|
Looks good. I'd be fine to introduce this change. |
|
@derekbekoe, I updated the callback a bit so to be invoked after each layer's conversion. This gives the caller a chance to see both the original object and the dictionary object. This would allow more custom logics while the knack can stay unchanged. |
|
Taking a look at CI. |
|
See #82 |
|
@derekbekoe, can you please take a look and approve it if no other issues were found? |
|
@yugangw-msft I don't get your code, could you show again your example updated? The example in your initial comment takes three arguments, so I guess it was a former version. Could you share what you mean now? |
|
Sorry, i should have updated. See my CLI PR Azure/azure-cli#6277. @classmethod
def remove_additional_prop_layer(cls, obj, converted_dic):
from msrest.serialization import Model
if isinstance(obj, Model):
# let us make sure this is the additional properties auto-generated by SDK
if ('additionalProperties' in converted_dic and isinstance(obj.additional_properties, dict)):
converted_dic.update(converted_dic.pop('additionalProperties'))
return converted_dic |
Say, to ignore the empty
additional_properties, the CLI code will be updated toThe initial profile data shows only 4 more milliseconds to list 36 virtual machines with overall 2.45 seconds realtime, so the increase is very marginal.