1602/json-schema/1.0.0

NOTE: this package is not compatible with Elm 0.19.1

Json.Schema

This library provides bunch of utility methods to work with JSON values using schemas defined in JSON Schema format.

Currently it allows to construct schemata (draft-6), validate values and generate random values based on schema (very experimental feature). It supports local references, but doesn't support remote references.

Decode schema

Use fromValue or fromString methods if you receive schema from external source. If you want to construct schema from elm code you might want to use Json.Schema.Builder, or low-level API using definitions from Json.Schema.Definitions

fromValue : Value -> Result String Schema

Construct JSON Schema from JSON value

fromString : String -> Result String Schema

Construct JSON Schema from string

Validation

validateValue : Value -> Schema -> Result String Bool

Validate value against JSON Schema. Returns True Result if case if object is valid, or string error otherwise.