packages feed

hydra-ext-0.17.4: src/main/haskell/Hydra/Pegasus/Pdl.hs

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

-- | A model for PDL (Pegasus Data Language) schemas. Based on the specification at:
-- |   https://linkedin.github.io/rest.li/pdl_schema

module Hydra.Pegasus.Pdl 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

-- | Annotations which can be applied to record fields, aliased union members, enum symbols, or named schemas
data Annotations =
  Annotations {
    annotationsDoc :: (Maybe String),
    annotationsDeprecated :: Bool}
  deriving (Eq, Ord, Read, Show)

_Annotations = Core.Name "hydra.pegasus.pdl.Annotations"

_Annotations_doc = Core.Name "doc"

_Annotations_deprecated = Core.Name "deprecated"

-- | A single symbol of a PDL enum schema, with its optional annotations
data EnumField =
  EnumField {
    enumFieldName :: EnumFieldName,
    enumFieldAnnotations :: Annotations}
  deriving (Eq, Ord, Read, Show)

_EnumField = Core.Name "hydra.pegasus.pdl.EnumField"

_EnumField_name = Core.Name "name"

_EnumField_annotations = Core.Name "annotations"

-- | The name of a PDL enum symbol, conventionally in upper snake case
newtype EnumFieldName =
  EnumFieldName {
    unEnumFieldName :: String}
  deriving (Eq, Ord, Read, Show)

_EnumFieldName = Core.Name "hydra.pegasus.pdl.EnumFieldName"

-- | A PDL enum schema, defined as a fixed set of enumerated symbols
data EnumSchema =
  EnumSchema {
    enumSchemaFields :: [EnumField]}
  deriving (Eq, Ord, Read, Show)

_EnumSchema = Core.Name "hydra.pegasus.pdl.EnumSchema"

_EnumSchema_fields = Core.Name "fields"

-- | The name of a record field or an aliased union member
newtype FieldName =
  FieldName {
    unFieldName :: String}
  deriving (Eq, Ord, Read, Show)

_FieldName = Core.Name "hydra.pegasus.pdl.FieldName"

-- | The unqualified (non-namespaced) name of a PDL named schema
newtype Name =
  Name {
    unName :: String}
  deriving (Eq, Ord, Read, Show)

_Name = Core.Name "hydra.pegasus.pdl.Name"

-- | A PDL schema that has a qualified name: a record, enum, or typeref
data NamedSchema =
  NamedSchema {
    namedSchemaQualifiedName :: QualifiedName,
    namedSchemaType :: NamedSchemaType,
    namedSchemaAnnotations :: Annotations}
  deriving (Eq, Ord, Read, Show)

_NamedSchema = Core.Name "hydra.pegasus.pdl.NamedSchema"

_NamedSchema_qualifiedName = Core.Name "qualifiedName"

_NamedSchema_type = Core.Name "type"

_NamedSchema_annotations = Core.Name "annotations"

-- | The variety of a PDL named schema: record, enum, or typeref
data NamedSchemaType =
  NamedSchemaTypeRecord RecordSchema |
  NamedSchemaTypeEnum EnumSchema |
  NamedSchemaTypeTyperef Schema
  deriving (Eq, Ord, Read, Show)

_NamedSchemaType = Core.Name "hydra.pegasus.pdl.NamedSchemaType"

_NamedSchemaType_record = Core.Name "record"

_NamedSchemaType_enum = Core.Name "enum"

_NamedSchemaType_typeref = Core.Name "typeref"

-- | A dot-separated PDL namespace, analogous to a Java package name
newtype Namespace =
  Namespace {
    unNamespace :: String}
  deriving (Eq, Ord, Read, Show)

_Namespace = Core.Name "hydra.pegasus.pdl.Namespace"

-- | The Java package under which generated bindings for a schema file are placed
newtype Package =
  Package {
    unPackage :: String}
  deriving (Eq, Ord, Read, Show)

_Package = Core.Name "hydra.pegasus.pdl.Package"

-- | One of the built-in PDL primitive types
data PrimitiveType =
  PrimitiveTypeBoolean |
  PrimitiveTypeBytes |
  PrimitiveTypeDouble |
  PrimitiveTypeFloat |
  PrimitiveTypeInt |
  PrimitiveTypeLong |
  PrimitiveTypeString
  deriving (Eq, Ord, Read, Show)

_PrimitiveType = Core.Name "hydra.pegasus.pdl.PrimitiveType"

_PrimitiveType_boolean = Core.Name "boolean"

_PrimitiveType_bytes = Core.Name "bytes"

_PrimitiveType_double = Core.Name "double"

_PrimitiveType_float = Core.Name "float"

