Azure-cli: Capitalization of response field name is being changed

Created on 21 Jul 2017  路  11Comments  路  Source: Azure/azure-cli

Description

We have a field in our Batch pool GET command called nodeAgentSKUId. In debug mode I can confirm this is the capitalization used in the response for the command az batch pool show <pool-id>.
In the Azure Python SDK, this field name is deserialized to: node_agent_sku_id, and it seems that the CLI code is then converting this name to: nodeAgentSkuId.

We have a customer that is trying to use the json output as input for new requests and this change in capitalization has caused some difficulties. Is there anyway that the CLI core could use the serialization key from the response object _attribute_map to maintain the same field names used in the response?

Alternatively, is there a way for us to override the way this JSON is serialized in the Batch command module on a command-by-command basis?

Thanks!

(Although these issues are in batch-extensions - they refer to commands that are part of our standard CLI command module)
Batch CLI issue: https://github.com/Azure/azure-batch-cli-extensions/issues/29

Update:
We've found an additional instance of this happening: username -> userName
https://github.com/Azure/azure-batch-cli-extensions/issues/30


Environment summary

Install Method: How did you install the CLI? (e.g. pip, interactive script, apt-get, Docker, MSI, nightly)
pip

CLI Version: What version of the CLI and modules are installed? (Use az --version)
azure-cli (2.0.10)

OS Version: What OS and version are you using?
Windows

Shell Type: What shell are you using? (e.g. bash, cmd.exe, Bash on Windows)
cmd.exe

Core Discussion

Most helpful comment

@lmazuel is working on making the serialization process case insensitive at the SDK level, which will automagically fix this for us. 馃憤

All 11 comments

@tjprescott, @troydai, @derekbekoe - any thoughts on the above?

I think the best solution would be to try and get the casing from the _attribute map, using the default behavior if that failed.

@lmazuel is working on making the serialization process case insensitive at the SDK level, which will automagically fix this for us. 馃憤

That would be amazing! Thanks @lmazuel!

@annatisch this should be fixed now thanks to @lmazuel. While the CLI will still adjust the casing, the SDK will accept the altered value. The following should all be accepted:
nodeAgentSKUId, nodeagentskuid, node_agent_sku_id, nodeAgentSkuId

@annatisch msrest >= 0.4.14

@annatisch is this issue fixed?

@troydai It looks like the issue isn't fixed at cli 2.0.31.

@lmazuel @troydai This issue wasn't fixed yet. I use the latest cloudshell.

"nodeAgentSKUId": "batch.node.ubuntu 16.04" --> deserialize succeed
"nodeAgentSkuId": "batch.node.ubuntu 16.04" --> Parameter 'VirtualMachineConfiguration.node_agent_sku_id' can not be None.

add to S165.

This issue should have been fixed as #29

Was this page helpful?
0 / 5 - 0 ratings