Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions schemas/w3c/xmlschema/2001/byte.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"title": "W3C XML Schema byte",
"description": "Represents 8-bit signed integers (§3.3.19)",
"examples": [ 0, 1, -1, 127, -128, 42, -99 ],
"x-license": "https://github.com/sourcemeta/std/blob/main/LICENSE",
"x-links": [ "https://www.w3.org/TR/xmlschema-2/#byte" ],
"$ref": "../../../iso/c/2024/int8.json"
}
1 change: 1 addition & 0 deletions schemas/w3c/xmlschema/2001/decimal.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
"$schema": "https://json-schema.org/draft/2020-12/schema",
"title": "W3C XML Schema decimal",
"description": "The decimal datatype represents arbitrary precision decimal numbers (§3.2.3)",
"$comment": "XML Schema requires minimally conforming processors to support decimal numbers with a minimum of 18 decimal digits (totalDigits). JSON's number type (IEEE 754 double-precision) provides only 15-17 significant decimal digits, which does not meet this minimum requirement. This schema uses string representation to maintain XML Schema conformance",
"examples": [
"-1.23",
"12678967.543233",
Expand Down
9 changes: 9 additions & 0 deletions schemas/w3c/xmlschema/2001/int.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"title": "W3C XML Schema int",
"description": "Represents 32-bit signed integers (§3.3.17)",
"examples": [ 0, 1, -1, 2147483647, -2147483648, 42, -999 ],
"x-license": "https://github.com/sourcemeta/std/blob/main/LICENSE",
"x-links": [ "https://www.w3.org/TR/xmlschema-2/#int" ],
"$ref": "../../../iso/c/2024/int32.json"
}
20 changes: 20 additions & 0 deletions schemas/w3c/xmlschema/2001/integer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"title": "W3C XML Schema integer",
"description": "Represents arbitrary-sized integers derived from decimal (§3.3.13)",
"$comment": "XML Schema supports arbitrary precision. JSON Schema's integer type is limited to the 64-bit range for safe interoperability per RFC 8259. This schema uses string representation to maintain XML Schema's arbitrary precision semantics",
"examples": [
"0",
"1",
"-1",
"42",
"-273",
"12678967543233",
"-9999999999999999",
"999999999999999999999999999999"
],
"x-license": "https://github.com/sourcemeta/std/blob/main/LICENSE",
"x-links": [ "https://www.w3.org/TR/xmlschema-2/#integer" ],
"type": "string",
"pattern": "^[+-]?(0|[1-9][0-9]*)$"
}
12 changes: 12 additions & 0 deletions schemas/w3c/xmlschema/2001/language.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"title": "W3C XML Schema language",
"description": "Represents natural language identifiers as defined by RFC 3066 (§3.3.3)",
"examples": [ "en", "en-US", "fr-FR", "de-DE", "ja", "zh-CN" ],
"x-license": "https://github.com/sourcemeta/std/blob/main/LICENSE",
"x-links": [
"https://www.w3.org/TR/xmlschema-2/#language",
"https://www.rfc-editor.org/rfc/rfc3066.html"
],
"$ref": "../../../ietf/language/3066/tag-syntax.json"
}
17 changes: 17 additions & 0 deletions schemas/w3c/xmlschema/2001/long.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"title": "W3C XML Schema long",
"description": "Represents 64-bit signed integers (§3.3.16)",
"examples": [
0,
1,
-1,
9223372036854775807,
-9223372036854775808,
1000000000,
-1000000000
],
"x-license": "https://github.com/sourcemeta/std/blob/main/LICENSE",
"x-links": [ "https://www.w3.org/TR/xmlschema-2/#long" ],
"$ref": "../../../iso/c/2024/int64.json"
}
17 changes: 17 additions & 0 deletions schemas/w3c/xmlschema/2001/negative-integer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"title": "W3C XML Schema negativeInteger",
"description": "Represents strictly negative integers (§3.3.15)",
"$comment": "XML Schema supports arbitrary precision. JSON Schema's integer type is limited to the 64-bit range for safe interoperability per RFC 8259. This schema uses string representation to maintain XML Schema's arbitrary precision semantics",
"examples": [
"-1",
"-42",
"-1000",
"-9223372036854775808",
"-999999999999999999999999999999"
],
"x-license": "https://github.com/sourcemeta/std/blob/main/LICENSE",
"x-links": [ "https://www.w3.org/TR/xmlschema-2/#negativeInteger" ],
"type": "string",
"pattern": "^-[1-9][0-9]*$"
}
18 changes: 18 additions & 0 deletions schemas/w3c/xmlschema/2001/non-negative-integer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"title": "W3C XML Schema nonNegativeInteger",
"description": "Represents integers greater than or equal to zero (§3.3.20)",
"$comment": "XML Schema supports arbitrary precision. JSON Schema's integer type is limited to the 64-bit range for safe interoperability per RFC 8259. This schema uses string representation to maintain XML Schema's arbitrary precision semantics",
"examples": [
"0",
"1",
"42",
"1000",
"9223372036854775807",
"999999999999999999999999999999"
],
"x-license": "https://github.com/sourcemeta/std/blob/main/LICENSE",
"x-links": [ "https://www.w3.org/TR/xmlschema-2/#nonNegativeInteger" ],
"type": "string",
"pattern": "^(0|[1-9][0-9]*)$"
}
18 changes: 18 additions & 0 deletions schemas/w3c/xmlschema/2001/non-positive-integer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"title": "W3C XML Schema nonPositiveInteger",
"description": "Represents integers less than or equal to zero (§3.3.14)",
"$comment": "XML Schema supports arbitrary precision. JSON Schema's integer type is limited to the 64-bit range for safe interoperability per RFC 8259. This schema uses string representation to maintain XML Schema's arbitrary precision semantics",
"examples": [
"0",
"-1",
"-42",
"-1000",
"-9223372036854775808",
"-999999999999999999999999999999"
],
"x-license": "https://github.com/sourcemeta/std/blob/main/LICENSE",
"x-links": [ "https://www.w3.org/TR/xmlschema-2/#nonPositiveInteger" ],
"type": "string",
"pattern": "^(0|-[1-9][0-9]*)$"
}
21 changes: 21 additions & 0 deletions schemas/w3c/xmlschema/2001/normalized-string.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"title": "W3C XML Schema normalizedString",
"description": "Represents white space normalized strings (§3.3.1)",
"examples": [
"This is a normalized string",
"Multiple spaces are allowed",
"Leading and trailing spaces are allowed ",
" Also leading spaces",
"",
"Unicode: 你好世界",
"Special chars: @#$%^&*()"
],
"x-license": "https://github.com/sourcemeta/std/blob/main/LICENSE",
"x-links": [ "https://www.w3.org/TR/xmlschema-2/#normalizedString" ],
"$ref": "string.json",
"not": {
"$comment": "Carriage return (#xD), line feed (#xA), and tab (#x9) are not allowed",
"pattern": "[\\r\\n\\t]"
}
}
17 changes: 17 additions & 0 deletions schemas/w3c/xmlschema/2001/positive-integer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"title": "W3C XML Schema positiveInteger",
"description": "Represents strictly positive integers (§3.3.25)",
"$comment": "XML Schema supports arbitrary precision. JSON Schema's integer type is limited to the 64-bit range for safe interoperability per RFC 8259. This schema uses string representation to maintain XML Schema's arbitrary precision semantics",
"examples": [
"1",
"42",
"1000",
"9223372036854775807",
"999999999999999999999999999999"
],
"x-license": "https://github.com/sourcemeta/std/blob/main/LICENSE",
"x-links": [ "https://www.w3.org/TR/xmlschema-2/#positiveInteger" ],
"type": "string",
"pattern": "^[1-9][0-9]*$"
}
9 changes: 9 additions & 0 deletions schemas/w3c/xmlschema/2001/short.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"title": "W3C XML Schema short",
"description": "Represents 16-bit signed integers (§3.3.18)",
"examples": [ 0, 1, -1, 32767, -32768, 1000, -1000 ],
"x-license": "https://github.com/sourcemeta/std/blob/main/LICENSE",
"x-links": [ "https://www.w3.org/TR/xmlschema-2/#short" ],
"$ref": "../../../iso/c/2024/int16.json"
}
21 changes: 21 additions & 0 deletions schemas/w3c/xmlschema/2001/token.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"title": "W3C XML Schema token",
"description": "Represents tokenized strings (§3.3.2)",
"examples": [
"single",
"two words",
"multiple single spaces here",
"no-spaces-just-hyphens",
"under_scores_allowed",
"MixedCase123",
"你好"
],
"x-license": "https://github.com/sourcemeta/std/blob/main/LICENSE",
"x-links": [ "https://www.w3.org/TR/xmlschema-2/#token" ],
"$ref": "normalized-string.json",
"not": {
"$comment": "Leading space, trailing space, and two or more consecutive spaces are not allowed",
"pattern": "(^ | $| )"
}
}
9 changes: 9 additions & 0 deletions schemas/w3c/xmlschema/2001/unsigned-byte.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"title": "W3C XML Schema unsignedByte",
"description": "Represents 8-bit unsigned integers (§3.3.24)",
"examples": [ 0, 1, 255, 128, 42 ],
"x-license": "https://github.com/sourcemeta/std/blob/main/LICENSE",
"x-links": [ "https://www.w3.org/TR/xmlschema-2/#unsignedByte" ],
"$ref": "../../../iso/c/2024/uint8.json"
}
9 changes: 9 additions & 0 deletions schemas/w3c/xmlschema/2001/unsigned-int.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"title": "W3C XML Schema unsignedInt",
"description": "Represents 32-bit unsigned integers (§3.3.22)",
"examples": [ 0, 1, 4294967295, 2147483648, 42 ],
"x-license": "https://github.com/sourcemeta/std/blob/main/LICENSE",
"x-links": [ "https://www.w3.org/TR/xmlschema-2/#unsignedInt" ],
"$ref": "../../../iso/c/2024/uint32.json"
}
75 changes: 75 additions & 0 deletions schemas/w3c/xmlschema/2001/unsigned-long.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"title": "W3C XML Schema unsignedLong",
"description": "Represents 64-bit unsigned integers (§3.3.21)",
"$comment": "XML Schema unsignedLong supports the 64-bit unsigned range, but JSON Schema's integer type is limited to signed 64-bit integers. This schema uses string representation to maintain full XML Schema conformance",
"examples": [
"0",
"1",
"18446744073709551615",
"9223372036854775808",
"4294967296"
],
"x-license": "https://github.com/sourcemeta/std/blob/main/LICENSE",
"x-links": [ "https://www.w3.org/TR/xmlschema-2/#unsignedLong" ],
"type": "string",
"anyOf": [
{
"pattern": "^0$"
},
{
"pattern": "^[1-9][0-9]{0,18}$"
},
{
"pattern": "^1[0-7][0-9]{18}$"
},
{
"pattern": "^18[0-3][0-9]{17}$"
},
{
"pattern": "^184[0-3][0-9]{16}$"
},
{
"pattern": "^1844[0-5][0-9]{15}$"
},
{
"pattern": "^18446[0-6][0-9]{14}$"
},
{
"pattern": "^184467[0-3][0-9]{13}$"
},
{
"pattern": "^1844674[0-3][0-9]{12}$"
},
{
"pattern": "^184467440[0-6][0-9]{10}$"
},
{
"pattern": "^1844674407[0-2][0-9]{9}$"
},
{
"pattern": "^18446744073[0-6][0-9]{8}$"
},
{
"pattern": "^1844674407370[0-8][0-9]{6}$"
},
{
"pattern": "^18446744073709[0-4][0-9]{5}$"
},
{
"pattern": "^184467440737095[0-4][0-9]{4}$"
},
{
"pattern": "^1844674407370955[0][0-9]{3}$"
},
{
"pattern": "^18446744073709551[0-5][0-9]{2}$"
},
{
"pattern": "^184467440737095516[0][0-9]$"
},
{
"pattern": "^1844674407370955161[0-5]$"
}
]
}
9 changes: 9 additions & 0 deletions schemas/w3c/xmlschema/2001/unsigned-short.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"title": "W3C XML Schema unsignedShort",
"description": "Represents 16-bit unsigned integers (§3.3.23)",
"examples": [ 0, 1, 65535, 32768, 1000 ],
"x-license": "https://github.com/sourcemeta/std/blob/main/LICENSE",
"x-links": [ "https://www.w3.org/TR/xmlschema-2/#unsignedShort" ],
"$ref": "../../../iso/c/2024/uint16.json"
}
76 changes: 76 additions & 0 deletions test/w3c/xmlschema/2001/byte.test.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
{
"x-license": "https://github.com/sourcemeta/std/blob/main/LICENSE",
"target": "../../../../schemas/w3c/xmlschema/2001/byte.json",
"tests": [
{
"description": "Valid - zero",
"data": 0,
"valid": true
},
{
"description": "Valid - positive one",
"data": 1,
"valid": true
},
{
"description": "Valid - negative one",
"data": -1,
"valid": true
},
{
"description": "Valid - maximum (127)",
"data": 127,
"valid": true
},
{
"description": "Valid - minimum (-128)",
"data": -128,
"valid": true
},
{
"description": "Valid - arbitrary positive",
"data": 42,
"valid": true
},
{
"description": "Valid - arbitrary negative",
"data": -99,
"valid": true
},
{
"description": "Invalid: too large (128)",
"data": 128,
"valid": false
},
{
"description": "Invalid: too small (-129)",
"data": -129,
"valid": false
},
{
"description": "Invalid: much too large",
"data": 1000,
"valid": false
},
{
"description": "Invalid: decimal number",
"data": 1.5,
"valid": false
},
{
"description": "Invalid: string",
"data": "42",
"valid": false
},
{
"description": "Invalid: boolean",
"data": true,
"valid": false
},
{
"description": "Invalid: null",
"data": null,
"valid": false
}
]
}
Loading