Skip to content

async_api_spex-v0.2.0

Choose a tag to compare

@github-actions github-actions released this 16 Oct 05:25
· 106 commits to main since this release
29a89d4

Added

  • use AsyncApiSpex.Schema, fields: [...] derives a schema from an existing
    defstruct; every struct key becomes a property and fields: refines it
    with a type, required, and a description. title: and description:
    describe the schema.
  • use AsyncApiSpex.Channel declares a channel, the server it lives on, and
    its operation on the module that publishes to it or consumes from it.
  • use AsyncApiSpex.Spec implements spec/0 by assembling a document from
    channel modules, listed with channels: or discovered with otp_app:.
  • AsyncApiSpex.Plug.Viewer serves an HTML page that renders a document in
    the browser with the AsyncAPI React component (pinned to 3.2.1 on unpkg;
    :bundle_url and :stylesheet_url point it at a self-hosted copy). Mount it
    next to AsyncApiSpex.Plug.RenderSpec with path: set to that mount.
  • CI scaffolds a fresh mix new app that depends on nothing but this library
    and plug, decorates a producer and a consumer, and serves, validates, and
    writes the document, so the library is proven outside the repository it
    lives in.

Changed

  • use AsyncApiSpex.Schema without :schema or :fields now raises
    "requires exactly one of :schema or :fields".
  • AsyncApiSpex.validate/1 is stricter. A document with a component
    schema that holds a module that does not use AsyncApiSpex.Schema now fails
    validate/1 and mix async_api_spex.gen.

Fixed

  • A schema that references itself no longer makes the resolver loop forever.