module Hydra.Sources.Tier4.Langs.Yaml.Model where
import Hydra.Sources.Tier3.All
import Hydra.Dsl.Annotations
import Hydra.Dsl.Bootstrap
import Hydra.Dsl.Types as Types
yamlModelModule :: Module
yamlModelModule :: Module
yamlModelModule = Namespace
-> [Element] -> [Module] -> [Module] -> Maybe String -> Module
Module Namespace
ns [Element]
elements [Module
hydraCoreModule] [Module]
tier0Modules (Maybe String -> Module) -> Maybe String -> Module
forall a b. (a -> b) -> a -> b
$
String -> Maybe String
forall a. a -> Maybe a
Just (String
"A basic YAML representation model. Based on:\n" String -> String -> String
forall a. [a] -> [a] -> [a]
++
String
" https://yaml.org/spec/1.2/spec.html\n" String -> String -> String
forall a. [a] -> [a] -> [a]
++
String
"The Serialization and Presentation properties of YAML,\n" String -> String -> String
forall a. [a] -> [a] -> [a]
++
String
"including directives, comments, anchors, style, formatting, and aliases, are not supported by this model.\n" String -> String -> String
forall a. [a] -> [a] -> [a]
++
String
"In addition, tags are omitted from this model, and non-standard scalars are unsupported.")
where
ns :: Namespace
ns = String -> Namespace
Namespace String
"hydra/langs/yaml/model"
def :: String -> Type -> Element
def = Namespace -> String -> Type -> Element
datatype Namespace
ns
model :: String -> Type
model = Namespace -> String -> Type
typeref Namespace
ns
elements :: [Element]
elements = [
String -> Type -> Element
def String
"Node" (Type -> Element) -> Type -> Element
forall a b. (a -> b) -> a -> b
$
String -> Type -> Type
doc String
"A YAML node (value)" (Type -> Type) -> Type -> Type
forall a b. (a -> b) -> a -> b
$
[FieldType] -> Type
union [
String
"mapping"String -> Type -> FieldType
>: Type -> Type -> Type
Types.map (String -> Type
model String
"Node") (String -> Type
model String
"Node"),
String
"scalar"String -> Type -> FieldType
>: String -> Type
model String
"Scalar",
String
"sequence"String -> Type -> FieldType
>: Type -> Type
list (Type -> Type) -> Type -> Type
forall a b. (a -> b) -> a -> b
$ String -> Type
model String
"Node"],
String -> Type -> Element
def String
"Scalar" (Type -> Element) -> Type -> Element
forall a b. (a -> b) -> a -> b
$
String -> Type -> Type
doc String
"A union of scalars supported in the YAML failsafe and JSON schemas. Other scalars are not supported here" (Type -> Type) -> Type -> Type
forall a b. (a -> b) -> a -> b
$
[FieldType] -> Type
union [
String
"bool"String -> Type -> FieldType
>:
String -> Type -> Type
doc String
"Represents a true/false value"
Type
boolean,
String
"float"String -> Type -> FieldType
>:
String -> Type -> Type
doc String
"Represents an approximation to real numbers"
Type
bigfloat,
String
"int"String -> Type -> FieldType
>:
String -> Type -> Type
doc String
"Represents arbitrary sized finite mathematical integers"
Type
bigint,
String
"null"String -> Type -> FieldType
>:
String -> Type -> Type
doc String
"Represents the lack of a value"
Type
unit,
String
"str"String -> Type -> FieldType
>:
String -> Type -> Type
doc String
"A string value"
Type
string]]