Repository navigation
Add typed JSON output to doc fetch - #8797
Open
isaacroldan wants to merge 1 commit into
Open
isaacroldan wants to merge 1 commit into
isaacroldan wants to merge 1 commit into
Conversation
Contributor
Author
|
/snapit |
Suleimanlatrsh
approved these changes
Oct 7, 2026
Suleimanlatrsh
left a comment
Contributor
There was a problem hiding this comment.
Tophatted locally, default / --json / --output / --language all look good and the saved file matches the JSON content exactly. Nice split between fetching and printing, much easier to follow. Couple things:
- needs a rebase, conflicts with #8790 in
json-output-command-exceptions.js - not from this PR, but
--output docs/(a folder) comes back astype: "bug"with a stack trace instead of an abort. Same if the parent is a file. The write-failure test only checks forerror, so it'd be nice to assert the type there. Fine as a follow-up
| } | ||
|
|
||
| outputResult(body) | ||
| return {document: {url, content: await response.text()}} |
Contributor
There was a problem hiding this comment.
Q: shopify.dev redirects a lot (/docs/api/admin lands on /docs/api/admin-graphql) and this returns the URL that was passed in, not where we ended up. Would response.url be more useful here so scripts get the real page? Fine either way since the schema says "requested" URL
isaacroldan
force-pushed
the
codex/doc-fetch-json
branch
from
October 7, 2026 16:01
ba8a795 to
06f6a6b
Compare
github-merge-queue
Bot
removed this pull request from the merge queue due to a conflict with the base branch
Oct 7, 2026
dmerand
approved these changes
Oct 7, 2026
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.
WHY are these changes introduced?
doc fetchprints Markdown or saves a file, but scripts cannot request a typed result or discover its schema.WHAT is this pull request doing?
Add
--jsonand schema discovery. Keep document retrieval separate from presentation, preserve the default Markdown output, and return a file receipt after a successful write. The output file still contains the original Markdown.Both examples show the same document excerpt; the remaining Markdown is omitted.
Default output:
JSON output:
{ "document": { "url": "https://shopify.dev/docs/api/shopify-cli", "content": "---\ntitle: Shopify CLI\n" } }Validation: 36 focused tests, build, type-check, and lint pass. Live command checks and adversarial review cover stdout/stderr, file bytes and receipts, schema discovery, and failure exits.
How to manually test your changes?
Compare the inline Markdown with the JSON document. For file output, check the receipt on stdout and the Markdown in
shopify-cli.md.Checklist