Repository navigation
cmdio: allow --output json for raw bodies that are JSON - #7661
Open
anshul0713 wants to merge 2 commits into
Open
anshul0713 wants to merge 2 commits into
anshul0713 wants to merge 2 commits into
Conversation
Commands that return a raw response body (serving-endpoints get-open-api, http-request, fs cat) failed with "json output not supported" under --output json, even when the body is a JSON document. Agents and scripts pass --output json by habit, so this broke them for no reason. Pass a body that is valid JSON through, indented like other JSON output. Bodies that aren't JSON still fail with the same error. Co-authored-by: Isaac <no-reply@databricks.com> Signed-off-by: Anshul Gupta <anshul.gupta@databricks.com>
Co-authored-by: Isaac <no-reply@databricks.com> Signed-off-by: Anshul Gupta <anshul.gupta@databricks.com>
Collaborator
✅ Integration test reportCommit: 65bb00c
Top 3 slowest tests (at least 2 minutes):
|
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Changes
--output jsonnow works for commands that return a raw response body, when that body is a JSON document. The body is passed through, indented like other JSON output, with numbers kept exact. Bodies that aren't JSON still fail with the samejson output not supportederror.This affects commands whose generated code renders an
io.Reader, for example:serving-endpoints get-open-api(always JSON)serving-endpoints http-request(JSON when the external API returns JSON)fs catof a JSON fileserving-endpoints export-metrics(Prometheus text) andfs catof a text file keep failing as before.Why
Agents and scripts pass
--output jsonby habit. In agent trials of shell-only Model Serving usage,serving-endpoints get-open-api NAME -o jsonfailed withjson output not supportedeven though the response is an OpenAPI JSON document. The agents then had to retry without the flag. The text renderer already copies the body unchanged; only the JSON path refused.Backward compatibility
--output json, a JSON body now renders where it used to error. A non-JSON body gets the same error as before.Tests
libs/cmdiorender tests: JSON body under--output json(indented), the same body under text output (unchanged), and an integer above 2^53 (kept exact). The existing non-JSON case still expects the error.go test ./acceptance -run TestAccept/cmdpasses, apart fromcmd/api/*, which fail onmaintoo in my environment (the user agent picks up a localmeta-harnessvalue).serving-endpoints get-open-api databricks-gpt-5-4 -o jsonreturns the schema, andserving-endpoints export-metrics NAME -o jsonstill errors../task lintpasses.This pull request and its description were written by Isaac.