View Source ndto_parser behaviour (ndto v0.3.1)

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

-type ctx() :: term().
-type spec() :: term().
-opaque t()
A parser is a module that implements the ndto_parser behaviour.

Callbacks

-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

-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, #{}).

Link to this function

parse(Parser, SpecPath, Opts)

View Source
-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.