packages feed

hydra-ext-0.17.4: src/main/haskell/Hydra/Json/Schema/Model.hs

-- Note: this is an automatically generated file. Do not edit.

-- | A model for JSON Schema. Based on https://cswr.github.io/JsonSchema/spec/grammar

module Hydra.Json.Schema.Model where

import qualified Hydra.Core as Core
import qualified Hydra.Json.Model as Model
import Prelude hiding  (Enum, Ordering, decodeFloat, encodeFloat, fail, map, pure, sum)
import qualified Data.Scientific as Sci
import qualified Data.Map as M

-- | Whether additional array items beyond those explicitly typed are permitted, and if so, their schema
data AdditionalItems =
  AdditionalItemsAny Bool |
  AdditionalItemsSchema Schema
  deriving (Eq, Ord, Read, Show)

_AdditionalItems = Core.Name "hydra.json.schema.model.AdditionalItems"

_AdditionalItems_any = Core.Name "any"

_AdditionalItems_schema = Core.Name "schema"

-- | A restriction on array-typed values: items, additionalItems, minItems, maxItems, or uniqueItems
data ArrayRestriction =
  ArrayRestrictionItems Items |
  ArrayRestrictionAdditionalItems AdditionalItems |
  ArrayRestrictionMinItems Int |
  ArrayRestrictionMaxItems Int |
  ArrayRestrictionUniqueItems Bool
  deriving (Eq, Ord, Read, Show)

_ArrayRestriction = Core.Name "hydra.json.schema.model.ArrayRestriction"

_ArrayRestriction_items = Core.Name "items"

_ArrayRestriction_additionalItems = Core.Name "additionalItems"

_ArrayRestriction_minItems = Core.Name "minItems"

_ArrayRestriction_maxItems = Core.Name "maxItems"

_ArrayRestriction_uniqueItems = Core.Name "uniqueItems"

-- | A JSON Schema document: an optional id, optional local definitions, and a root schema
data Document =
  Document {
    documentId :: (Maybe String),
    documentDefinitions :: (Maybe (M.Map Keyword Schema)),
    documentRoot :: Schema}
  deriving (Eq, Ord, Read, Show)

_Document = Core.Name "hydra.json.schema.model.Document"

_Document_id = Core.Name "id"

_Document_definitions = Core.Name "definitions"

_Document_root = Core.Name "root"

-- | The schema(s) for array items: either a single schema shared by all items, or one schema per item
data Items =
  ItemsSameItems Schema |
  ItemsVarItems [Schema]
  deriving (Eq, Ord, Read, Show)

_Items = Core.Name "hydra.json.schema.model.Items"

_Items_sameItems = Core.Name "sameItems"

_Items_varItems = Core.Name "varItems"

-- | A property name used as a key in a JSON Schema keyword-to-schema map
newtype Keyword =
  Keyword {
    unKeyword :: String}
  deriving (Eq, Ord, Read, Show)

_Keyword = Core.Name "hydra.json.schema.model.Keyword"

-- | A numeric bound with a flag indicating whether the bound itself is excluded
data Limit =
  Limit {
    limitValue :: Int,
    limitExclusive :: Bool}
  deriving (Eq, Ord, Read, Show)

_Limit = Core.Name "hydra.json.schema.model.Limit"

_Limit_value = Core.Name "value"

_Limit_exclusive = Core.Name "exclusive"

-- | A restriction combining multiple schemas: allOf, anyOf, oneOf, not, or enum
data MultipleRestriction =
  MultipleRestrictionAllOf [Schema] |
  MultipleRestrictionAnyOf [Schema] |
  MultipleRestrictionOneOf [Schema] |
  MultipleRestrictionNot Schema |
  MultipleRestrictionEnum [Model.Value]
  deriving (Eq, Ord, Read, Show)

_MultipleRestriction = Core.Name "hydra.json.schema.model.MultipleRestriction"

_MultipleRestriction_allOf = Core.Name "allOf"

_MultipleRestriction_anyOf = Core.Name "anyOf"

_MultipleRestriction_oneOf = Core.Name "oneOf"

_MultipleRestriction_not = Core.Name "not"

_MultipleRestriction_enum = Core.Name "enum"

-- | A restriction on numeric-typed values: a minimum, a maximum, or a multipleOf constraint
data NumericRestriction =
  NumericRestrictionMinimum Limit |
  NumericRestrictionMaximum Limit |
  NumericRestrictionMultipleOf Int
  deriving (Eq, Ord, Read, Show)

_NumericRestriction = Core.Name "hydra.json.schema.model.NumericRestriction"

_NumericRestriction_minimum = Core.Name "minimum"

_NumericRestriction_maximum = Core.Name "maximum"

_NumericRestriction_multipleOf = Core.Name "multipleOf"

