A Plug that serves an AsyncAPI document with the application/asyncapi+json
content type.
Configure it with a module implementing AsyncApiSpex.Spec:
forward "/asyncapi.json", AsyncApiSpex.Plug.RenderSpec, spec: MyApp.AsyncApiOr send a document directly from your own route with send_spec/2.
Summary
Functions
Calls spec/0 on the configured module and sends the encoded document.
Returns the configured AsyncApiSpex.Spec module.
Sends document as a 200 response with the AsyncAPI content type and
halts the connection.
Functions
@spec call(Plug.Conn.t(), module()) :: Plug.Conn.t()
Calls spec/0 on the configured module and sends the encoded document.
Returns the configured AsyncApiSpex.Spec module.
Raises ArgumentError when the :spec option is missing.
@spec send_spec(Plug.Conn.t(), AsyncApiSpex.Document.t()) :: Plug.Conn.t()
Sends document as a 200 response with the AsyncAPI content type and
halts the connection.