ndto_parser behaviour (ndto v0.3.1)

View Source
An ndto interface and behaviour for schema parsers.

Summary

Types

t/0
A parser is a module that implements the ndto_parser behaviour.

Callbacks

Parses a specification into a list of ndto:schema() values.

Functions

Parses a schema specification into a ndto:schema() using the given parser.

Types

ctx/0

-type ctx() :: term().

spec/0

-type spec() :: term().

t/0

-opaque t()
A parser is a module that implements the ndto_parser behaviour.

Callbacks

parse/2

-callback parse(SpecPath, Opts) -> Result
                   when
                       SpecPath :: file:filename_all(),
                       Opts :: map(),
                       Result :: {ok, Schemas} | {error, Reason},
                       Schemas :: [{ndto:name(), ndto:schema()}],
                       Reason :: term().
Parses a specification into a list of ndto:schema() values.

Functions

parse(Parser, SpecPath)

-spec parse(Parser, SpecPath) -> Result
               when
                   Parser :: t(),
                   SpecPath :: file:filename_all(),
                   Result :: {ok, Schemas} | {error, Reason},
                   Schemas :: [{ndto:name(), ndto:schema()}],
                   Reason :: term().

Equivalent to parse(Parser, SpecPath, #{}).

parse(Parser, SpecPath, Opts)

-spec parse(Parser, SpecPath, Opts) -> Result
               when
                   Parser :: t(),
                   SpecPath :: file:filename_all(),
                   Opts :: map(),
                   Result :: {ok, Schemas} | {error, Reason},
                   Schemas :: [{ndto:name(), ndto:schema()}],
                   Reason :: term().
Parses a schema specification into a ndto:schema() using the given parser.