Extend JMESPath support to Message methods#6735
Extend JMESPath support to Message methods#6735scottaddie wants to merge 4 commits intoAzure:mainfrom
Conversation
There was a problem hiding this comment.
Pull request overview
Extends the existing --query (JMESPath) filtering support for JSON output to also apply to console “message”/UX event envelopes, enabling callers to query into data.message without manually parsing the event wrapper.
Changes:
- Introduces an optional
output.Queryableinterface and implements it onJsonFormatter. - Updates
AskerConsole.MessageandAskerConsole.MessageUxItemto apply query filtering before emitting JSON. - Adds unit tests covering
QueryFilterand message JSON query behavior.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| cli/azd/pkg/output/query_test.go | Adds tests for JsonFormatter.QueryFilter and Queryable implementation. |
| cli/azd/pkg/output/json.go | Implements Queryable via JsonFormatter.QueryFilter. |
| cli/azd/pkg/output/formatter.go | Adds the Queryable interface for optional query filtering. |
| cli/azd/pkg/input/console_test.go | Adds tests intended to verify Message() JSON output is query-filtered. |
| cli/azd/pkg/input/console.go | Applies query filtering to Message and MessageUxItem JSON emission paths. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Azure Dev CLI Install InstructionsInstall scriptsMacOS/Linux
bash: pwsh: WindowsPowerShell install MSI install Standalone Binary
MSI
Documentationlearn.microsoft.com documentationtitle: Azure Developer CLI reference
|
|
This would be a breaking change for AzureDeveloperCredential in all languages and old versions. My recommendation would be not to do this @rajeshkamal5050 @kristenwomack FYI @chlowell - You were asking the other day how stable was the response. |
|
I agree we don't want to introduce breaking changes. Is there a way something like this could be implemented in a non-breaking fashion? It's painful to see consumers writing code to manually parse the response, when it can easily be solved with JMESPath. |
Enhance the JMESPath support added in #6664 by extending it to the Message methods.
Current behavior
When logged out,
azd auth token --output json --query data.messagereturns:{"type":"consoleMessage","timestamp":"2026-02-06T15:48:49.8045685-06:00","data":{"message":"\nERROR: fetching token: AzureCLICredential: ERROR: Please run 'az login' to setup account.\r\n\n"}}New behavior
When logged out,
azd auth token --output json --query data.messagereturns:This new support allows us to avoid writing code to manually parse the JSON. For example, in this PR.