fix(docs): show accepted values for API parameters typed by a shared enum - #12299
Conversation
|
This pull request is part of a Mergify stack:
|
Merge Protections🟢 All 6 merge protections satisfied — ready to merge. Show 6 satisfied protections🟢 🤖 Continuous Integration
🟢 👀 Review Requirements
🟢 Enforce conventional commitMake sure that we follow https://www.conventionalcommits.org/en/v1.0.0/
🟢 🔎 Reviews
🟢 📕 PR description
🟢 🚦 Auto-queueWhen all merge protections are satisfied, this pull request will be queued automatically. |
80eb05a to
85e5029
Compare
85e5029 to
4e7d3df
Compare
|
A predecessor in this stack was just merged, but I couldn't auto-rebase this PR: there's a conflict that needs manual resolution. Conflict in: Resolve with |
Revision history
|
There was a problem hiding this comment.
Pull request overview
Fixes docs rendering regressions caused by OpenAPI enum deduplication (inline enum → $ref to shared components) by correctly resolving referenced enums when rendering API parameter types, and by centralizing enum-choice extraction/metadata handling across both the OpenAPI spec and the configuration schema.
Changes:
- Add a resilient
readEnumChoices()/$refresolver to read enum values + per-value docs across multiple engine-published shapes. - Update API reference type labeling to expand
$ref’d enums (so accepted values remain visible for parameters). - Document “Batch Status” as a data type and extend the build-time anchor gate to validate both synced schemas (config + OpenAPI); harden markdown-to-HTML rendering with sanitization.
Reviewed changes
Copilot reviewed 16 out of 17 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| src/util/enumChoices.ts | Adds enum choice reader that resolves $ref, flattens unions, and merges legacy/new per-value documentation shapes. |
| src/util/enumChoices.test.ts | Pins expected behavior across synthetic cases and the real synced schemas to prevent silent regressions. |
| src/util/dataType.ts | Accepts both x-mergify-has-data-type and legacy x-has-data-type markers during migration. |
| src/util/dataType.test.ts | Extends tests for both marker spellings and validates anchors against both synced schemas. |
| src/content/docs/merge-queue/monitoring.mdx | Cross-references the new Batch Status data type from monitoring docs. |
| src/content/docs/merge-queue/batches.mdx | Cross-references the new Batch Status data type from batch failure resolution docs. |
| src/content/docs/configuration/data-types.mdx | Adds “Batch Status” section and renders its codes table from the OpenAPI spec. |
| src/components/Tables/utils.ts | Sanitizes rendered markdown before injecting into DOM via dangerouslySetInnerHTML. |
| src/components/Tables/utils.test.ts | Adds security-focused tests for protocol filtering and raw HTML handling. |
| src/components/Tables/QueueDequeueReasons.tsx | Switches to readEnumChoices() for values + documentation rather than custom enum-shape parsing. |
| src/components/Tables/BatchStatusCodes.tsx | New table component that renders batch status codes/descriptions from the OpenAPI schema. |
| src/components/ApiReference/openapi.ts | Resolves $ref’d enums for parameter type labels instead of showing the component name. |
| public/mergify-configuration-schema.json | Synced schema update: emits x-mergify-enum positional metadata for dequeue reasons and reshapes enum values. |
| public/api-schemas.json | Synced spec update: hoists repeated enums into shared components and adds Batch Status metadata. |
| package.json | Adds rehype-sanitize dependency. |
| pnpm-lock.yaml | Locks rehype-sanitize and transitive deps. |
| integrations/validate-data-type-anchors.ts | Extends anchor validation gate to run against both synced schemas. |
Files not reviewed (1)
- pnpm-lock.yaml: Generated file
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
c73d075 to
4c75840
Compare
4e7d3df to
7b64b97
Compare
4c75840 to
f86e05f
Compare
7b64b97 to
c3af39d
Compare
…enum Deduplicating repeated enums in the OpenAPI spec hoists them into shared components, so a query parameter's schema becomes a `$ref` instead of an inline `enum`. `getTypeLabel` returned the component name for any `$ref`, which is right for an object — the schema tree below expands it — but wrong for an enum: parameters are rendered from that label alone, with no tree underneath and no `enum` among their constraints. Fifteen public parameters were affected. `/api/activity-log`'s `event_type` listed all 44 accepted values and would have shown `EventType[]`; `source` on the quarantines endpoint would have shown `QuarantineSource` instead of `"manual" | "auto"`. The components themselves are not rendered anywhere on the site, so the values would have been published nowhere at all. Resolve the reference when it targets an enum and keep the name otherwise. Part of MRGFY-8330 Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Change-Id: Ic546133c44ed82ddc0f57c2269b64f6725247e27
c3af39d to
2be5cc3
Compare
Merge Queue Status
This pull request spent 14 hours 35 minutes 17 seconds in the queue, including 2 minutes 16 seconds running CI. Required conditions to merge
|
Deduplicating repeated enums in the OpenAPI spec hoists them into shared
components, so a query parameter's schema becomes a
$refinstead of aninline
enum.getTypeLabelreturned the component name for any$ref,which is right for an object — the schema tree below expands it — but
wrong for an enum: parameters are rendered from that label alone, with no
tree underneath and no
enumamong their constraints.Fifteen public parameters were affected.
/api/activity-log'sevent_typelisted all 44 accepted values and would have shownEventType[];sourceon the quarantines endpoint would have shownQuarantineSourceinstead of"manual" | "auto". The componentsthemselves are not rendered anywhere on the site, so the values would
have been published nowhere at all.
Resolve the reference when it targets an enum and keep the name
otherwise.
Part of MRGFY-8330
Co-Authored-By: Claude Opus 5 (1M context) noreply@anthropic.com