Checks a resolved AsyncAPI document against the rules this library relies on.
validate/1 resolves the document first, then returns :ok or
{:error, messages}. Every message names the JSON path it concerns. Rules
checked:
asyncapiis"3.0.0"andinfohas a non-emptytitleandversion.- Every server has a non-empty
hostandprotocol. - Server, channel, operation, channel message, and parameter ids match
~r/\A[A-Za-z0-9_-]+\z/; component schemas and messages match~r/\A[A-Za-z0-9_.-]+\z/. - A channel's
{name}address expressions equal its parameter keys; aniladdress has no parameters. - Every channel server reference resolves.
- Every operation action is
sendorreceive, its channel reference resolves, and its message references are messages of that channel. - Every component schema and message reference resolves.
- Every extension key starts with
x-.
Summary
Functions
Validates a document, resolving it first.
Functions
@spec validate(AsyncApiSpex.Document.t()) :: :ok | {:error, [String.t()]}
Validates a document, resolving it first.