-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfail-requestBody-anyof-with-schema.js.txt
103 lines (103 loc) · 2.15 KB
/
fail-requestBody-anyof-with-schema.js.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
module.exports = {
validateArgs: {
"paths": {
"/pets": {
"patch": {
"requestBody": {
"content": {
"application/json": {
"schema": {
"anyOf": [
{
"$ref": "#/components/schemas/PetByAge"
},
{
"$ref": "#/components/schemas/PetByType"
}
]
}
}
}
},
"responses": {
"200": {
"description": "Updated"
}
}
}
}
},
"components": {
"schemas": {
"PetByAge": {
"type": "object",
"additionalProperties": true,
"properties": {
"age": {
"type": "integer"
},
"nickname": {
"type": "string"
}
},
"required": [
"age"
]
},
"PetByType": {
"type": "object",
"additionalProperties": true,
"properties": {
"pet_type": {
"type": "string",
"enum": [
"Cat",
"Dog"
]
},
"hunts": {
"type": "boolean"
}
},
"required": [
"pet_type"
]
}
}
}
},
request: {
body: {
"nickname": "Mr. Paws",
"hunts": false
},
},
expectedErrors: [
{
"code": "Validation-required",
"source": {
"parameter": "age",
"pointer": "#/components/schemas/PetByAge/required",
},
"status": 400,
"title": "must have required property 'age'",
},
{
"code": "Validation-required",
"source": {
"parameter": "pet_type",
"pointer": "#/components/schemas/PetByType/required",
},
"status": 400,
"title": "must have required property 'pet_type'",
},
{
"code": "Validation-anyOf",
"source": {
"pointer": "#/anyOf",
},
"status": 400,
"title": "must match a schema in anyOf",
},
]
};