Skip to content

Commit 3111890

Browse files
committed
feat(test): add schema tests and schema
1 parent 413fe0d commit 3111890

20 files changed

+153
-3
lines changed

schemas/v1.0/schema.yaml

Lines changed: 70 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,73 @@
11
$id: https://spec.openapis.org/overlay/1.0/schema/WORK-IN-PROGRESS
22
$schema: https://json-schema.org/draft/2020-12/schema
33
description: The description of Overlay v1.0.x documents
4-
5-
type: object
4+
properties:
5+
overlay:
6+
type: string
7+
pattern: ^1\.0\.\d+(-.+)?$
8+
info:
9+
$ref: "#/$defs/info-object"
10+
extends:
11+
type: string
12+
format: uri-reference
13+
actions:
14+
type: array
15+
minItems: 1
16+
uniqueItems: true
17+
items:
18+
$ref: "#/$defs/action-object"
19+
required:
20+
- overlay
21+
- info
22+
- actions
23+
$ref: "#/$defs/specification-extensions"
24+
unevaluatedProperties: false
25+
$defs:
26+
info-object:
27+
type: object
28+
properties:
29+
title:
30+
type: string
31+
version:
32+
type: string
33+
required:
34+
- title
35+
- version
36+
$ref: "#/$defs/specification-extensions"
37+
unevaluatedProperties: false
38+
action-object:
39+
properties:
40+
target:
41+
type: string
42+
pattern: ^\$[.\[]?.*$
43+
description:
44+
type: string
45+
update:
46+
type:
47+
- string
48+
- boolean
49+
- object
50+
- array
51+
- number
52+
- "null"
53+
remove:
54+
type: boolean
55+
default: false
56+
allOf:
57+
if:
58+
properties:
59+
remove:
60+
const: true
61+
required:
62+
- remove
63+
then:
64+
not:
65+
required:
66+
- update
67+
required:
68+
- target
69+
$ref: "#/$defs/specification-extensions"
70+
unevaluatedProperties: false
71+
specification-extensions:
72+
patternProperties:
73+
^x-: true
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
overlay: 1.0.0
2+
info:
3+
title: Invalid `target`, must begin with `$`
4+
version: 1.0.0
5+
actions:
6+
- target: info.description
7+
update: An updated description
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
overlay: 1.0.0
2+
info:
3+
title: Minimal actions
4+
version: 1.0.0
5+
actions: []
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
overlay: 1.0.0
2+
info:
3+
title: Missing actions `target`
4+
version: 1.0.0
5+
actions:
6+
- update: my description
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
overlay: 1.0.0
2+
info:
3+
title: Missing `actions`
4+
version: 1.0.0
5+
extends: '/openapi.yaml'
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
overlay: 1.0.0
2+
info:
3+
title: No `update` with `remove`
4+
version: 1.0.0
5+
actions:
6+
- target: $.info
7+
update:
8+
description: An updated description
9+
remove: true
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
overlay: 1.0.0
2+
info:
3+
title: Actions not unique
4+
version: 1.0.0
5+
actions:
6+
- target: '$.info.title'
7+
update: 'My New title'
8+
- target: '$.info.title'
9+
update: 'My New title'
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
overlay: 1.0.0
2+
info:
3+
title: Invalid `extends` type
4+
version: 1.0.0
5+
extends: {}
6+
actions: []
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
overlay: 1.0.0
2+
info:
3+
version: 1.0.0
4+
actions: []
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
overlay: 1.0.0
2+
info:
3+
title: Missing Info version
4+
actions: []

0 commit comments

Comments
 (0)