Skip to content

Commit bceb815

Browse files
committed
feat(schemas): add JSON Schema 2020-12 schemas to repo
* add constraint for `update` scenario' -m 'rename version folder' * update `$id` with the official release date * add `$comment` for each section closes #71
1 parent d029f0d commit bceb815

File tree

2 files changed

+210
-0
lines changed

2 files changed

+210
-0
lines changed

schemas/v1.0/schema.json

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

schemas/v1.0/schema.yaml

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

0 commit comments

Comments
 (0)