-- | A restriction on object-typed values: properties, additionalProperties, required, and related keywords
data ObjectRestriction =
  ObjectRestrictionProperties (M.Map Keyword Schema) |
  ObjectRestrictionAdditionalProperties AdditionalItems |
  ObjectRestrictionRequired [Keyword] |
  ObjectRestrictionMinProperties Int |
  ObjectRestrictionMaxProperties Int |
  ObjectRestrictionDependencies (M.Map Keyword SchemaOrArray) |
  ObjectRestrictionPatternProperties (M.Map RegularExpression Schema)
  deriving (Eq, Ord, Read, Show)

_ObjectRestriction = Core.Name "hydra.json.schema.model.ObjectRestriction"

_ObjectRestriction_properties = Core.Name "properties"

_ObjectRestriction_additionalProperties = Core.Name "additionalProperties"

_ObjectRestriction_required = Core.Name "required"

_ObjectRestriction_minProperties = Core.Name "minProperties"

_ObjectRestriction_maxProperties = Core.Name "maxProperties"

_ObjectRestriction_dependencies = Core.Name "dependencies"

_ObjectRestriction_patternProperties = Core.Name "patternProperties"

-- | A regular expression pattern, as used by the pattern and patternProperties keywords
newtype RegularExpression =
  RegularExpression {
    unRegularExpression :: String}
  deriving (Eq, Ord, Read, Show)

_RegularExpression = Core.Name "hydra.json.schema.model.RegularExpression"

-- | A single JSON Schema restriction: a type, value restriction, reference, title, or description
data Restriction =
  RestrictionType Type |
  RestrictionString StringRestriction |
  RestrictionNumber NumericRestriction |
  RestrictionArray ArrayRestriction |
  RestrictionObject ObjectRestriction |
  RestrictionMultiple MultipleRestriction |
  RestrictionReference SchemaReference |
  RestrictionTitle String |
  RestrictionDescription String
  deriving (Eq, Ord, Read, Show)

_Restriction = Core.Name "hydra.json.schema.model.Restriction"

_Restriction_type = Core.Name "type"

_Restriction_string = Core.Name "string"

_Restriction_number = Core.Name "number"

_Restriction_array = Core.Name "array"

_Restriction_object = Core.Name "object"

_Restriction_multiple = Core.Name "multiple"

_Restriction_reference = Core.Name "reference"

_Restriction_title = Core.Name "title"

_Restriction_description = Core.Name "description"

-- | A JSON schema: a non-empty list of restrictions that a conforming value must satisfy
newtype Schema =
  Schema {
    unSchema :: [Restriction]}
  deriving (Eq, Ord, Read, Show)

_Schema = Core.Name "hydra.json.schema.model.Schema"

-- | A dependency value: either a schema, or a list of required keyword names
data SchemaOrArray =
  SchemaOrArraySchema Schema |
  SchemaOrArrayArray [Keyword]
  deriving (Eq, Ord, Read, Show)

_SchemaOrArray = Core.Name "hydra.json.schema.model.SchemaOrArray"

_SchemaOrArray_schema = Core.Name "schema"

_SchemaOrArray_array = Core.Name "array"

-- | A reference to another schema by URI
newtype SchemaReference =
  SchemaReference {
    unSchemaReference :: String}
  deriving (Eq, Ord, Read, Show)

_SchemaReference = Core.Name "hydra.json.schema.model.SchemaReference"

-- | A restriction on string-typed values: minLength, maxLength, or pattern
data StringRestriction =
  StringRestrictionMinLength Int |
  StringRestrictionMaxLength Int |
  StringRestrictionPattern RegularExpression
  deriving (Eq, Ord, Read, Show)

_StringRestriction = Core.Name "hydra.json.schema.model.StringRestriction"

_StringRestriction_minLength = Core.Name "minLength"

_StringRestriction_maxLength = Core.Name "maxLength"

_StringRestriction_pattern = Core.Name "pattern"

-- | A type restriction: a single type name, or a list of alternative type names
data Type =
  TypeSingle TypeName |
  TypeMultiple [TypeName]
  deriving (Eq, Ord, Read, Show)

_Type = Core.Name "hydra.json.schema.model.Type"

_Type_single = Core.Name "single"

_Type_multiple = Core.Name "multiple"

-- | The name of a JSON Schema primitive type
data TypeName =
  TypeNameString |
  TypeNameInteger |
  TypeNameNumber |
  TypeNameBoolean |
  TypeNameNull |
  TypeNameArray |
  TypeNameObject
  deriving (Eq, Ord, Read, Show)

_TypeName = Core.Name "hydra.json.schema.model.TypeName"

_TypeName_string = Core.Name "string"

_TypeName_integer = Core.Name "integer"

_TypeName_number = Core.Name "number"

_TypeName_boolean = Core.Name "boolean"

_TypeName_null = Core.Name "null"

_TypeName_array = Core.Name "array"

_TypeName_object = Core.Name "object"