AsyncApiSpex.Encoder (async_api_spex v0.1.0)

Copy Markdown View Source

Converts an AsyncApiSpex.Document into a JSON-encodable map.

The document is resolved first. Struct field names become lowerCamel JSON keys, nil, empty maps, and empty lists are omitted, extensions are merged into their owning object, and an operation's action is written as a string. Plain maps and lists — AsyncAPI Schema Objects and bindings — are emitted with their keys unchanged apart from atoms becoming strings.

Summary

Functions

Encodes a document as a JSON string.

Encodes a document as a map. Calls AsyncApiSpex.resolve/1 first.

Functions

encode!(doc)

@spec encode!(AsyncApiSpex.Document.t()) :: binary()

Encodes a document as a JSON string.

to_map(doc)

@spec to_map(AsyncApiSpex.Document.t()) :: map()

Encodes a document as a map. Calls AsyncApiSpex.resolve/1 first.