feat(docs): accept the namespaced documented-data-type marker - #12301
Conversation
|
This pull request is part of a Mergify stack:
|
Merge Protections🔴 3 of 7 protections blocking · waiting on 👀 reviews and ⛓️ dependency
🔴 ⛓️ Depends-On RequirementsWaiting for
This rule is failing.Requirement based on the presence of
🔴 👀 Review RequirementsWaiting for
This rule is failing.
🔴 🔎 ReviewsWaiting for
This rule is failing.
Show 4 satisfied protections🟢 🤖 Continuous Integration
🟢 Enforce conventional commitMake sure that we follow https://www.conventionalcommits.org/en/v1.0.0/
🟢 📕 PR description
🟢 🚦 Auto-queueWhen all merge protections are satisfied, this pull request will be queued automatically. |
f390aeb to
40c537b
Compare
Revision history
|
There was a problem hiding this comment.
🟢 Ready to approve
The implementation is minimal, backward-compatible, and covered by targeted unit tests for both marker spellings.
This review doesn't count toward merge requirements. Sign up for the private preview to control whether Copilot approvals count.
Pull request overview
Updates the docs-site schema utilities to recognize the engine’s renamed “documented data type” marker (x-has-data-type → x-mergify-has-data-type) while remaining backward-compatible during the schema sync transition, so build-time anchor validation continues to work regardless of merge order between repos.
Changes:
- Teach
isDataTypeto accept both the new namespaced marker and the legacy marker. - Expand unit tests to cover both marker spellings and ensure non-boolean values are rejected.
- Update
collectDataTypeTitlestest fixtures/documentation to reflect the namespaced key.
File summaries
| File | Description |
|---|---|
| src/util/dataType.ts | Accepts both marker spellings via a small key list and checks them through isDataType. |
| src/util/dataType.test.ts | Adds coverage for namespaced vs legacy marker behavior and updates schema fixtures accordingly. |
Review details
- Files reviewed: 2/2 changed files
- Comments generated: 0
- Review effort level: Lite
We're testing this review assessment. Please use 👍 or 👎 to tell us if it's correct.
The engine is changing how it publishes per-value documentation for a schema's choice set, moving from an `x-enum-descriptions` map to a positional `x-mergify-enum` array that also carries a display title and a deprecation flag. Schema syncs land as direct pushes to main, so the docs repo cannot assume both sides move together. Introduce `readEnumChoices`, which tolerates every shape a synced schema can be in during that migration: values as a flat `enum`, a `const`, or the `anyOf` of branches a composed `Literal` produces, with the node — or any single branch of it — either inline or behind a `$ref`. Hoisting repeated enums into shared components is what removes the duplicated blocks from the published schema, and a reader that followed only the property node would silently render an empty table once that happens. Three things the shape change makes possible that the map could not, and which are handled explicitly because each fails silently: - Metadata can sit on the referring node as a `$ref` sibling rather than on the target, which is how pydantic publishes an annotation for a hoisted type. Both are consulted, nearest first. - A positional array can fall out of alignment with `enum` in a way a keyed map never could. A length mismatch is treated as unusable rather than shifting every description onto the wrong value. - The two shapes can coexist on one node mid-migration, so they are merged rather than treated as alternatives. Ref resolution uses the `jsonpointer` the sibling readers already use: hand-decoding each segment raises `URIError` on a pointer containing a stray `%`, which would break the never-throws contract this reader depends on to degrade instead of failing the build. The dequeue reason table moves onto it here; the batch status table is written against it from the start in a later commit. Rendered output is unchanged. Part of MRGFY-8330 Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Change-Id: Ie539de06bf3391eb4390333810cda6e8f131b1e6
`renderMarkdown` output goes straight into `dangerouslySetInnerHTML` in six tables, and it did not filter URL protocols: `remark-rehype` emits an `<a>` for any link target whatever its scheme, so a `javascript:` link in a synced description would have rendered as a live link. Raw HTML was never a way in — `remark-rehype` runs without `allowDangerousHtml`, so it is discarded before becoming a node — which makes URL filtering the whole of what `rehype-sanitize` adds here. It sits after `rehype-raw` so that if a caller ever does enable `allowDangerousHtml`, the embedded markup is parsed and then sanitized rather than passed through opaque. Every input today is first-party: descriptions generated by our own engine and delivered by our own sync bot. So this is defence in depth rather than a live exposure — but "the input is trustworthy" is a property of the six current callers, not of the function, and the output lands somewhere that makes the distinction expensive to get wrong later. The tests separate the two guarantees on purpose. Asserting all four cases together would have been misleading: three of them pass with the sanitizer removed, because they test the markdown pipeline discarding raw HTML rather than anything the sanitizer does. Only the URL-protocol cases fail if it goes. Output is unchanged across every description the two schemas publish. Part of MRGFY-8330 Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Change-Id: Ice1642f855d6698b65a034e398affbce16f822a6
The engine is renaming its documented-data-type flag from `x-has-data-type` to `x-mergify-has-data-type`, matching the namespacing already used for `x-mergify-enum`. An unprefixed `x-` key is a claim on a name nobody owns, which is how `x-enum-descriptions` ended up meaning a positional array of strings to openapi-generator and a map to us. Read both spellings. Schema syncs land as direct pushes to main, so the docs repo cannot assume the two sides move together: whichever order the repos merge in, a synced schema can carry either key, and a reader that knew only one would take the anchor gate offline without failing anything. The fallback can go once no synced schema publishes the old key. Only `isDataType` reads the flag directly — the anchor collector, both config tables and the build gate all go through it — so accepting both is one predicate, not a sweep. This lands before the schemas that carry the new key, so the gate never sees a marker it cannot read. Part of MRGFY-8330 Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Change-Id: I203218c96b6b12aa53cb7121722f0870a909598f
4455148 to
87b0bd3
Compare
40c537b to
979f038
Compare
87b0bd3 to
08912d8
Compare
The engine is renaming its documented-data-type flag from
x-has-data-typetox-mergify-has-data-type, matching the namespacingalready used for
x-mergify-enum. An unprefixedx-key is a claim on aname nobody owns, which is how
x-enum-descriptionsended up meaning apositional array of strings to openapi-generator and a map to us.
Read both spellings. Schema syncs land as direct pushes to main, so the
docs repo cannot assume the two sides move together: whichever order the
repos merge in, a synced schema can carry either key, and a reader that
knew only one would take the anchor gate offline without failing
anything. The fallback can go once no synced schema publishes the old
key.
Only
isDataTypereads the flag directly — the anchor collector, bothconfig tables and the build gate all go through it — so accepting both is
one predicate, not a sweep.
This lands before the schemas that carry the new key, so the gate never
sees a marker it cannot read.
Part of MRGFY-8330
Co-Authored-By: Claude Opus 5 (1M context) noreply@anthropic.com
Depends-On: #12304