spectra_json_schema (spectra v0.11.1)

View Source

Summary

Functions

Generates a JSON Schema object for Type using Config for codec and cache settings.

Types

json_schema()

-type json_schema() ::
          #{'$schema' => binary(),
            title => binary(),
            description => binary(),
            deprecated => boolean(),
            examples => [json:encode_value()],
            type => binary(),
            format => binary(),
            minLength => non_neg_integer(),
            maxLength => non_neg_integer(),
            pattern => binary(),
            minimum => integer(),
            maximum => integer(),
            enum => [null | binary() | integer() | boolean() | []],
            items => json_schema_object(),
            minItems => pos_integer(),
            oneOf => [json_schema_object()],
            properties => #{binary() => json_schema_object()},
            required => [binary()],
            additionalProperties => boolean()}.

json_schema_object()

-type json_schema_object() ::
          #{type => binary(),
            format => binary(),
            minLength => non_neg_integer(),
            maxLength => non_neg_integer(),
            pattern => binary(),
            minimum => integer(),
            maximum => integer(),
            enum => [null | binary() | integer() | boolean() | []],
            items => json_schema_object(),
            minItems => pos_integer(),
            oneOf => [json_schema_object()],
            properties => #{binary() => json_schema_object()},
            required => [binary()],
            additionalProperties => boolean(),
            title => binary(),
            description => binary(),
            deprecated => boolean(),
            examples => [json:encode_value()]}.

Functions

add_schema_version(Schema)

-spec add_schema_version(json_schema_object()) -> json_schema().

to_schema(TypeInfo, Type, Config)

Generates a JSON Schema object for Type using Config for codec and cache settings.