Add script for TOML config schema doc generation#6979
Add script for TOML config schema doc generation#6979ryancbahan wants to merge 11 commits intomainfrom
Conversation
This stack of pull requests is managed by Graphite. Learn more about stacking. |
Coverage report
Test suite run success3833 tests passing in 1480 suites. Report generated by 🧪jest coverage report action from 3e1add3 |
Adds a new hidden `docs:generate-schema` command that authenticates, fetches all extension specifications, and generates `.doc.ts` files in the `ReferenceEntityTemplateSchema` format for the existing `generate-docs` pipeline. - One consolidated page for app.toml (Global + per-module sections) - One page per extension type - JSON Schema contracts used when available, Zod→JSON Schema fallback via zod-to-json-schema for specs without contracts - Flat dot-notation interfaces for generate-docs compatibility - Build pipeline updated to compile configuration docs if present Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
836414a to
553e7c0
Compare
07ccc99 to
2929234
Compare
553e7c0 to
c48918c
Compare
The generate-docs tool overwrites output on each invocation. Schema docs and command docs must be compiled separately (different tsconfigs) but passed to generate-docs together so both end up in generated_docs_data.json. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
c48918c to
33fc9f7
Compare
The service function is imported by bin/docs/generate-schema-docs.js (via dist/), so knip can't trace it from the bin entry. Add it explicitly to the packages/app knip entries. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
3656b99 to
77b8d03
Compare
Reset lockfile to main and re-ran pnpm install to get a minimal diff (only zod-to-json-schema addition). Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
These files were accidentally left untracked. The service function contains the logic extracted from the deleted oclif command, and the bin script is the new entry point for pnpm generate-schema-docs. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
When merging allOf subschemas, the spread overwrite lost the required array from earlier subschemas. Now required arrays are concatenated, so fields from all subschemas are correctly marked as required in docs. Also add a comment explaining intentional word splitting in build-dev-docs.sh. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Use the existing escapeSingleQuotes helper when emitting enum values in tsTypeForField to prevent syntax errors if a value contains ' or \. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
|
We detected some changes at Caution DO NOT create changesets for features which you do not wish to be included in the public changelog of the next CLI release. |
|
|
||
| const clientId = process.argv[2] | ||
| if (!clientId) { | ||
| console.error('Usage: node bin/docs/generate-schema-docs.js <client-id>') |
There was a problem hiding this comment.
we will need to pass a client id in order to dump extension data until we have a static way to grab schemas without being app-scoped.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
| } | ||
| return {...prop, ...merged, allOf: undefined} | ||
| } | ||
| // For anyOf/oneOf, pick the first non-null branch |
There was a problem hiding this comment.
This may require returning to -- generated docs on pr above this seem good, but the quality of our docgen will be proportional to how straightforward and correct our json contracts are.

WHY are these changes introduced?
We need to generate TOML configuration reference docs for shopify.dev. This tooling needs authenticated API calls (
appFromIdentifiers,fetchSpecifications) which require the full CLI runtime, so it lives inpackages/appand runs via a bin script afterpnpm build.WHAT is this pull request doing?
Adds a new
pnpm generate-schema-docsworkflow that fetches extension specs from the API and generates doc/interface/example files for all app config sections and extension types:packages/app/src/cli/services/docs/schema-to-docs.ts— utilities to convert JSON schemas from extension specs into doc-site-compatible TypeScript files (doc pages, interface definitions, example TOML)packages/app/src/cli/services/docs/generate-schema-docs.ts—generateSchemaDocs(basePath)service function that authenticates, fetches specs, partitions them into app config vs extensions, and writes all output filesbin/docs/generate-schema-docs.js— thin ESM entry point that imports from built distbin/docs/build-dev-docs.sh— updated to compile and include config docs alongside command docs when presentbin/docs/tsconfig.schema-docs.json— TypeScript config for compiling the generated.doc.tsfilespnpm generate-schema-docsscript in rootpackage.jsonOutput goes to
docs-shopify.dev/configuration/(doc pages, interfaces, examples) and feeds into the existingbuild-dev-docspipeline.How to test your changes?
pnpm buildpnpm shopify auth loginpnpm generate-schema-docs— produces files indocs-shopify.dev/configuration/pnpm build-dev-docs— includes config pages in generated outputpnpm knippassesMeasuring impact
Checklist