Repository navigation
Conversation
✅ Deploy Preview for hugo-hextra ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
- Extract the CDN/mirror/local asset loader into utils/vendor-assets.html and use it for Swagger UI and the asciinema player - Fail the build when the OpenAPI description cannot be resolved or when a non-remote base leaves no script to load, warn when no stylesheet - Validate filter and tryItOutEnabled as booleans - Label the Swagger UI container as a region and demote the nested <main> rendered by Swagger UI so the page keeps one main landmark - Disconnect MutationObservers on pagehide - Pin the asciinema player CDN to its current major version
This branch was successfully 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.
Supersedes #833.
Summary
Adds an
openapishortcode that renders an OpenAPI description (JSON or YAML) as an interactive API reference with Swagger UI:{{< openapi "openapi/example.yaml" >}} {{< openapi src="https://petstore3.swagger.io/api/v3/openapi.json" docExpansion="none" filter=true >}}It builds on the implementation we use for our own API reference. Unlike the page layout of #833, it keeps the Hextra navigation and can sit next to other content. The description can be a local file (page resource, asset or
static/) or a URL, which covers the request for local files in #833. Six Swagger UI options are exposed and validated.Swagger UI only loads on pages using the shortcode. Like asciinema and gallery, it is fetched from jsDelivr (
swagger-ui-dist@5) at build time and published with SRI, andparams.openapiaccepts a mirror or local assets.Dark mode
Swagger UI 5.31 added a native dark theme, enabled by a
dark-modeclass on the root element. The loader keeps it in step with the Hextra theme, including later toggles, so no dark stylesheet has to be maintained here.assets/css/components/openapi.cssonly adjusts it: the page background shows through instead of the Swagger UI blue-gray, and the fixes below.Accessibility
select-name, critical). Per-operation selects only appear after "Try it out", so they are named as they appearThe request body
textareashown after "Try it out" has no label either. It only appears after an interaction, so it is left to Swagger UI.Test plan
static/file and remote URL descriptions resolve, and local files are publishedtests/accessibility.spec.tson the 49 English pages: no violationsnpm run test:build, with a newtests/openapi.spec.tsthat uses local assets and needs no networkfa,jaandzh-cn