mirror of https://github.com/kdl-org/kdl.git
more validations
This commit is contained in:
parent
ea66f812cf
commit
8cf9ce0693
|
|
@ -24,6 +24,22 @@ document description="KDL Schema KDL schema in KDL" schema-url="https://github.c
|
|||
type "string"
|
||||
}
|
||||
children {
|
||||
node "other-properties-allowed" description="Whether to allow properties other than the ones explicitly listed. Defaults to 'false'." {
|
||||
max 1
|
||||
value {
|
||||
min 1
|
||||
max 1
|
||||
type "boolean"
|
||||
}
|
||||
}
|
||||
node "other-children-allowed" description="Whether to allow child nodes other than the ones explicitly listed. Defaults to 'false'." {
|
||||
max 1
|
||||
value {
|
||||
min 1
|
||||
max 1
|
||||
type "boolean"
|
||||
}
|
||||
}
|
||||
node "min" description="minimum number of instances of this node in its parent's children." {
|
||||
max 1
|
||||
value {
|
||||
|
|
@ -53,7 +69,20 @@ document description="KDL Schema KDL schema in KDL" schema-url="https://github.c
|
|||
prop "description" description="A description of this property's purpose." {
|
||||
type "string"
|
||||
}
|
||||
children description="Property node children. Only used for validation nodes, for now" {
|
||||
children description="Property-specific validations." {
|
||||
node "required" description="Whether this property is required if its parent is present." {
|
||||
max 1
|
||||
value {
|
||||
min 1
|
||||
max 1
|
||||
type "boolean"
|
||||
}
|
||||
}
|
||||
node "property-names" description="Validations to apply specifically to arbitrary node names" {
|
||||
children ref="#validations"
|
||||
}
|
||||
}
|
||||
children id="validations" description="General value validations." {
|
||||
node "type" description="The type for this prop's value." {
|
||||
max 1
|
||||
value {
|
||||
|
|
@ -75,6 +104,74 @@ document description="KDL Schema KDL schema in KDL" schema-url="https://github.c
|
|||
type "boolean"
|
||||
}
|
||||
}
|
||||
node "pattern" description="PCRE (Regex) pattern or patterns to test prop values against." {
|
||||
value {
|
||||
min 1
|
||||
type "string"
|
||||
}
|
||||
}
|
||||
node "min-length" description="Minimum length of prop value, if it's a string." {
|
||||
max 1
|
||||
value {
|
||||
min 1
|
||||
type "number"
|
||||
}
|
||||
}
|
||||
node "max-length" description="Maximum length of prop value, if it's a string." {
|
||||
max 1
|
||||
value {
|
||||
min 1
|
||||
type "number"
|
||||
}
|
||||
}
|
||||
node "format" description="Intended data format, if the value is a string." {
|
||||
max 1
|
||||
value {
|
||||
min 1
|
||||
type "string"
|
||||
// https://json-schema.org/understanding-json-schema/reference/string.html#format
|
||||
enum "date-time" "date" "time" "email" "idn-email" "hostname" "ipv4" "ipv6" "uri" "uri-reference" "iri", "iri-reference" "uri-template" "kdl-pointer" "relative-kdl-pointer" "regex" "uuid"
|
||||
}
|
||||
}
|
||||
node "multiple-of" description="Only used for numeric values. Constrains them to be multiples of the given number(s)" {
|
||||
max 1
|
||||
value {
|
||||
min 1
|
||||
type "number"
|
||||
}
|
||||
}
|
||||
node "gt" description="Only used for numeric values. Constrains them to be greater than the given number(s)" {
|
||||
max 1
|
||||
value {
|
||||
min 1
|
||||
max 1
|
||||
type "number"
|
||||
}
|
||||
}
|
||||
node "gte" description="Only used for numeric values. Constrains them to be greater than or equal to the given number(s)" {
|
||||
max 1
|
||||
value {
|
||||
min 1
|
||||
max 1
|
||||
type "number"
|
||||
}
|
||||
}
|
||||
node "lt" description="Only used for numeric values. Constrains them to be less than the given number(s)" {
|
||||
max 1
|
||||
value {
|
||||
min 1
|
||||
max 1
|
||||
type "number"
|
||||
}
|
||||
}
|
||||
node "lte" description="Only used for numeric values. Constrains them to be less than or equal to the given number(s)" {
|
||||
max 1
|
||||
value {
|
||||
min 1
|
||||
max 1
|
||||
type "number"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
node "value" description="one or more direct node values" {
|
||||
|
|
@ -87,20 +184,8 @@ document description="KDL Schema KDL schema in KDL" schema-url="https://github.c
|
|||
prop "description" description="A description of this property's purpose." {
|
||||
type "string"
|
||||
}
|
||||
children description="Value node children. Only used for validation nodes, for now" {
|
||||
node "type" description="The type for this/these value(s)." {
|
||||
max 1
|
||||
value {
|
||||
min 1
|
||||
type "string"
|
||||
}
|
||||
}
|
||||
node "enum" description="An enumeration of possible values" {
|
||||
max 1
|
||||
value description="Enumeration choices" {
|
||||
min 1
|
||||
}
|
||||
}
|
||||
children ref="#validations"
|
||||
children description="Node value-specific validations" {
|
||||
node "min" description="minimum number of values for this node." {
|
||||
max 1
|
||||
value {
|
||||
|
|
@ -120,7 +205,6 @@ document description="KDL Schema KDL schema in KDL" schema-url="https://github.c
|
|||
}
|
||||
}
|
||||
node "children" {
|
||||
max 1
|
||||
prop "id" description="A globally-unique ID of this children node." {
|
||||
type "string"
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue