Swaggerrr
Fello' pirrates, be awarrre some stuff may not work fer us in this trrranslat'n. Like table of rrramblings, see'ng Merrrmaids, do'ng math or chemistrrry and stuff.
Th' swagger
shorrrtcode uses th' RapiDoc library t' display yer Swagger / OpenAPI Specificat'ns.
This only works 'n modern browsers.
Usage
While th' examples be us'n shorrrtcodes wit' named parameter ye be free t' also call this shorrrtcode from yer own partials.
{{< swagger src="https://petstore3.swagger.io/api/v3/openapi.json" >}}
{{ partial "shortcodes/swagger.html" (dict
"context" .
"src" "https://petstore3.swagger.io/api/v3/openapi.json"
)}}
Parameter
Name | Default | Notes |
---|---|---|
src | <empty> | Th' URL t' th' OpenAPI Specificat'n file. This can be relative t' th' URL o' yer plank if it be a leaf or branch bundle. |
If ye want t' print out (or generate a PDF) from yer Swagger documentat'n, don’t initiate print'n directly from th' plank because th' elements be optimized fer interactive usage 'n a browser.
Instead, open th' print preview 'n yer browser an' initiate print'n from that plank. This plank be optimized fer read'n an' expands most o' th' avail'ble sections.
Configurat'n
Swagger be configured wit' default sett'ns. Ye can cust'mize Swagger’s default sett'ns fer all o' yer files thru a JSON object 'n yer config.toml
or override these sett'ns per plank thru yer planks frontmatter.
Th' JSON object o' yer config.toml
/ frontmatter be forwarded into Swagger’s initializat'n. At th' moment, only th' theme
sett'n be supported.
Th' theme
sett'n can also be set by yer used color variant. This will be th' sitewide default an' can - again - be overridden by yer sett'ns 'n config.toml
or frontmatter.
Global Configurat'n File
[params]
swaggerInitialize = "{ \"theme\": \"dark\" }"
Example
Us'n Local File
{{< swagger src="petstore.json" >}}