_PrimitiveType_int = Core.Name "int"

_PrimitiveType_long = Core.Name "long"

_PrimitiveType_string = Core.Name "string"

-- | A custom key/value property attached to a PDL schema, field, or member
data Property =
  Property {
    propertyKey :: PropertyKey,
    propertyValue :: (Maybe Model.Value)}
  deriving (Eq, Ord, Read, Show)

_Property = Core.Name "hydra.pegasus.pdl.Property"

_Property_key = Core.Name "key"

_Property_value = Core.Name "value"

-- | The key of a custom PDL schema property, e.g. a dot-separated path
newtype PropertyKey =
  PropertyKey {
    unPropertyKey :: String}
  deriving (Eq, Ord, Read, Show)

_PropertyKey = Core.Name "hydra.pegasus.pdl.PropertyKey"

-- | A PDL name together with the optional namespace that qualifies it
data QualifiedName =
  QualifiedName {
    qualifiedNameName :: Name,
    qualifiedNameNamespace :: (Maybe Namespace)}
  deriving (Eq, Ord, Read, Show)

_QualifiedName = Core.Name "hydra.pegasus.pdl.QualifiedName"

_QualifiedName_name = Core.Name "name"

_QualifiedName_namespace = Core.Name "namespace"

-- | Note: the default value for an enum-valued must be one of the enumerated string symbols
data RecordField =
  RecordField {
    recordFieldName :: FieldName,
    recordFieldValue :: Schema,
    recordFieldOptional :: Bool,
    recordFieldDefault :: (Maybe Model.Value),
    recordFieldAnnotations :: Annotations}
  deriving (Eq, Ord, Read, Show)

_RecordField = Core.Name "hydra.pegasus.pdl.RecordField"

_RecordField_name = Core.Name "name"

_RecordField_value = Core.Name "value"

_RecordField_optional = Core.Name "optional"

_RecordField_default = Core.Name "default"

_RecordField_annotations = Core.Name "annotations"

-- | Note: all included schemas must be record schemas
data RecordSchema =
  RecordSchema {
    recordSchemaFields :: [RecordField],
    recordSchemaIncludes :: [NamedSchema]}
  deriving (Eq, Ord, Read, Show)

_RecordSchema = Core.Name "hydra.pegasus.pdl.RecordSchema"

_RecordSchema_fields = Core.Name "fields"

_RecordSchema_includes = Core.Name "includes"

-- | A PDL data schema: either a primitive, a reference by name, or a complex type
data Schema =
  SchemaArray Schema |
  SchemaFixed Int |
  SchemaInline NamedSchema |
  SchemaMap Schema |
  SchemaNamed QualifiedName |
  SchemaNull |
  SchemaPrimitive PrimitiveType |
  SchemaUnion UnionSchema
  deriving (Eq, Ord, Read, Show)

_Schema = Core.Name "hydra.pegasus.pdl.Schema"

_Schema_array = Core.Name "array"

_Schema_fixed = Core.Name "fixed"

_Schema_inline = Core.Name "inline"

_Schema_map = Core.Name "map"

_Schema_named = Core.Name "named"

_Schema_null = Core.Name "null"

_Schema_primitive = Core.Name "primitive"

_Schema_union = Core.Name "union"

-- | A .pdl source file: a namespace declaration, imports, and one or more named schemas
data SchemaFile =
  SchemaFile {
    schemaFileNamespace :: Namespace,
    schemaFilePackage :: (Maybe Package),
    schemaFileImports :: [QualifiedName],
    schemaFileSchemas :: [NamedSchema]}
  deriving (Eq, Ord, Read, Show)

_SchemaFile = Core.Name "hydra.pegasus.pdl.SchemaFile"

_SchemaFile_namespace = Core.Name "namespace"

_SchemaFile_package = Core.Name "package"

_SchemaFile_imports = Core.Name "imports"

_SchemaFile_schemas = Core.Name "schemas"

-- | Note: annotations are only available for aliased members
data UnionMember =
  UnionMember {
    unionMemberAlias :: (Maybe FieldName),
    unionMemberValue :: Schema,
    unionMemberAnnotations :: Annotations}
  deriving (Eq, Ord, Read, Show)

_UnionMember = Core.Name "hydra.pegasus.pdl.UnionMember"

_UnionMember_alias = Core.Name "alias"

_UnionMember_value = Core.Name "value"

_UnionMember_annotations = Core.Name "annotations"

-- | Note: unions are not allowed as member types of other unions
newtype UnionSchema =
  UnionSchema {
    unUnionSchema :: [UnionMember]}
  deriving (Eq, Ord, Read, Show)

_UnionSchema = Core.Name "hydra.pegasus.pdl.UnionSchema"