Skip to content

TypeScript API / laikacms/json-api / openApiDocumentToYaml

Function: openApiDocumentToYaml() ​

ts
function openApiDocumentToYaml(doc): string;

Serialize an OpenAPI document to YAML.

A hand-rolled block-style writer rather than a js-yaml dependency — same minimal-dependencies reasoning as the types above. The document is plain JSON data (no cycles, no non-JSON values), which keeps the serializer small: every string is emitted as a JSON double-quoted scalar (a JSON string is always a valid YAML double-quoted scalar), so YAML's quoting rules never come up.

Parameters ​

ParameterType
docOpenApiDocument

Returns ​

string

Released under the MIT License.