decree-docs: add doc model, schema loaders, and JSON output#936
Merged
Conversation
Define the tool's own documentation model in docmodel: a complete, strongly-typed superset of the core docgen schema with a versioned, lowerCamel JSON serialization as the contract for third-party renderers. Add loaders that populate it from schema YAML (via sdk/tools/validate) and from a server through the adminclient interface seam, canonicalized so both sources produce deep-equal models for equivalent content, and wire a generate subcommand running --file/--format json end to end with golden fixtures pinning the shape. Closes #914 Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
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.
Summary
docmodelpackage that supersets the minimal sdk/tools/docgen schema (info, named examples, externalDocs, version_description, allowed_schemes — no untyped fields), so every later backend renders from one complete model.docModelVersionroot marker, all documented in the package doc and pinned by golden fixtures plus a canonical-form test.loader.SchemaClientinterface that*adminclient.Clientsatisfies); both canonicalize so the equivalence guarantee is structural, not fixture luck. Two drift tests mirror cmd/decree's: every adminclient and every file-format property must be mapped or explicitly listed as not-documented.decree-docs generate --file <schema> --format json; server-mode dialing flags are deferred to decree-docs: config file and template override system #918 (config surface) — the scaffold's dependency footprint deliberately excludes grpctransport until then.Test plan
make test— all modules pass, including the three new packages./scripts/check-coverage.sh— contrib/decree-docs 99.1%, ratchet floor raised 88.8 → 99.0make lint-goclean;gofumpt -lempty;go build/go vetcleangenerate --file testdata/full.schema.yaml --format jsonexits 0, byte-identical to the goldenCloses #914