json_schema v0.3.0 JsonSchema View Source
JSON Schema
Status
A JSON schema parser written in Elixir.
JsonSchema is an Elixir library that parses JSON schema documents into Elixir structs and allows inspection and manipulation of the parsed documents. This library is meant as a basis for writing other libraries or tools that need to use JSON schema documents. For example, a JSON schema validator that validates a JSON object according to a JSON schema specification, or a code generator that generates a data model and accompanying JSON decoders/encoders based on the JSON schema specification of an API -- the project JSON Schema to Elm is an example of such a tool.
Project Setup
To use JsonSchema with your projects, edit your mix.exs
file and add it as a
dependency.
defp deps do
[{:json_schema, "~> 0.3"}]
end
Link to this section Summary
Functions
Parses a single JSON Schema documents into a SchemaResult
.
Parses one or more JSON Schema documents into a SchemaResult
.
Parses one or more JSON schema files into a SchemaResult
containing a
dictionary of parsed schemas represented as Elixir structs and two lists of
any warnings or errors encountered while parsing the JSON schema documents.
Resolves a JSON schema Types.typeIdentifier
, when given a SchemaDefinition
and a Types.schemaDictionary
.
Link to this section Functions
parse_schema_document(schema_path, schema_document)
View Sourceparse_schema_document(Path.t(), String.t()) :: JsonSchema.Parser.SchemaResult.t()
Parses a single JSON Schema documents into a SchemaResult
.
parse_schema_documents(schema_path_document_pairs)
View Sourceparse_schema_documents([{Path.t(), String.t()}]) :: JsonSchema.Parser.SchemaResult.t()
Parses one or more JSON Schema documents into a SchemaResult
.
parse_schema_files(schema_paths)
View Sourceparse_schema_files([Path.t()]) :: JsonSchema.Parser.SchemaResult.t()
Parses one or more JSON schema files into a SchemaResult
containing a
dictionary of parsed schemas represented as Elixir structs and two lists of
any warnings or errors encountered while parsing the JSON schema documents.
resolve_type(identifier, parent, schema_def, schema_dict)
View Sourceresolve_type( JsonSchema.Types.typeIdentifier(), JsonSchema.Types.typeIdentifier(), JsonSchema.Types.SchemaDefinition.t(), JsonSchema.Types.schemaDictionary() ) :: {:ok, {JsonSchema.Types.typeDefinition(), JsonSchema.Types.SchemaDefinition.t()}} | {:error, JsonSchema.Parser.ParserError.t()}
Resolves a JSON schema Types.typeIdentifier
, when given a SchemaDefinition
and a Types.schemaDictionary
.