Skip to content

Commit a56fe04

Browse files
authored
Finish encoding most derived XML Schema 2001 data types (#46)
Signed-off-by: Juan Cruz Viotti <jv@jviotti.com>
1 parent ae6d094 commit a56fe04

33 files changed

Lines changed: 2248 additions & 0 deletions
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"$schema": "https://json-schema.org/draft/2020-12/schema",
3+
"title": "W3C XML Schema byte",
4+
"description": "Represents 8-bit signed integers (§3.3.19)",
5+
"examples": [ 0, 1, -1, 127, -128, 42, -99 ],
6+
"x-license": "https://github.com/sourcemeta/std/blob/main/LICENSE",
7+
"x-links": [ "https://www.w3.org/TR/xmlschema-2/#byte" ],
8+
"$ref": "../../../iso/c/2024/int8.json"
9+
}

schemas/w3c/xmlschema/2001/decimal.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
"$schema": "https://json-schema.org/draft/2020-12/schema",
33
"title": "W3C XML Schema decimal",
44
"description": "The decimal datatype represents arbitrary precision decimal numbers (§3.2.3)",
5+
"$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",
56
"examples": [
67
"-1.23",
78
"12678967.543233",
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"$schema": "https://json-schema.org/draft/2020-12/schema",
3+
"title": "W3C XML Schema int",
4+
"description": "Represents 32-bit signed integers (§3.3.17)",
5+
"examples": [ 0, 1, -1, 2147483647, -2147483648, 42, -999 ],
6+
"x-license": "https://github.com/sourcemeta/std/blob/main/LICENSE",
7+
"x-links": [ "https://www.w3.org/TR/xmlschema-2/#int" ],
8+
"$ref": "../../../iso/c/2024/int32.json"
9+
}
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
{
2+
"$schema": "https://json-schema.org/draft/2020-12/schema",
3+
"title": "W3C XML Schema integer",
4+
"description": "Represents arbitrary-sized integers derived from decimal (§3.3.13)",
5+
"$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",
6+
"examples": [
7+
"0",
8+
"1",
9+
"-1",
10+
"42",
11+
"-273",
12+
"12678967543233",
13+
"-9999999999999999",
14+
"999999999999999999999999999999"
15+
],
16+
"x-license": "https://github.com/sourcemeta/std/blob/main/LICENSE",
17+
"x-links": [ "https://www.w3.org/TR/xmlschema-2/#integer" ],
18+
"type": "string",
19+
"pattern": "^[+-]?(0|[1-9][0-9]*)$"
20+
}
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
{
2+
"$schema": "https://json-schema.org/draft/2020-12/schema",
3+
"title": "W3C XML Schema language",
4+
"description": "Represents natural language identifiers as defined by RFC 3066 (§3.3.3)",
5+
"examples": [ "en", "en-US", "fr-FR", "de-DE", "ja", "zh-CN" ],
6+
"x-license": "https://github.com/sourcemeta/std/blob/main/LICENSE",
7+
"x-links": [
8+
"https://www.w3.org/TR/xmlschema-2/#language",
9+
"https://www.rfc-editor.org/rfc/rfc3066.html"
10+
],
11+
"$ref": "../../../ietf/language/3066/tag-syntax.json"
12+
}
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
{
2+
"$schema": "https://json-schema.org/draft/2020-12/schema",
3+
"title": "W3C XML Schema long",
4+
"description": "Represents 64-bit signed integers (§3.3.16)",
5+
"examples": [
6+
0,
7+
1,
8+
-1,
9+
9223372036854775807,
10+
-9223372036854775808,
11+
1000000000,
12+
-1000000000
13+
],
14+
"x-license": "https://github.com/sourcemeta/std/blob/main/LICENSE",
15+
"x-links": [ "https://www.w3.org/TR/xmlschema-2/#long" ],
16+
"$ref": "../../../iso/c/2024/int64.json"
17+
}
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
{
2+
"$schema": "https://json-schema.org/draft/2020-12/schema",
3+
"title": "W3C XML Schema negativeInteger",
4+
"description": "Represents strictly negative integers (§3.3.15)",
5+
"$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",
6+
"examples": [
7+
"-1",
8+
"-42",
9+
"-1000",
10+
"-9223372036854775808",
11+
"-999999999999999999999999999999"
12+
],
13+
"x-license": "https://github.com/sourcemeta/std/blob/main/LICENSE",
14+
"x-links": [ "https://www.w3.org/TR/xmlschema-2/#negativeInteger" ],
15+
"type": "string",
16+
"pattern": "^-[1-9][0-9]*$"
17+
}
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
{
2+
"$schema": "https://json-schema.org/draft/2020-12/schema",
3+
"title": "W3C XML Schema nonNegativeInteger",
4+
"description": "Represents integers greater than or equal to zero (§3.3.20)",
5+
"$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",
6+
"examples": [
7+
"0",
8+
"1",
9+
"42",
10+
"1000",
11+
"9223372036854775807",
12+
"999999999999999999999999999999"
13+
],
14+
"x-license": "https://github.com/sourcemeta/std/blob/main/LICENSE",
15+
"x-links": [ "https://www.w3.org/TR/xmlschema-2/#nonNegativeInteger" ],
16+
"type": "string",
17+
"pattern": "^(0|[1-9][0-9]*)$"
18+
}
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
{
2+
"$schema": "https://json-schema.org/draft/2020-12/schema",
3+
"title": "W3C XML Schema nonPositiveInteger",
4+
"description": "Represents integers less than or equal to zero (§3.3.14)",
5+
"$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",
6+
"examples": [
7+
"0",
8+
"-1",
9+
"-42",
10+
"-1000",
11+
"-9223372036854775808",
12+
"-999999999999999999999999999999"
13+
],
14+
"x-license": "https://github.com/sourcemeta/std/blob/main/LICENSE",
15+
"x-links": [ "https://www.w3.org/TR/xmlschema-2/#nonPositiveInteger" ],
16+
"type": "string",
17+
"pattern": "^(0|-[1-9][0-9]*)$"
18+
}
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
{
2+
"$schema": "https://json-schema.org/draft/2020-12/schema",
3+
"title": "W3C XML Schema normalizedString",
4+
"description": "Represents white space normalized strings (§3.3.1)",
5+
"examples": [
6+
"This is a normalized string",
7+
"Multiple spaces are allowed",
8+
"Leading and trailing spaces are allowed ",
9+
" Also leading spaces",
10+
"",
11+
"Unicode: 你好世界",
12+
"Special chars: @#$%^&*()"
13+
],
14+
"x-license": "https://github.com/sourcemeta/std/blob/main/LICENSE",
15+
"x-links": [ "https://www.w3.org/TR/xmlschema-2/#normalizedString" ],
16+
"$ref": "string.json",
17+
"not": {
18+
"$comment": "Carriage return (#xD), line feed (#xA), and tab (#x9) are not allowed",
19+
"pattern": "[\\r\\n\\t]"
20+
}
21+
}

0 commit comments

Comments
 (0)