Skip to content

Commit 8e3e22d

Browse files
committed
feat(schemas): add JSON Schema 2020-12 schemas to repo
* add constraint for `update` scenario' -m 'rename version folder' closes #71
1 parent d029f0d commit 8e3e22d

File tree

2 files changed

+214
-0
lines changed

2 files changed

+214
-0
lines changed

schemas/v1.0/schema.json

+115
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,115 @@
1+
{
2+
"$id": "https://spec.openapis.org/overlay/1.0/schema/2024-10-08",
3+
"$schema": "https://json-schema.org/draft/2020-12/schema",
4+
"description": "The description of OpenAPI Initiative Overlay v1.0.0 documents without schema validation, as defined by https://spec.openapis.org/overlay/v1.0.0",
5+
"type": "object",
6+
"properties": {
7+
"overlay": {
8+
"description": "The version number of the Overlay Specification",
9+
"type": "string",
10+
"pattern": "^1\\.0\\.\\d+(-.+)?$"
11+
},
12+
"info": {
13+
"$ref": "#/$defs/info-object"
14+
},
15+
"extends": {
16+
"type": "string",
17+
"format": "uri-reference"
18+
},
19+
"actions": {
20+
"type": "array",
21+
"minItems": 1,
22+
"uniqueItems": true,
23+
"items": {
24+
"$ref": "#/$defs/action-object"
25+
}
26+
}
27+
},
28+
"required": [
29+
"overlay",
30+
"info",
31+
"actions"
32+
],
33+
"$ref": "#/$defs/specification-extensions",
34+
"unevaluatedProperties": false,
35+
"$defs": {
36+
"info-object": {
37+
"$comment": "https://spec.openapis.org/overlay/v1.0.0#info-object",
38+
"description": "Provides metadata about the Overlay description",
39+
"type": "object",
40+
"properties": {
41+
"title": {
42+
"description": "A human readable title of the Overlay Description",
43+
"type": "string"
44+
},
45+
"version": {
46+
"description": "The version identifier of the Overlay document (which is distinct from the Overlay Specification version)",
47+
"type": "string"
48+
}
49+
},
50+
"required": [
51+
"title",
52+
"version"
53+
],
54+
"$ref": "#/$defs/specification-extensions",
55+
"unevaluatedProperties": false
56+
},
57+
"action-object": {
58+
"description": "This object represents one or more changes to be applied to the target document at the location defined by the target JSONPath expression.",
59+
"properties": {
60+
"target": {
61+
"description": "A JSONPath expression selecting nodes in the target document",
62+
"type": "string",
63+
"pattern": "^\\$[.\\[].+$"
64+
},
65+
"description": {
66+
"description": "A description of the action. [[CommonMark]] syntax MAY be used for rich text representation.",
67+
"type": "string"
68+
},
69+
"update": {
70+
"description": "If the target selects an object node, the value of this field MUST be an object with the properties and values to merge with the node. If the target selects an array, the value of this field MUST be an entry to append to the array.",
71+
"type": [
72+
"string",
73+
"boolean",
74+
"object",
75+
"array",
76+
"number",
77+
"null"
78+
]
79+
},
80+
"remove": {
81+
"description": "A boolean value that indicates that the target object is to be removed from the the map or array it is contained in",
82+
"type": "boolean",
83+
"default": false
84+
}
85+
},
86+
"allOf": [
87+
{
88+
"description": "The `update` field has no impact if the `remove` field of this action object is true.",
89+
"if": {
90+
"properties": {
91+
"remove": {"const": true}
92+
},
93+
"required": ["remove"]
94+
},
95+
"then": {
96+
"not": {
97+
"required": ["update"]
98+
}
99+
}
100+
}
101+
],
102+
"required": ["target"],
103+
"$ref": "#/$defs/specification-extensions",
104+
"unevaluatedProperties": false
105+
},
106+
"specification-extensions": {
107+
"$comment": "https://spec.openapis.org/overlay/v1.0.0#specification-extensions",
108+
"description": "While the Overlay Specification tries to accommodate most use cases, additional data can be added to extend the specification at certain points",
109+
"patternProperties": {
110+
"^x-": true
111+
}
112+
}
113+
}
114+
}
115+

schemas/v1.0/schema.yaml

+99
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,99 @@
1+
$id: https://spec.openapis.org/overlay/1.0/schema/2024-10-08
2+
$schema: https://json-schema.org/draft/2020-12/schema
3+
description: The description of OpenAPI Initiative Overlay v1.0.0 documents
4+
without schema validation, as defined by
5+
https://spec.openapis.org/overlay/v1.0.0
6+
type: object
7+
properties:
8+
overlay:
9+
description: The version number of the Overlay Specification
10+
type: string
11+
pattern: ^1\.0\.\d+(-.+)?$
12+
info:
13+
$ref: "#/$defs/info-object"
14+
extends:
15+
type: string
16+
format: uri-reference
17+
actions:
18+
type: array
19+
minItems: 1
20+
uniqueItems: true
21+
items:
22+
$ref: "#/$defs/action-object"
23+
required:
24+
- overlay
25+
- info
26+
- actions
27+
$ref: "#/$defs/specification-extensions"
28+
unevaluatedProperties: false
29+
$defs:
30+
info-object:
31+
$comment: https://spec.openapis.org/overlay/v1.0.0#info-object
32+
description: Provides metadata about the Overlay description
33+
type: object
34+
properties:
35+
title:
36+
description: A human readable title of the Overlay Description
37+
type: string
38+
version:
39+
description: The version identifier of the Overlay document (which is distinct
40+
from the Overlay Specification version)
41+
type: string
42+
required:
43+
- title
44+
- version
45+
$ref: "#/$defs/specification-extensions"
46+
unevaluatedProperties: false
47+
action-object:
48+
description: This object represents one or more changes to be applied to the
49+
target document at the location defined by the target JSONPath expression.
50+
properties:
51+
target:
52+
description: A JSONPath expression selecting nodes in the target document
53+
type: string
54+
pattern: ^\$[.\[].+$
55+
description:
56+
description: A description of the action. [[CommonMark]] syntax MAY be used for
57+
rich text representation.
58+
type: string
59+
update:
60+
description: If the target selects an object node, the value of this field
61+
MUST be an object with the properties and values to merge with the
62+
node. If the target selects an array, the value of this field MUST
63+
be an entry to append to the array.
64+
type:
65+
- string
66+
- boolean
67+
- object
68+
- array
69+
- number
70+
- "null"
71+
remove:
72+
description: A boolean value that indicates that the target object is to be
73+
removed from the the map or array it is contained in
74+
type: boolean
75+
default: false
76+
allOf:
77+
- description: The `update` field has no impact if the `remove` field of this
78+
action object is true.
79+
if:
80+
properties:
81+
remove:
82+
const: true
83+
required:
84+
- remove
85+
then:
86+
not:
87+
required:
88+
- update
89+
required:
90+
- target
91+
$ref: "#/$defs/specification-extensions"
92+
unevaluatedProperties: false
93+
specification-extensions:
94+
$comment: https://spec.openapis.org/overlay/v1.0.0#specification-extensions
95+
description: While the Overlay Specification tries to accommodate most use
96+
cases, additional data can be added to extend the specification at certain
97+
points
98+
patternProperties:
99+
^x-: true

0 commit comments

Comments
 (0)