Azure / azure-devops-cli-extension

Azure DevOps Extension for Azure CLI
https://docs.microsoft.com/en-us/cli/azure/ext/azure-devops/?view=azure-cli-latest
MIT License
618 stars 240 forks source link

JMESPath Cannot query values containing a dot in the key #1253

Open Apollo-Roboto opened 2 years ago

Apollo-Roboto commented 2 years ago

This is autogenerated. Please review and update as needed.

Describe the bug

Trying to query specific values from a work-item using the az boards cli with the --query parameter fails as some of the keys in the JSON payload contains a dot in them. The following parameter is expected to return the title of a work item: --query "fields.`"System.Title`""

Sample payload without the --query

{
  "fields": {
    ...
    "System.Description": "<div>Sample Description</div>",
    "System.Id": 1234,
    "System.Title": "Sample Title"
    ...
  },
  ...
}

Command Name az boards work-item show Extension Name: azure-devops. Version: 0.21.0.

To Reproduce:

Command used (id and organization has been removed)

az boards work-item show `
  --id {} `
  --organization {} `
  --query "fields.`"System.Title`""

Expected Behavior

The title of the task returned in the terminal output.

Environment Summary

Windows-10-10.0.18362-SP0
Python 3.8.9
Installer: MSI

azure-cli 2.26.1 *

Extensions:
azure-devops 0.21.0

Additional Context

joshuadmatthews commented 2 years ago

Seconded, this is blocking me from checking if an ACR Task credentials exists as I can't query the result object.

oyvindh commented 1 year ago

Try: 'fields."System.Title"'

lambda-snail commented 1 year ago

Escaping the quotes as suggested in here works for me --query 'fields.\"System.Title\"'