Skip to content

Commit d3d571b

Browse files
authored
Simplify not checks on duration designator schemas (#86)
Signed-off-by: Juan Cruz Viotti <[email protected]>
1 parent a042267 commit d3d571b

File tree

2 files changed

+8
-36
lines changed

2 files changed

+8
-36
lines changed

schemas/2020-12/iso/datetime/2019/duration/designator-extension.json

Lines changed: 4 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -15,28 +15,6 @@
1515
"x-license": "https://github.com/sourcemeta/std/blob/main/LICENSE",
1616
"x-links": [ "https://www.iso.org/standard/70908.html" ],
1717
"type": "string",
18-
"allOf": [
19-
{
20-
"not": {
21-
"const": "P"
22-
}
23-
},
24-
{
25-
"not": {
26-
"const": "PT"
27-
}
28-
},
29-
{
30-
"not": {
31-
"const": "-P"
32-
}
33-
},
34-
{
35-
"not": {
36-
"const": "-PT"
37-
}
38-
}
39-
],
4018
"anyOf": [
4119
{
4220
"$comment": "Positive: Date-only: Years with decimal (lowest order)",
@@ -422,5 +400,8 @@
422400
"$comment": "Negative: Date+Time: Days + Seconds with decimal (lowest order)",
423401
"pattern": "^-P[0-9]+DT[0-9]+(?:\\.[0-9]+)?S$"
424402
}
425-
]
403+
],
404+
"not": {
405+
"enum": [ "P", "PT", "-P", "-PT" ]
406+
}
426407
}

schemas/2020-12/iso/datetime/2019/duration/designator.json

Lines changed: 4 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -14,18 +14,6 @@
1414
"x-license": "https://github.com/sourcemeta/std/blob/main/LICENSE",
1515
"x-links": [ "https://www.iso.org/standard/70907.html" ],
1616
"type": "string",
17-
"allOf": [
18-
{
19-
"not": {
20-
"const": "P"
21-
}
22-
},
23-
{
24-
"not": {
25-
"const": "PT"
26-
}
27-
}
28-
],
2917
"anyOf": [
3018
{
3119
"$comment": "Date-only: Years with decimal (lowest order)",
@@ -219,5 +207,8 @@
219207
"$comment": "Date+Time: Days + Seconds with decimal (lowest order)",
220208
"pattern": "^P[0-9]+DT[0-9]+(?:\\.[0-9]+)?S$"
221209
}
222-
]
210+
],
211+
"not": {
212+
"enum": [ "P", "PT" ]
213+
}
223214
}

0 commit comments

Comments
 (0)