From 86f62aae47111ad2593b3e6b71b68a8122a0269d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kat=20March=C3=A1n?= Date: Tue, 31 Aug 2021 12:02:32 -0700 Subject: [PATCH] document formats --- SCHEMA-SPEC.md | 20 ++++++++++++++++++-- examples/kdl-schema.kdl | 2 +- 2 files changed, 19 insertions(+), 3 deletions(-) diff --git a/SCHEMA-SPEC.md b/SCHEMA-SPEC.md index 51d3719..d891ffa 100644 --- a/SCHEMA-SPEC.md +++ b/SCHEMA-SPEC.md @@ -131,10 +131,26 @@ and property names when the `node-names` or `prop-names` options are activated. #### String validations -* `pattern`: PCRE (Regex) pattern or patterns to test prop values against. +* `pattern`: Regex pattern or patterns to test prop values against. Specific regex syntax may be implementation-dependent. * `min-length`: Minimum length, if a string. * `max-length`: Maximum length, if a string. -* `format`: Intended data format, if the value is a string. +* `format`: Intended data format, if the value is a string. Possible values are: + * `date-time`: ISO8601 date/time format. + * `time`: "Time" section of ISO8601. + * `date`: "Date" section of ISO8601. + * `email`: RFC5302 email address. + * `idn-email`: RFC6531 internationalized email address. + * `hostname`: RFC1132 internet hostname. + * `idn-hostname`: RFC5890 internationalized internet hostname. + * `ipv4`: RFC2673 dotted-quad IPv4 address. + * `ipv6`: RFC2373 IPv6 address. + * `uri`: RFC3986 URI. + * `uri-reference`: RFC3986 URI Reference. + * `iri`: RFC3987 Internationalized Resource Identifier. + * `iri-reference`: RFC3987 Internationalized Resource Identifier Reference. + * `uri-template`: RFC6570 URI Template. + * `uuid`: RFC4122 UUID. + * `regex`: Regular expression. Specific patterns may be implementation-dependent. #### Number validations diff --git a/examples/kdl-schema.kdl b/examples/kdl-schema.kdl index 3e5c919..e6c8b59 100644 --- a/examples/kdl-schema.kdl +++ b/examples/kdl-schema.kdl @@ -125,7 +125,7 @@ document description="KDL Schema KDL schema in KDL" schema-url="https://github.c 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" + enum "date-time" "date" "time" "email" "idn-email" "hostname" "idn-hostname" "ipv4" "ipv6" "uri" "uri-reference" "iri", "iri-reference" "uri-template" "regex" "uuid" } } node "%" description="Only used for numeric values. Constrains them to be multiples of the given number(s)" {