Repository navigation
feat: open union branches in place and order operations with x-nimbus-order - #309
Draft
MohamedH1998 wants to merge 5 commits into
Draft
MohamedH1998 wants to merge 5 commits into
MohamedH1998 wants to merge 5 commits into
Conversation
🚀 Deploying Preview to Cloudflare 🚀Preview URL: https://feat-api-operation-order.nimbus-docs.com (commit f67b943)This URL reflects your latest Preview deploymentPreview Deployments by commit
|
commit: |
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.
Summary
API pages stop hiding things. Union branches open where they are declared, field nesting follows the spec instead of stopping at six levels, and a spec can order a section's operations. A site that did nothing sees the same labels, URLs and Markdown twins as before; Stripe's public spec measures within noise of
main.Decisions for the reviewer
x-nimbus-orderis independent and could ship alone. Kept together here to ship less.labelof a union branch stays the schema key. The schema'stitleis a new sibling field, and the starter showstitle ?? label. Makinglabelthe title would have changed Markdown twins and mapping labels for every site with titled schemas, so it was rejected. Consequence: the HTML shows the title and the Markdown twin shows the key. Say if you want the twin to print the title too.Changes
Spec authors:
x-nimbus-orderSorts an operation within its section. Operations without it keep spec order after the ordered ones; sections keep their own order. No config.
Section page, sidebar and home index all read: list, get, create, delete.
Page data:
ApiVariantfor anyone with their own API componentsA union branch used to be a label and, when a schema page existed, a link. It now opens.
Before:
{ "label": "dns-records_dns-record-without-data" }After, for a branch that is itself a union:
{ "label": "dns-records_dns-record-without-data", "name": "dns-records_dns-record-without-data", "title": "Content records", "union": { "kind": "oneOf", "variants": [ { "label": "dns-records_ARecord", "name": "dns-records_ARecord", "title": "A Record", "fields": [ … ] }, { "label": "dns-records_AAAARecord", "name": "dns-records_AAAARecord", "title": "AAAA Record", "fields": [ … ] } ] } }After, for an inline object branch, minted at
<base>.<position>:{ "label": "object", "fields": [ { "coordinate": "create.source.2.iban", "name": "iban", "type": "string", "required": true } ] }The type, for reference:
A named branch's property preview opens one level: a union among its properties shows branches without their fields, so a shared-schema graph stays bounded.
Depth: no limit, one backstop
Before, nesting stopped at six levels and an inline branch at one. Now the walk follows the spec until a schema repeats on the current path. A 25,000-node ceiling per field list is the backstop for a wide, deep, shared graph; when it cuts, the build warns:
No measured spec reaches it. Cloudflare's largest page is under 1,000 fields.
Starter:
ApiUnionExplorer.astroOpens a nested union, shows the schema's title in rows and the field tooltip, and anchors an inline branch's fields. Sites that copied the starter can take this diff or keep their copy; nothing breaks without it.
Markdown twins
Nested branches print as a nested list and an inline branch prints its fields. A named branch stays a label or a link, as before, so twin sizes do not follow
schemaPages.Before:
After:
An inline branch, which has no page anywhere, prints its fields:
Stranger test on the preview release
A fresh scaffold on
create-nimbus-docs@309andnimbus-docs@309with a spec exercising every claim: nested unions, an inline branch, titles, nine levels, a self-reference, a discriminator,x-nimbus-order, bothschemaPagessettings. Every rendering claim held. Fixed from its findings: inline-branch field coordinates printed in the twin now resolve (anchored, indexed, citable); the field tooltip used the key while the row used the title; the docs sentence about unions among an inline branch's properties was wrong; the feature now has its own "Unions" section inroutes.mdxnaming the position coordinates, the stop rule, the ceiling and its code.An upgrade test on the same preview: an existing
0.19.1site (hand-written union spec plus Stripe, 613 pages, schema pages off, starter untouched) with only the framework upgraded. No regressions: the old explorer renders the new data without errors or blank regions, public types are additive only, every Markdown twin change is one the changeset announces, nofield-walk-ceilingwarning fired. It also found that the preview's coordinate registry lacked inline-branch coordinates; the stranger fix above covers it, and on Stripe at this head every twin coordinate (219,370) is a target.A second stranger pass on the re-cut preview: every documented claim held and the four fixes above passed. It found one rule applied inconsistently: a named schema's content belongs to its own page, yet an inline branch nested inside a named branch's preview was anchored on the operation page (duplicate
ids when the schema appeared twice) and claimed by the citation walk. Fixed: the explorer takes ananchoredprop and passes it down, the citation walk stops at a named branch, and the Markdown twin keeps a named branch as a label even when it is itself a union, so page anchors, the coordinate manifest and the twin agree. Docs say so in one sentence, and that equalx-nimbus-ordervalues keep path order.A third pass on the re-cut preview, pinned to the commit: ship. No duplicate
idon any page, page anchors, manifest and twins agree for schema pages on and off, the same named union twice on one page is clean, dev and build output identical. It corrected two docs claims (a named branch's preview opens nested objects, not "one level"; positions renumber when a branch is inserted) and surfaced two behaviours that predate this PR, listed below.Follow-ups, not in this PR:
group: $ref Group) shows the branches but never the schema's name or link, and its inline branches are minted under the property path as well as under the schema. Same onmainfor any$refproperty; the union case makes it visible.main; aligning them needs a measurement with schema pages on.object or object.x-nimbus-order, or one on a tag, is ignored silently; one lint note for an unknown or invalidx-nimbus-*value would cover both.any of/one of, so a tooltip readsL1 leaf or any ofand the twin prints the label above the same words.llms.txtlists operations by route, not by section order, and omits a section's operations under other prefixes (ticket 154 territory).×2, so the reader cannot tell which lists were cut.…@309from pkg.pr.new served a stale commit from pnpm's cache on one machine; preview instructions should pin the sha.main(page data 1,257 MB → 1,297 MB), while Astro's HTML render grew because named-branch fields now inline at every depth on 530 pages (HTML +0.56%). Worth a proper render-phase measurement before the next release.nimbus-docs outdatedon a release-scaffolded site running a preview package compares the starter with the last published templates tag and reports "up to date", so a preview user is not told the explorer is behind. It self-corrects once the templates tag ships; a preview-aware note is a small CLI follow-up.objectand no marker or link back to the schema.string/objectand drop enum values.create-nimbus-docsREADME says every version downloadstemplates-v<version>; preview releases bundle templates instead.main; the citation index reports them as unpublished.Validation
pnpm --filter nimbus-docs typecheck; full suite 3,235 pass. One failure is the dev-server catalog test, which times out under full-suite load and passes in isolation.x-nimbus-ordervalues keep path order.main, page data 1.30 GB vs 1.26 GB, Markdown 66.7 MB vs 66.1 MB, largest page 3.4 MB vs 3.3 MB.pnpm --filter nimbus-starter-source buildandpnpm templates:checkpass. The consuming site's end-to-end suite passes against the packed build.