Skip to content

Code snippets

Five languages per operation, derived from the spec.

Every generated endpoint page carries request snippets in five languages, derived from the OpenAPI document itself.

json
{
"snippets": {
"languages": ["curl", "python-requests", "go-nethttp"],
"default": "python-requests"
}
}
languagesstring[]default: all five

Which snippets render. Choose from curl, fetch, python-requests, python-httpx, go-nethttp.

defaultstringdefault: curl

Which one starts selected. Must be a member of languages when both are set.

Omit the block entirely and all five render with curl selected.

Reed builds a request per operation from the spec — servers, path, query, header and cookie parameters, security schemes, and the request-body example — and renders that one request in each language. The snippets are therefore consistent with each other by construction: they are five renderings of one derived request, not five hand-written examples that can drift apart.

An operation that already carries x-codeSamples keeps them. Reed never overwrites an author-written sample, and injects its own into a derived copy of the spec rather than the file on disk.

Use this when an operation needs a snippet that a mechanical derivation cannot produce — one that shows pagination, or a realistic payload, or a required call ordering.

curl is the universal fallback. fetch covers browser and Node JavaScript. python-requests and python-httpx cover Python’s two common clients. go-nethttp covers Go’s standard library.

This is a fixed set, not an extensible one. If your users’ language is not here, the honest answer is that Reed does not generate it — write the sample yourself as x-codeSamples and it will be used verbatim.

Every snippet calls the HTTP API directly. None of them imports a client library, because Reed does not generate one. A snippet that reads npm install @acme/sdk for a package nobody published would be documentation of something that does not exist.