json-schema-0.7.0.0: Types and type classes for defining JSON schemas.

Safe HaskellNone
LanguageHaskell98

Data.JSON.Schema.Combinators

Description

Combinators for creating JSON schemas.

Synopsis

Documentation

type SchemaC = Schema -> Schema Source

A schema combinator.

(<|>) :: Schema -> Schema -> Schema infixl 3 Source

Optionality operator for schemas.

(<+>) :: Schema -> Schema -> Schema infixl 4 Source

Tupling.

merge :: Schema -> Schema -> Schema Source

If passed two objects, merges the fields. Otherwise creates a tuple.

field :: Text -> Bool -> Schema -> Schema Source

Create an object with a single field.

value :: Schema Source

An unbounded string.

number :: Schema Source

An unbounded number.

array :: Schema -> Schema Source

An unbounded array with non-unique values.

addField :: Text -> Bool -> Schema -> SchemaC Source

Add a field to an object, or tuple if passed a non-object.

addFields :: [(Text, Bool, Schema)] -> SchemaC Source

Add multiple fields to an object, or tuple if passed a non-object.

empty :: Schema Source

An empty object.

enum :: [Value] -> Schema Source

A choice between constant values.

nullable :: Schema -> Schema Source

The provided schema or null.