docs: framework guides section + document x-nav-order - #24
Merged
Conversation
Adds a Guides tab to the site with a shared six-step spine (emit the document, tags, sidebar order, events, code samples, gotchas) so the frameworks read comparably: - NestJS (@nestjs/swagger + @APIextension) - FastAPI (openapi_extra, native 3.1 webhooks) - Spring Boot (springdoc + swagger-core @extension) - Hono + Zod OpenAPI (extensions inline in createRoute) Documents x-nav-order on /openapi, leading with the two cases that actually motivate it: operations sharing a path item can't be reordered at all (verbs are read in a fixed order), and generated documents lose hand-sorting on every regeneration. Also fixed while in these files: - four /openapi toc ids pointed at anchors that don't exist, so those sidebar links scrolled nowhere; same for a /versions#api-reference link - the @APIextension note claimed an object value is required; it isn't, only the x- key prefix is enforced, and repeated calls merge - build-search.mjs walked only the first content tab, dropping a second tab's pages into llms.txt's ungrouped "More" bucket
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.
What & why
Adds a Guides tab to
site/with framework-specific walkthroughs, and documents thex-nav-orderextension that landed in #21.Every guide follows the same six-step spine, so a reader can skim across frameworks and a new one slots in without inventing a shape:
api/openapi.jsonas a build stepstore/orderstags)x-nav-orderx-eventsx-codeSamples/guides/guides/nestjs@nestjs/swagger,@ApiTags,@ApiExtension, snapshottingcreateDocument()/guides/fastapiopenapi_extra, native 3.1webhooks, dumpingapp.openapi()/guides/spring-boot@Extension/@ExtensionProperty, theparseValuetrap/guides/hono-zod-openapicreateRoute,getOpenAPI31Document()/openapigains a Sidebar order section forx-nav-order, with a### Why not just reorder the document?subsection. That framing matters — "reorder the spec" is the obvious objection, and it doesn't hold for the two cases people actually hit:normalizereads verbs off a fixedMETHODSarray, so two operations sharing a path item always come out GET before POST regardless of document order. Putting Create account above List accounts is impossible without the extension.Every framework API used here was checked against the actual source rather than from memory —
@ApiExtensionaccepts any value and merges across repeated calls,@ExtensionProperty.parseValue()defaults tofalse(sovalue = "1"emits a string that Markline'stypeof === "number"check silently drops), andzod-to-openapispreads unknown route-config keys straight onto the operation.Also fixed, while in these files
/openapiTOC ids pointed at anchors that don't exist (playground→the-playground,events→events-webhooks,overlays→mdx-overlays,ai-and-actions→ai-page-actions), so those sidebar links scrolled nowhere. Same for a/versions#api-referencelink.@ApiExtensionnote in the events section claimed an object value is required. It isn't — only thex-key prefix is enforced, and repeated calls merge, which is what letsx-eventsandx-nav-ordersit on the same handler.build-search.mjswalked only the first non-OpenAPI tab when groupingllms.txt, so a second content tab's pages fell into the ungrouped "More" bucket. It now walks every content tab and qualifies group titles when there's more than one (Guides · Python). This also improves any consumer site with more than one docs tab.Checklist
npm run typecheckpassesnpm run buildpasses — 30/30 static pagesAlso verified: all 6 pages render every section, all 16 internal links and anchors resolve, and the guides reach the sitemap,
llms.txtand the Pagefind index.