...
1---
2swagger: "2.0"
3info:
4 version: "0.1.0"
5 title: referenced validation
6paths:
7 /:
8 get:
9 parameters:
10 - $ref: "#/parameters/rateLimit"
11 - $ref: "#/parameters/requiredPatternProps"
12 responses:
13 default:
14 description: the record
15 schema:
16 $ref: "#/definitions/record"
17 404:
18 $ref: "#/responses/notFound"
19 403:
20 $ref: "#/responses/wrongMe"
21 /greatAgain:
22 get:
23 parameters:
24 - $ref: "#/parameters/rateLimit"
25 - $ref: "#/parameters/requiredPatternItems"
26 responses:
27 default:
28 description: the record
29 schema:
30 $ref: "#/definitions/record"
31 404:
32 $ref: "#/responses/notFound"
33 403:
34 $ref: "#/responses/despicableMeItems"
35
36parameters:
37 rateLimit:
38 name: X-Rate-Limit
39 in: header
40 type: integer #<--- try error with $ref in header
41 format: int32
42 requiredPatternProps:
43 name: badPattern
44 in: body
45 schema:
46 $ref: '#/definitions/record' #<--- patternProperties in parameters
47 requiredPatternItems:
48 name: badPatternInItems
49 in: body
50 schema:
51 type: array
52 items:
53 $ref: '#/definitions/lotOfErrors2' #<--- patternProperties in parameters
54
55responses:
56 notFound:
57 description: Not found
58 schema:
59 $ref: "#/definitions/record"
60 wrongMe:
61 description: wrong me
62 schema:
63 $ref: "#/definitions/lotOfErrors"
64 despicableMeItems:
65 description: despicable me
66 schema:
67 type: array
68 items:
69 $ref: "#/definitions/lotOfErrors2"
70
71definitions:
72 record:
73 type: object
74 additionalProperties: true
75 required: [ createdAt, oneMore ]
76 properties:
77 createdAt:
78 type: string
79 format: date-time
80 lotOfErrors:
81 type: object
82 required: [ a, b-1, x, z-1, bug ]
83 properties:
84 a:
85 type: integer
86 format: int32
87 readOnly: true #<--- warning
88 default: 3
89 example: 5
90 additionalProperties:
91 #type: object
92 properties:
93 x:
94 type: integer
95 z:
96 type: integer
97 additionalProperties: false
98 patternProperties: #<-- unsupported: patternProperties in schema
99 '^z-.*$':
100 type: integer
101 format: int32
102 readOnly: true #<-- warning
103 default: 3
104 example: 5
105 patternProperties: #<-- unsupported: patternProperties in schema
106 '^b-.*$':
107 type: integer
108 format: int32
109 default: 3
110 example: 5
111 '^)b-InvalidRegexp1.(*$': #<-- invalid regexp
112 type: integer
113 format: int32
114 default: 3
115 example: 5
116 lotOfErrors2: #<-- note the missing type to declare in items
117 required: [ a , b-8]
118 properties:
119 a:
120 type: integer
121 format: int32
122 default: 3
123 example: 5
124 patternProperties: #<-- unsupported: patternProperties in schema
125 '^b-.*$':
126 type: integer
127 format: int32
128 readOnly: true #<--- warning
129 default: 3
130 example: 5
131 '^)b-InvalidRegexp2.(*$': #<-- invalid regexp
132 type: integer
133 format: int32
134 default: 3
135 example: 5
View as plain text