APIDoc v0.1.3 APIDoc.APIDocumenter View Source

API Documenter.

Documents the main entry of the API.

The following annotations can be set:

  • @api (string) name of the API.
  • @vsn (string) version of the API.
  • @moduledoc (string) API description. Supports markdown.
  • @contact (string) contact info.

The following macros can be used for documenting:

Link to this section Summary

Functions

API Documenter.

Add schema to documentation.

Add security scheme to documentation.

Add server to documentation.

Link to this section Functions

Link to this macro

__using__(opts \\ []) View Source (macro)

API Documenter.

Documents the main entry of the API.

The following annotations can be set:

  • @api (string) name of the API.
  • @vsn (string) version of the API.
  • @moduledoc (string) API description. Supports markdown.
  • @contact (string) contact info.

The following macros can be used for documenting:

Link to this macro

schema(name, type, opts \\ []) View Source (macro)
schema(atom(), APIDoc.Doc.Schema.type(), Keyword.t()) :: term()

Add schema to documentation.

The name and type are always required. For additional optional fields see: APIDoc.Doc.Schema.

Examples

Just name and type:

schema Name, :string
schema Age, :integer

Additional options:

schema Name, :string,
  example: "Bob"

schema Age, :integer,
  format: :int32,
  example: 34,
  minimum: 1,
  maximum: 150
Link to this macro

security(id, name, type, location, description \\ nil) View Source (macro)

Add security scheme to documentation.

Link to this macro

server(url, description \\ nil) View Source (macro)
server(String.t(), String.t() | nil) :: term()

Add server to documentation.

Examples

Only url:

server "https://prod.example.com"
server "https://stage.example.com"

Url and description:

server "https://prod.example.com", "Production example server"
server "https://stage.example.com", "Staging example server"