Repository navigation
Add typed JSON output to doc search - #8798
isaacroldan wants to merge 2 commits into
Conversation
|
/snapit |
|
/snapit |
|
🫰✨ Thanks @isaacroldan! Your snapshot has been published to npm. Built from Test the snapshot by installing your package globally: pnpm i -g --@shopify:registry=https://registry.npmjs.org @shopify/cli@0.0.0-snapshot-20261006142201Caution After installing, validate the version by running |
There was a problem hiding this comment.
Looks good! I tried a bunch of real searches with --json and everything lined up with the normal output. The errors look clean too. Heads up, this one will probably need the same rebase as #8797 once that merges.
498fdad to
eea8f93
Compare
| .object({ | ||
| results: zod.array(documentationSearchEntrySchema).describe('The top matching chunks from one search request.'), | ||
| pageInfo: PageInfoSchema, |
There was a problem hiding this comment.
Nit: for consistency, would we not want the document object itself named e.g.:
results: {
document: {
score:,
content:,
...
}
}
WHY are these changes introduced?
doc searchprints the search response but has no JSON flag or discoverable result contract. This PR is stacked on the doc fetch change.WHAT is this pull request doing?
Add
--jsonand schema discovery for documentation matches. JSON mode returns a namedresultscollection and records unknown pagination metadata. Preserve the raw response in default mode, including successful responses that do not match the JSON schema; JSON mode reports those responses through the standard fatal-error path.The examples show the same response excerpt. Other matches and the remaining chunk content are omitted.
Default output:
[ { "score": 0.8255787, "content": "Manage webhook subscriptions", "url": "https://shopify.dev/docs/apps/build/webhooks/subscribe", "title": "Manage webhook subscriptions", "domain": "webhooks" } ]JSON output:
{ "results": [ { "score": 0.8255787, "content": "Manage webhook subscriptions", "url": "https://shopify.dev/docs/apps/build/webhooks/subscribe", "title": "Manage webhook subscriptions", "domain": "webhooks" } ], "pageInfo": { "hasNextPage": null } }Validation: 73 documentation tests, build, type-check, lint, and Knip pass. Live command checks and adversarial review cover result projection, raw-response bytes, schema discovery, output channels, and failure exits.
How to manually test your changes?
Compare the raw response with the typed JSON object. The invalid API version should return one error document and a nonzero exit code.
Checklist