spectra_json_schema (spectra v0.11.1)
View SourceSummary
Functions
Generates a JSON Schema object for Type using Config for codec and cache settings.
Types
-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()}.
-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
-spec add_schema_version(json_schema_object()) -> json_schema().
-spec to_schema(spectra:type_info(), spectra:sp_type(), spectra:sp_config()) -> json_schema_object().
Generates a JSON Schema object for Type using Config for codec and cache settings.