-
Notifications
You must be signed in to change notification settings - Fork 55
Open
Description
It would be cool to be able to define and validate data using yaml shapes & yamlscript. Sure one can define data using JSON schema structures and use that to validate YAML, but something more minimalistic and data-driven like malli schemas in YAML would be more concise and easier to maintain.
Something like:
foo:
bar: boolean # Fields mandatory by default
baz ?: string # Optional
qux +: number? # 1..n
quux *: integer? # 0..n
quuux 0..4: pos-int? #
foo ?: foo # Ref to self
This type of syntax could be parsed to build for example malli schema registry and utilize existing built-in schemas as much as possible:
[:schema
{:registry {"foo" [:map
{:closed true}
[:bar :boolean]
[:baz {:optional true} :string]
[:qux [:+ number?]]
[:quux [:* integer?]]
[:quuux [:repeat {:min 0, :max 4} pos-int?]]
[:foo {:optional true} [:ref "foo"]]]}}
"foo"]
ingydotnet and eror123r
Metadata
Metadata
Assignees
Labels
No labels