From a45eb2ba1ad8e550dcab3102533b989168180ee8 Mon Sep 17 00:00:00 2001 From: David Waltermire Date: Tue, 4 Apr 2023 11:25:18 -0400 Subject: [PATCH] Schema adjustments to repair broken regexes and to simplify use of exiting types --- schema/json/metaschema-datatypes.json | 52 ++++++++++++++++----------- schema/xml/metaschema-datatypes.xsd | 25 ++++++------- schema/xml/metaschema.xsd | 9 +---- 3 files changed, 43 insertions(+), 43 deletions(-) diff --git a/schema/json/metaschema-datatypes.json b/schema/json/metaschema-datatypes.json index b93a29199..e3cf599be 100644 --- a/schema/json/metaschema-datatypes.json +++ b/schema/json/metaschema-datatypes.json @@ -6,7 +6,7 @@ "definitions" : { "Base64Datatype": { "type": "string", - "pattern": "^[0-9A-Fa-f]+$", + "pattern": "^[0-9A-Za-z+/]+={0,2}$", "contentEncoding": "base64" }, "BooleanDatatype": { @@ -32,22 +32,30 @@ "DayTimeDurationDatatype": { "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": { "type": "number", "pattern": "^(\\+|-)?([0-9]+(\\.[0-9]*)?|\\.[0-9]+)$" }, "EmailAddressDatatype": { - "type": "string", - "format": "email", - "pattern": "^.+@.+$" + "allOf": [ + {"$ref": "#/definitions/StringDatatype"}, + { + "type": "string", + "format": "email", + "pattern": "^.+@.+$" + } + ] }, "HostnameDatatype": { - "allOf": [ - {"$ref": "#/definitions/StringDatatype"}, - {"format": "idn-hostname"} - ] + "allOf": [ + {"$ref": "#/definitions/StringDatatype"}, + { + "type": "string", + "format": "idn-hostname" + } + ] }, "IntegerDatatype": { "type": "integer" @@ -70,18 +78,22 @@ "type": "string" }, "NonNegativeIntegerDatatype": { - "allOf": [ - {"$ref": "#/definitions/IntegerDatatype"}, - {"minimum": 0, - "type": "number"} - ] + "allOf": [ + {"$ref": "#/definitions/IntegerDatatype"}, + { + "type": "number", + "minimum": 0 + } + ] }, "PositiveIntegerDatatype": { - "allOf": [ - {"$ref": "#/definitions/IntegerDatatype"}, - {"minimum": 1, - "type": "number"} - ] + "allOf": [ + {"$ref": "#/definitions/IntegerDatatype"}, + { + "type": "number", + "minimum": 1 + } + ] }, "StringDatatype": { "type": "string", @@ -108,7 +120,7 @@ "YearMonthDurationDatatype": { "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$" } } } diff --git a/schema/xml/metaschema-datatypes.xsd b/schema/xml/metaschema-datatypes.xsd index 59a52e627..7d1b4e46c 100644 --- a/schema/xml/metaschema-datatypes.xsd +++ b/schema/xml/metaschema-datatypes.xsd @@ -4,23 +4,13 @@ - - - A trimmed string, at least one character with no - leading or trailing whitespace. - - + - - - A trimmed string, at least one character with no - leading or trailing whitespace. - - + @@ -56,7 +46,7 @@ - + @@ -76,7 +66,7 @@ An email address - + Need a better pattern. @@ -237,5 +227,10 @@ - + + + + + + diff --git a/schema/xml/metaschema.xsd b/schema/xml/metaschema.xsd index 45bbd60fe..6ac0e4787 100644 --- a/schema/xml/metaschema.xsd +++ b/schema/xml/metaschema.xsd @@ -55,14 +55,7 @@ - - - - - - - - +