NimbleOptions.docs
You're seeing just the function
docs
, go back to NimbleOptions module for more information.
Specs
Returns documentation for the given schema.
You can use this to inject documentation in your docstrings. For example, say you have your schema in a module attribute:
@options_schema [...]
With this, you can use docs/1
to inject documentation:
@doc "Supported options:\n#{NimbleOptions.docs(@options_schema)}"
Options
:nest_level
- an integer deciding the "nest level" of the generated docs. This is useful when, for example, you usedocs/2
inside the:doc
option of another schema. For example, if you have the following nested schema:nested_schema = [ allowed_messages: [type: :pos_integer, doc: "Allowed messages."], interval: [type: :pos_integer, doc: "Interval."] ]
then you can document it inside another schema with its nesting level increased:
schema = [ producer: [ type: {:or, [:string, keyword_list: nested_schema]}, doc: "Either a string or a keyword list with the following keys:\n\n" <> NimbleOptions.docs(nested_schema, nest_level: 1) ], other_key: [type: :string] ]