Skip to content

Commit

Permalink
- Relocated data types into their own file for easier maintenance.
Browse files Browse the repository at this point in the history
- Updated data types to ensure consistency between specification and implementation.
- Identify locations of data type schemas in data type specifications.
- Discuss use of regular expression dialects used in XML and JSON schema. #235
  • Loading branch information
david-waltermire committed Mar 9, 2023
1 parent 6a023bd commit 5108c72
Show file tree
Hide file tree
Showing 3 changed files with 410 additions and 275 deletions.
76 changes: 55 additions & 21 deletions schema/json/metaschema-datatypes.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,110 +5,144 @@
"type" : "object",
"definitions" : {
"Base64Datatype": {
"description": "Binary data encoded using the Base 64 encoding algorithm as defined by RFC4648.",
"type": "string",
"pattern": "^[0-9A-Fa-f]+$",
"pattern": "^[0-9A-Za-z+/]+$",
"contentEncoding": "base64"
},
"BooleanDatatype": {
"description": "A binary value that is either: true or false.",
"type": "boolean"
},
"DateDatatype": {
"description": "A string representing a 24-hour period with an optional timezone.",
"type": "string",
"pattern": "^(((2000|2400|2800|(19|2[0-9](0[48]|[2468][048]|[13579][26])))-02-29)|(((19|2[0-9])[0-9]{2})-02-(0[1-9]|1[0-9]|2[0-8]))|(((19|2[0-9])[0-9]{2})-(0[13578]|10|12)-(0[1-9]|[12][0-9]|3[01]))|(((19|2[0-9])[0-9]{2})-(0[469]|11)-(0[1-9]|[12][0-9]|30)))(Z|[+-][0-9]{2}:[0-9]{2})?$"
},
"DateWithTimezoneDatatype": {
"description": "A string representing a 24-hour period with a required timezone.",
"type": "string",
"pattern": "^(((2000|2400|2800|(19|2[0-9](0[48]|[2468][048]|[13579][26])))-02-29)|(((19|2[0-9])[0-9]{2})-02-(0[1-9]|1[0-9]|2[0-8]))|(((19|2[0-9])[0-9]{2})-(0[13578]|10|12)-(0[1-9]|[12][0-9]|3[01]))|(((19|2[0-9])[0-9]{2})-(0[469]|11)-(0[1-9]|[12][0-9]|30)))(Z|[+-][0-9]{2}:[0-9]{2})$"
},
"DateTimeDatatype": {
"description": "A string representing a point in time with an optional timezone.",
"type": "string",
"pattern": "^(((2000|2400|2800|(19|2[0-9](0[48]|[2468][048]|[13579][26])))-02-29)|(((19|2[0-9])[0-9]{2})-02-(0[1-9]|1[0-9]|2[0-8]))|(((19|2[0-9])[0-9]{2})-(0[13578]|10|12)-(0[1-9]|[12][0-9]|3[01]))|(((19|2[0-9])[0-9]{2})-(0[469]|11)-(0[1-9]|[12][0-9]|30)))T(2[0-3]|[01][0-9]):([0-5][0-9]):([0-5][0-9])(\\.[0-9]*[1-9])?(Z|(-((0[0-9]|1[0-2]):00|0[39]:30)|\\+((0[0-9]|1[0-4]):00|(0[34569]|10):30|(0[58]|12):45)))?$"
},
"DateTimeWithTimezoneDatatype": {
"description": "A string representing a point in time with a required timezone.",
"type": "string",
"format": "date-time",
"pattern": "^(((2000|2400|2800|(19|2[0-9](0[48]|[2468][048]|[13579][26])))-02-29)|(((19|2[0-9])[0-9]{2})-02-(0[1-9]|1[0-9]|2[0-8]))|(((19|2[0-9])[0-9]{2})-(0[13578]|10|12)-(0[1-9]|[12][0-9]|3[01]))|(((19|2[0-9])[0-9]{2})-(0[469]|11)-(0[1-9]|[12][0-9]|30)))T(2[0-3]|[01][0-9]):([0-5][0-9]):([0-5][0-9])(\\.[0-9]*[1-9])?(Z|(-((0[0-9]|1[0-2]):00|0[39]:30)|\\+((0[0-9]|1[0-4]):00|(0[34569]|10):30|(0[58]|12):45)))$"
},
"DayTimeDurationDatatype": {
"description": "An amount of time quantified in days, hours, minutes, and seconds.",
"type": "string",
"format": "duration",
"pattern": "^[-+]?P([-+]?[0-9]+D)?(T([-+]?[0-9]+H)?([-+]?[0-9]+M)?([-+]?[0-9]+([.,][0-9]{0,9})?S)?)?$"
"pattern": "^-?P([0-9]+D(T(([0-9]+H([0-9]+M)?(([0-9]+|[0-9]+(\\.[0-9]+)?)S)?)|([0-9]+M(([0-9]+|[0-9]+(\\.[0-9]+)?)S)?)|([0-9]+|[0-9]+(\\.[0-9]+)?)S))?)|T(([0-9]+H([0-9]+M)?(([0-9]+|[0-9]+(\\.[0-9]+)?)S)?)|([0-9]+M(([0-9]+|[0-9]+(\\.[0-9]+)?)S)?)|([0-9]+|[0-9]+(\\.[0-9]+)?)S)$"
},
"DecimalDatatype": {
"description": "A real number expressed using a whole and optional fractional part separated by a period.",
"type": "number",
"pattern": "^(\\+|-)?([0-9]+(\\.[0-9]*)?|\\.[0-9]+)$"
},
"EmailAddressDatatype": {
"type": "string",
"format": "email",
"pattern": "^.+@.+$"
"description": "An email address string formatted according to RFC 6531.",
"allOf": [
{"$ref": "#/definitions/StringDatatype"},
{
"type": "string",
"format": "email",
"pattern": "^.+@.+$"
}
]
},
"HostnameDatatype": {
"allOf": [
{"$ref": "#/definitions/StringDatatype"},
{"format": "idn-hostname"}
]
"description": "An internationalized Internet host name string formatted according to section 2.3.2.3 of RFC5890.",
"allOf": [
{"$ref": "#/definitions/StringDatatype"},
{
"type": "string",
"format": "idn-hostname"
}
]
},
"IntegerDatatype": {
"description": "A whole number value.",
"type": "integer"
},
"IPV4AddressDatatype": {
"description": "An Internet Protocol version 4 address represented using dotted-quad syntax as defined in section 3.2 of RFC2673.",
"type": "string",
"format": "ipv4",
"pattern": "^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$"
},
"IPV6AddressDatatype": {
"description": "An Internet Protocol version 6 address represented using the syntax defined in section 2.2 of RFC3513.",
"type": "string",
"format": "ipv6",
"pattern": "^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|[fF][eE]80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::([fF]{4}(:0{1,4}){0,1}:){0,1}((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9]).){3,3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9]).){3,3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9]))$"
},
"MarkupLineDatatype": {
"description": "",
"type": "string",
"pattern": "^[^\n]+$"
},
"MarkupMultilineDatatype": {
"description": "",
"type": "string"
},
"NonNegativeIntegerDatatype": {
"allOf": [
{"$ref": "#/definitions/IntegerDatatype"},
{"minimum": 0,
"type": "number"}
]
"description": "An integer value that is equal to or greater than 0.",
"allOf": [
{"$ref": "#/definitions/IntegerDatatype"},
{
"type": "number",
"minimum": 0
}
]
},
"PositiveIntegerDatatype": {
"allOf": [
{"$ref": "#/definitions/IntegerDatatype"},
{"minimum": 1,
"type": "number"}
]
"description": "An integer value that is greater than 0.",
"allOf": [
{"$ref": "#/definitions/IntegerDatatype"},
{
"type": "number",
"minimum": 1
}
]
},
"StringDatatype": {
"description": "A non-empty string with leading and trailing whitespace disallowed. Whitespace is: U+9, U+10, U+32 or [ \n\t]+",
"type": "string",
"pattern": "^\\S(.*\\S)?$"
},
"TokenDatatype": {
"description": "A non-colonized name as defined by XML Schema Part 2: Datatypes Second Edition. https://www.w3.org/TR/xmlschema11-2/#NCName.",
"type": "string",
"pattern": "^(\\p{L}|_)(\\p{L}|\\p{N}|[.\\-_])*$"
},
"URIDatatype": {
"description": "A universal resource identifier (URI) formatted according to RFC3986.",
"type": "string",
"format": "uri",
"pattern": "^[a-zA-Z][a-zA-Z0-9+\\-.]+:.+$"
},
"URIReferenceDatatype": {
"description": "A URI Reference, either a URI or a relative-reference, formatted according to section 4.1 of RFC3986.",
"type": "string",
"format": "uri-reference"
},
"UUIDDatatype": {
"type": "string",
"description": "A type 4 ('random' or 'pseudorandom') or type 5 UUID per RFC 4122.",
"type": "string",
"pattern": "^[0-9A-Fa-f]{8}-[0-9A-Fa-f]{4}-[45][0-9A-Fa-f]{3}-[89ABab][0-9A-Fa-f]{3}-[0-9A-Fa-f]{12}$"
},
"YearMonthDurationDatatype": {
"description": "An amount of time quantified in years and months based on ISO-8601 durations (see also RFC3339 appendix A).",
"type": "string",
"format": "duration",
"pattern": "^[-+]?P([-+]?[0-9]+Y)?([-+]?[0-9]+M)?([-+]?[0-9]+W)?([-+]?[0-9]+D)?$"
"pattern": "^-?P([0-9]+Y([0-9]+M)?)|[0-9]+M$"
}
}
}
Loading

0 comments on commit 5108c72

Please sign in to comment.