XCribe v0.5.0 Xcribe.Config View Source

Handle Xcribe configurations.

You must configure Xcribe in your test config file config/test.exs as:

config: xcribe, [
  information_source: YourApp.YouModuleInformation,
  format: :swagger,
  output: "app_doc.json",
  env_var: "CI_ENV_FOR_DOC",
  json_library: Jason
]

:api_blueprint -> "api_doc.apib"
:swagger -> "openapi.json"

Available configurations:

  • :information_source - Module that implements Xcribe.Information with API information. It's required.
  • :output - The name of file output with generated configuration. Default value changes by the format, 'api_blueprint.apib' for Blueprint and 'app_doc.json' for swagger.
  • :format - Format to generate documentation, allowed :api_blueprint and :swagger. Default :api_blueprint.
  • :env_var - Environment variable name for active Xcribe documentation generator. Default is XCRIBE_ENV.
  • :json_library - The library to be used for json decode/encode (Jason and Poison are supported). The default is the same as Phoenix configuration.

Link to this section Summary

Functions

Return if Xcribe should document the specs.

Return the format for documentation.

Return configured json library.

Return the file name to output generated documentation.

Return the iformation module with API information (Xcribe.Information).

Link to this section Functions

Return if Xcribe should document the specs.

It's determined by an env var XCRIBE_ENV. Don't matter the var content if it's defined Xcribe will generate documentation.

The env var name can changed by configuration:

config :xcribe, [
  env_var: "CUSTOM_ENV_NAME"
]

Return the format for documentation.

Default is :api_blueprint. If an invalid format is given an Xcribe.UnknownFormat exception will raise.

To configure the documentation format:

config :xcribe, [
  format: :swagger
]

Return configured json library.

If no custom lib was configured the Phoenix configuration will be used.

To configure:

config :xcribe, [
  json_library: Jason
]

Return the file name to output generated documentation.

If no config was given the default names are api_doc.apib for Blueprint format and openapi.json for Swagger format.

To configure output name:

config :xcribe, [
  output: "custom_name.json"
]
Link to this function

xcribe_information_source()

View Source

Return the iformation module with API information (Xcribe.Information).

If information source is not given an Xcribe.MissingInformationSource exception will raise.

To configure the source:

config :xcribe, [
  information_source: YourApp.YouModuleInformation
]