Repository navigation
feat(docs): render docs payload blocks from schema examples - #9194
Open
KonstantinMirin wants to merge 9 commits into
Open
KonstantinMirin wants to merge 9 commits into
KonstantinMirin wants to merge 9 commits into
Conversation
…ata} wrappers
Draft-07 `examples` holds instances of the schema. 81 schemas wrapped
each example in a `{description, data}` object, which is not an
instance, so 75 of them failed validation against their own schema and
6 passed only because the schema is open enough to accept the wrapper.
Replace each of the 224 wrappers with its `data` payload. The payloads
are unchanged. The labels are dropped: draft-07 has no place for a
per-example label, and the 51 schemas that already wrote bare instances
carry none.
Update the four tests that read `example.data`.
Refs adcontextprotocol#8343
The schema validation suite validated `example.data || example`, so a
`{description, data}` wrapper passed whenever its payload did, and the
pagination lint unwrapped `data` the same way. Now that every example
is an instance, check them as written.
Test 13 now validates every `examples` value, at the root and at every
nested schema position, against the published composition, and fails
on a `{description, data}` wrapper in a schema that declares neither
property. It reports every failing example instead of stopping at the
first, and no longer skips sync-creatives-request and
list-creatives-response, whose examples validate.
The pagination lint reads each example as written.
Refs adcontextprotocol#8343
Resolution ledger:
- Conflicts: none. Two files changed on both sides and auto-merged in
separate hunks:
- core/reporting-subscription.json: this branch unwraps the root
example; main adds selector.dimension_systems and two allOf rules.
The unwrapped example names no dimension_systems, so it stays an
instance of the merged schema.
- tests/reporting-subscriptions.test.cjs: this branch validates the
examples as written; main adds the metro and postal dimension
systems test, which builds its payloads from allAccounts, not from
examples.
- Mechanical: package-lock.json is main's (this branch does not
change it); node_modules reinstalled with npm ci.
- Invariants: main adds no schema examples and no readers of
example.data. At the merged tree, 132 schemas carry 377 root
examples, none wrapped, and test 13 validates every example as
written.
- Proof: schema equivalence against 576ebca: 1113 roots, 0 differ,
class 1, no informational entries; --corpus-all: 611 schema
examples valid at both refs, no verdict changes. The built bundles
differ from main's only in examples.
Add scripts/docs-schema-examples.cjs. A docs JSON block that names its
`$schema` carries a `{/* schema-example: #/examples/<index> */}` marker
above the fence; the script writes the block body as that `$schema`
followed by the schema's root example at the index, and `--check`
reports, without writing:
- a marker that is not directly above a json fence;
- a bound block whose `$schema` names no schema file;
- a pointer that names no root example;
- a bound block that differs from the rendered example;
- a block with an AdCP `$schema` and no marker;
- an unbound block equal to a root example of some schema.
A block that contains "..." is illustrative and is skipped, as in
test:json-schema. The MDX comment renders nothing, so the page looks
the same and every tool that reads the fence keeps working.
tests/docs-schema-examples.test.cjs drives the CLI against a fixture
docs tree and schema tree, one rule per vector.
Refs adcontextprotocol#9120
Bind every docs JSON block that is a schema instance to the schema's root `examples`, and gate it in npm test: - 381 blocks with a `$schema` field: each validates, so its instance moves into that schema's `examples`, or binds to an equal example. - 24 blocks without `$schema` that equal a schema example: they gain the `$schema` and bind to it. - 155 blocks without `$schema` on a task reference page that are instances of that task's request or response schema: they gain the `$schema` and move into its `examples`. 71 of them lacked a required field with an evident value, which the schema example now carries: `status: "completed"` on 55 synchronous responses and an `idempotency_key` on 16 mutating requests. 519 instances are new to the `examples` of 168 schemas, appended after the examples they had. A `$schema` value that a block named stays as written; one added here uses the v3 alias when the latest 3.x release has the schema, and latest otherwise. The docs JSON field audit now sees the blocks that gained a `$schema`. Where a block showed a field its schema doesn't declare because the docs were stale, the example now uses the declared field: - si_terminate_session: `termination_context.intent` becomes `transaction_intent`; the user-exit and timeout details become `summary`; `follow_up.suggested_action` becomes `action`, with `remind_later` as `set_reminder`, and the undeclared `message` goes. The page's field tables follow the schema. - validate_content_delivery: a feature result drops `value`, which the schema's oracle pattern excludes, and `message` becomes `explanation`. - intro: the brand's `identity_agent` becomes an `agents` entry with `type: "brand"`. The baseline keeps 9 keys, each with a reason: the comply_test_controller account reference beside `sandbox`, the open `generation_context` signals, and two governance capability fields that the page documents and the schema doesn't declare. It drops 6 keys that no longer match any finding. It had 15 keys allowing 18 findings; it has 9 allowing 20. Examples in shared definitions travel into every MCP tool that bundles them, so the MCP projection's `examples` grow from 448,527 to 1,057,793 bytes and the projection to 24,514,057 bytes. Its sanity cap moves from 23 to 24 MiB; model-context views strip `examples`. Refs adcontextprotocol#9120
Preview approval requiredThis pull request comes from a fork, so Mintlify won't build a preview until someone with write access approves commit |
Contributor
|
Ladon cannot review this PR until merge conflicts are resolved. |
Resolution ledger: - semantic: package.json -> union. The `test` script keeps this branch's `test:docs-examples` (after `test:json-schema`) and main's `test:build-schemas-exit-status`. Every other script, including main's `oneof-overlap-resolution` test in `test:schemas` and the 3.3.0-rc.3 version, comes from main. - auto-merged, reviewed: 3 docs pages and 15 schema sources that both sides changed. The renderer check still renders all 560 bound blocks. - package-lock.json: main's, unchanged by this branch.
The tools/list bundler already dropped `example` and `examples` from every referenced definition, but kept them on the root request schema. The request schemas now carry root examples, which put 6,004 bytes of example payloads into the four-tool discovery surface and over its 162 KiB budget. The root document now drops them by the same rule. Example payloads document a schema; they are not contract, and validation still reads the source schemas. The four-tool surface measures 161,453 bytes, the same as on main. A new test asserts that no product discovery tool's tools/list schema carries `example` or `examples` at any depth.
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.
Stacked on #9120.
Revised 2026-11-23: Merged
mainat 52b11c1. The bundle and MCP projection sizes are re-measured against it, the training agent's discovery tools/list dropsexamples, the gates were rerun, and the Python SDK note is gone because that job passes onmainagain.Docs payload examples now render from the schema
examples, so a docs block can't drift from its schema.Inventory
A script classified the 1,860 JSON blocks in
docs/**at #9120's head:Of the 744 valid instances, 372 name their
$schema; 81 more match their page's task schema, and 291 only match a schema by field overlap. All 146 drifted blocks lack$schema, sotest:json-schemanever saw them.Mechanism
scripts/docs-schema-examples.cjswrites the body as$schemaplus the root example the marker names. I kept the JSON inline rather than in imported snippets as the conservative option: an MDX comment renders nothing and needs no Mintlify feature, and tools that read the MDX source (test:json-schema, the field audit, the docs index) still see the JSON.Applied
560 blocks render from schema examples:
$schema, all valid: each moved into, or matched, the schema'sexamples.$schema.$schemaand moved into itsexamples. 71 of them lacked one required field with an evident value:status: "completed"on 55 synchronous responses, and anidempotency_keyon 16 mutating requests.519 instances are new in the
examplesof 168 schemas, where test:schemas validates them. Shared definitions carry their examples into every bundle that inlines them: the bundled tree grows 1.6%, from 87.1 to 88.4 MB, mostly fromcore/error.json,core/provenance.json, and the format declaration, display tag, proposal, and targeting definitions. Those blocks show the component, so binding them to a task schema would change them. The MCP projection grows from 24.0 to 24.6 MB, and its sanity cap moves to 24 MiB. Its validation profiles keepexamples, while its model-context views drop them. The training agent's product discovery tools/list now drops them at every depth too, so the four-tool surface stays at main's 161,453 bytes.Remaining drift
159 blocks still fail a schema that doesn't determine the fix:
account, 6get_adcp_capabilitiesexcerpts lackadcp, 7verify_brand_claimresponses match no branch, and 13 others lack required fields.$schemaand...inbuild_creativeandpreview_creative.The full list, with errors: Docs blocks that fail their schema.
The check
npm run build:docs-exampleswrites the bound blocks.npm run test:docs-examples, innpm test, fails on a stale bound block, a broken marker or pointer, an AdCP$schemawithout a marker, and an unbound copy of a schema example.Its tests drive the CLI against fixtures, one rule per case. The field audit now sees the blocks that gained
$schema. Stale fields insi_terminate_session,validate_content_delivery, and the intro'sbrand.jsonnow use the fields their schemas declare. Its baseline goes from 15 keys to 9, each with a reason: the comply_test_controller account reference besidesandbox, the opengeneration_contextsignals, and two governance capability fields the page documents but the schema doesn't declare.Gates
On the merge with
main, everynpm teststage passes, as do CI's build-worker steps and the field audit with--check, apart from two timeouts on a loaded test box thatmainshows identically: one spawned script in test:release-workflow, and the docs-indexer heading search in test:server-unit, which passes locally. The 125 changed pages parse as MDX, with the same JSON fences as on #9120 except three illustrative ones thatsi_terminate_sessionreplaces with a table. test:snippets fails the same 22 Python snippets on #9120's head.