@redocly/openapi-core 1.2.1 → 1.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +13 -0
- package/lib/benchmark/benches/lint-with-many-rules.bench.js +4 -4
- package/lib/benchmark/benches/lint-with-nested-rule.bench.js +4 -4
- package/lib/benchmark/benches/lint-with-no-rules.bench.js +4 -4
- package/lib/benchmark/benches/lint-with-top-level-rule-report.bench.js +4 -4
- package/lib/benchmark/benches/lint-with-top-level-rule.bench.js +4 -4
- package/lib/benchmark/benches/recommended-oas3.bench.js +4 -4
- package/lib/benchmark/benches/resolve-with-no-external.bench.js +3 -3
- package/lib/benchmark/utils.js +3 -3
- package/lib/bundle.d.ts +4 -4
- package/lib/bundle.js +23 -23
- package/lib/config/all.d.ts +2 -2
- package/lib/config/all.js +44 -8
- package/lib/config/builtIn.js +2 -0
- package/lib/config/config-resolvers.js +25 -25
- package/lib/config/config.js +9 -9
- package/lib/config/index.js +5 -1
- package/lib/config/load.d.ts +1 -1
- package/lib/config/load.js +9 -6
- package/lib/config/minimal.d.ts +2 -2
- package/lib/config/minimal.js +34 -3
- package/lib/config/recommended-strict.d.ts +3 -0
- package/lib/config/recommended-strict.js +92 -0
- package/lib/config/recommended.d.ts +2 -2
- package/lib/config/recommended.js +34 -3
- package/lib/config/rules.d.ts +1 -1
- package/lib/config/types.d.ts +47 -46
- package/lib/config/types.js +2 -2
- package/lib/config/utils.d.ts +2 -0
- package/lib/config/utils.js +30 -15
- package/lib/decorators/common/filters/filter-helper.js +4 -4
- package/lib/decorators/common/filters/filter-in.js +2 -2
- package/lib/decorators/common/filters/filter-out.js +2 -2
- package/lib/decorators/common/info-description-override.js +1 -1
- package/lib/decorators/common/media-type-examples-override.js +3 -3
- package/lib/decorators/common/operation-description-override.js +1 -1
- package/lib/decorators/common/registry-dependencies.js +1 -1
- package/lib/decorators/common/remove-x-internal.js +4 -4
- package/lib/decorators/common/tag-description-override.js +1 -1
- package/lib/format/codeframes.d.ts +6 -6
- package/lib/format/format.d.ts +2 -2
- package/lib/format/format.js +12 -12
- package/lib/js-yaml/index.d.ts +2 -2
- package/lib/js-yaml/index.js +2 -2
- package/lib/lint.js +18 -18
- package/lib/oas-types.d.ts +12 -10
- package/lib/oas-types.js +2 -2
- package/lib/redocly/index.js +10 -10
- package/lib/redocly/registry-api.js +2 -2
- package/lib/resolve.d.ts +4 -4
- package/lib/resolve.js +18 -18
- package/lib/rules/ajv.js +1 -1
- package/lib/rules/async2/index.d.ts +2 -11
- package/lib/rules/common/assertions/asserts.d.ts +3 -3
- package/lib/rules/common/assertions/asserts.js +21 -21
- package/lib/rules/common/assertions/index.d.ts +4 -4
- package/lib/rules/common/assertions/index.js +3 -3
- package/lib/rules/common/assertions/utils.d.ts +4 -4
- package/lib/rules/common/assertions/utils.js +3 -3
- package/lib/rules/common/info-contact.js +1 -1
- package/lib/rules/common/info-license-url.js +1 -1
- package/lib/rules/common/info-license.js +1 -1
- package/lib/rules/common/no-enum-type-mismatch.js +3 -3
- package/lib/rules/common/no-http-verbs-in-paths.js +2 -2
- package/lib/rules/common/no-invalid-parameter-examples.js +3 -3
- package/lib/rules/common/no-invalid-schema-examples.js +3 -3
- package/lib/rules/common/operation-2xx-response.js +2 -2
- package/lib/rules/common/operation-4xx-response.js +2 -2
- package/lib/rules/common/operation-description.js +1 -1
- package/lib/rules/common/operation-operationId.js +1 -1
- package/lib/rules/common/operation-summary.js +1 -1
- package/lib/rules/common/path-segment-plural.js +1 -1
- package/lib/rules/common/response-contains-header.js +2 -2
- package/lib/rules/common/spec-strict-refs.js +1 -1
- package/lib/rules/common/spec.js +11 -11
- package/lib/rules/common/tag-description.js +1 -1
- package/lib/rules/oas2/boolean-parameter-prefixes.d.ts +1 -1
- package/lib/rules/oas2/index.d.ts +2 -46
- package/lib/rules/oas2/remove-unused-components.js +1 -1
- package/lib/rules/oas2/request-mime-type.js +2 -2
- package/lib/rules/oas2/response-contains-property.js +2 -2
- package/lib/rules/oas2/response-mime-type.js +2 -2
- package/lib/rules/oas3/boolean-parameter-prefixes.d.ts +1 -1
- package/lib/rules/oas3/index.d.ts +1 -1
- package/lib/rules/oas3/index.js +1 -1
- package/lib/rules/oas3/no-invalid-media-type-examples.js +3 -3
- package/lib/rules/oas3/operation-4xx-problem-details-rfc7807.js +3 -3
- package/lib/rules/oas3/remove-unused-components.js +2 -2
- package/lib/rules/oas3/request-mime-type.js +3 -3
- package/lib/rules/oas3/response-contains-property.js +2 -2
- package/lib/rules/oas3/response-mime-type.js +3 -3
- package/lib/rules/utils.js +3 -3
- package/lib/types/asyncapi.js +21 -21
- package/lib/types/index.d.ts +8 -8
- package/lib/types/oas2.js +14 -14
- package/lib/types/oas3.js +27 -27
- package/lib/types/oas3_1.js +6 -6
- package/lib/types/redocly-yaml.d.ts +11 -0
- package/lib/types/redocly-yaml.js +71 -53
- package/lib/types/theme-config.js +1 -1
- package/lib/typings/common.d.ts +2 -2
- package/lib/typings/openapi.d.ts +6 -6
- package/lib/typings/swagger.d.ts +3 -3
- package/lib/utils.d.ts +5 -5
- package/lib/utils.js +3 -3
- package/lib/visitors.d.ts +40 -40
- package/lib/walk.d.ts +14 -15
- package/lib/walk.js +11 -11
- package/package.json +2 -2
- package/src/__tests__/lint.test.ts +40 -40
- package/src/__tests__/normalizeVisitors.test.ts +23 -5
- package/src/__tests__/ref-utils.test.ts +7 -7
- package/src/__tests__/resolve-http.test.ts +10 -10
- package/src/__tests__/resolve.test.ts +39 -39
- package/src/__tests__/walk.test.ts +48 -48
- package/src/config/__tests__/__snapshots__/config-resolvers.test.ts.snap +95 -32
- package/src/config/__tests__/__snapshots__/config.test.ts.snap +81 -81
- package/src/config/__tests__/config-resolvers.test.ts +30 -1
- package/src/config/__tests__/config.test.ts +88 -88
- package/src/config/__tests__/load.test.ts +12 -8
- package/src/config/__tests__/utils.test.ts +18 -18
- package/src/config/all.ts +46 -9
- package/src/config/builtIn.ts +2 -0
- package/src/config/load.ts +4 -1
- package/src/config/minimal.ts +36 -4
- package/src/config/recommended-strict.ts +93 -0
- package/src/config/recommended.ts +36 -4
- package/src/config/types.ts +22 -8
- package/src/config/utils.ts +17 -0
- package/src/decorators/common/media-type-examples-override.ts +2 -2
- package/src/lint.ts +3 -3
- package/src/oas-types.ts +26 -3
- package/src/rules/__tests__/no-unresolved-refs.test.ts +26 -26
- package/src/rules/async2/__tests__/channels-kebab-case.test.ts +12 -12
- package/src/rules/async2/__tests__/no-channel-trailing-slash.test.ts +7 -7
- package/src/rules/async2/index.ts +2 -1
- package/src/rules/common/__tests__/info-license.test.ts +6 -6
- package/src/rules/common/__tests__/license-url.test.ts +6 -6
- package/src/rules/common/__tests__/no-ambiguous-paths.test.ts +13 -13
- package/src/rules/common/__tests__/no-enum-type-mismatch.test.ts +18 -18
- package/src/rules/common/__tests__/no-identical-paths.test.ts +5 -5
- package/src/rules/common/__tests__/no-path-trailing-slash.test.ts +12 -12
- package/src/rules/common/__tests__/operation-2xx-response.test.ts +18 -18
- package/src/rules/common/__tests__/operation-4xx-response.test.ts +23 -23
- package/src/rules/common/__tests__/operation-operationId-unique.test.ts +6 -6
- package/src/rules/common/__tests__/operation-operationId-url-safe.test.ts +5 -5
- package/src/rules/common/__tests__/operation-parameters-unique.test.ts +16 -16
- package/src/rules/common/__tests__/operation-singular-tag.test.ts +6 -6
- package/src/rules/common/__tests__/path-http-verbs-order.test.ts +10 -10
- package/src/rules/common/__tests__/path-not-include-query.test.ts +6 -6
- package/src/rules/common/__tests__/path-params-defined.test.ts +21 -21
- package/src/rules/common/__tests__/paths-kebab-case.test.ts +11 -11
- package/src/rules/common/__tests__/scalar-property-missing-example.test.ts +18 -18
- package/src/rules/common/__tests__/security-defined.test.ts +21 -21
- package/src/rules/common/__tests__/spec-strict-refs.test.ts +9 -9
- package/src/rules/common/__tests__/spec.test.ts +102 -102
- package/src/rules/common/__tests__/tag-description.test.ts +6 -6
- package/src/rules/common/__tests__/tags-alphabetical.test.ts +12 -12
- package/src/rules/common/assertions/__tests__/index.test.ts +15 -15
- package/src/rules/common/assertions/__tests__/utils.test.ts +9 -9
- package/src/rules/oas2/__tests__/boolean-parameter-prefixes.test.ts +7 -7
- package/src/rules/oas2/__tests__/response-contains-header.test.ts +13 -13
- package/src/rules/oas2/__tests__/response-contains-property.test.ts +8 -8
- package/src/rules/oas2/__tests__/spec/info.test.ts +21 -21
- package/src/rules/oas2/__tests__/spec/operation.test.ts +4 -4
- package/src/rules/oas2/__tests__/spec/paths.test.ts +12 -12
- package/src/rules/oas2/__tests__/spec/referenceableScalars.test.ts +1 -1
- package/src/rules/oas2/index.ts +3 -1
- package/src/rules/oas3/__tests__/boolean-parameter-prefixes.test.ts +7 -7
- package/src/rules/oas3/__tests__/component-name-unique.test.ts +186 -186
- package/src/rules/oas3/__tests__/no-empty-enum-servers.com.test.ts +18 -18
- package/src/rules/oas3/__tests__/no-example-value-and-externalValue.test.ts +6 -6
- package/src/rules/oas3/__tests__/no-invalid-media-type-examples.test.ts +36 -36
- package/src/rules/oas3/__tests__/no-server-example.com.test.ts +11 -11
- package/src/rules/oas3/__tests__/no-server-trailing-slash.test.ts +7 -7
- package/src/rules/oas3/__tests__/no-unused-components.test.ts +31 -31
- package/src/rules/oas3/__tests__/operation-4xx-problem-details-rfc7807.test.ts +15 -15
- package/src/rules/oas3/__tests__/response-contains-header.test.ts +26 -26
- package/src/rules/oas3/__tests__/response-contains-property.test.ts +27 -27
- package/src/rules/oas3/__tests__/spec/callbacks.test.ts +1 -1
- package/src/rules/oas3/__tests__/spec/info.test.ts +21 -21
- package/src/rules/oas3/__tests__/spec/operation.test.ts +10 -10
- package/src/rules/oas3/__tests__/spec/paths.test.ts +13 -13
- package/src/rules/oas3/__tests__/spec/referenceableScalars.test.ts +2 -2
- package/src/rules/oas3/__tests__/spec/servers.test.ts +25 -25
- package/src/rules/oas3/__tests__/spec/spec.test.ts +56 -56
- package/src/rules/oas3/__tests__/spec-components-invalid-map-name.test.ts +28 -28
- package/src/rules/oas3/index.ts +3 -3
- package/src/types/redocly-yaml.ts +75 -40
- package/src/visitors.ts +3 -3
- package/src/walk.ts +23 -10
- package/tsconfig.tsbuildinfo +1 -1
|
@@ -34,10 +34,10 @@ describe('Oas3 response-contains-property', () => {
|
|
|
34
34
|
}),
|
|
35
35
|
});
|
|
36
36
|
expect(results).toMatchInlineSnapshot(`
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
"location":
|
|
40
|
-
|
|
37
|
+
[
|
|
38
|
+
{
|
|
39
|
+
"location": [
|
|
40
|
+
{
|
|
41
41
|
"pointer": "#/paths/~1store~1subscribe/post/responses/201/content/application~1json/schema/properties",
|
|
42
42
|
"reportOnKey": true,
|
|
43
43
|
"source": Source {
|
|
@@ -62,10 +62,10 @@ describe('Oas3 response-contains-property', () => {
|
|
|
62
62
|
},
|
|
63
63
|
},
|
|
64
64
|
],
|
|
65
|
-
"message": "Response object must contain a top-level
|
|
65
|
+
"message": "Response object must contain a top-level "id" property.",
|
|
66
66
|
"ruleId": "response-contains-property",
|
|
67
67
|
"severity": "error",
|
|
68
|
-
"suggest":
|
|
68
|
+
"suggest": [],
|
|
69
69
|
},
|
|
70
70
|
]
|
|
71
71
|
`);
|
|
@@ -110,10 +110,10 @@ describe('Oas3 response-contains-property', () => {
|
|
|
110
110
|
}),
|
|
111
111
|
});
|
|
112
112
|
expect(results).toMatchInlineSnapshot(`
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
"location":
|
|
116
|
-
|
|
113
|
+
[
|
|
114
|
+
{
|
|
115
|
+
"location": [
|
|
116
|
+
{
|
|
117
117
|
"pointer": "#/paths/~1store~1subscribe/post/responses/201/content/application~1json/schema/properties",
|
|
118
118
|
"reportOnKey": true,
|
|
119
119
|
"source": Source {
|
|
@@ -147,14 +147,14 @@ describe('Oas3 response-contains-property', () => {
|
|
|
147
147
|
},
|
|
148
148
|
},
|
|
149
149
|
],
|
|
150
|
-
"message": "Response object must contain a top-level
|
|
150
|
+
"message": "Response object must contain a top-level "id" property.",
|
|
151
151
|
"ruleId": "response-contains-property",
|
|
152
152
|
"severity": "error",
|
|
153
|
-
"suggest":
|
|
153
|
+
"suggest": [],
|
|
154
154
|
},
|
|
155
|
-
|
|
156
|
-
"location":
|
|
157
|
-
|
|
155
|
+
{
|
|
156
|
+
"location": [
|
|
157
|
+
{
|
|
158
158
|
"pointer": "#/paths/~1store~1subscribe/post/responses/400/content/application~1json/schema/properties",
|
|
159
159
|
"reportOnKey": true,
|
|
160
160
|
"source": Source {
|
|
@@ -188,10 +188,10 @@ describe('Oas3 response-contains-property', () => {
|
|
|
188
188
|
},
|
|
189
189
|
},
|
|
190
190
|
],
|
|
191
|
-
"message": "Response object must contain a top-level
|
|
191
|
+
"message": "Response object must contain a top-level "error" property.",
|
|
192
192
|
"ruleId": "response-contains-property",
|
|
193
193
|
"severity": "error",
|
|
194
|
-
"suggest":
|
|
194
|
+
"suggest": [],
|
|
195
195
|
},
|
|
196
196
|
]
|
|
197
197
|
`);
|
|
@@ -237,7 +237,7 @@ describe('Oas3 response-contains-property', () => {
|
|
|
237
237
|
},
|
|
238
238
|
}),
|
|
239
239
|
});
|
|
240
|
-
expect(results).toMatchInlineSnapshot(`
|
|
240
|
+
expect(results).toMatchInlineSnapshot(`[]`);
|
|
241
241
|
});
|
|
242
242
|
|
|
243
243
|
it('should not report a response object when schema type is not object', async () => {
|
|
@@ -265,7 +265,7 @@ describe('Oas3 response-contains-property', () => {
|
|
|
265
265
|
},
|
|
266
266
|
}),
|
|
267
267
|
});
|
|
268
|
-
expect(results).toMatchInlineSnapshot(`
|
|
268
|
+
expect(results).toMatchInlineSnapshot(`[]`);
|
|
269
269
|
});
|
|
270
270
|
|
|
271
271
|
it('should not report response objects when there is no `names` field specified', async () => {
|
|
@@ -305,7 +305,7 @@ describe('Oas3 response-contains-property', () => {
|
|
|
305
305
|
},
|
|
306
306
|
}),
|
|
307
307
|
});
|
|
308
|
-
expect(results).toMatchInlineSnapshot(`
|
|
308
|
+
expect(results).toMatchInlineSnapshot(`[]`);
|
|
309
309
|
});
|
|
310
310
|
|
|
311
311
|
it('should not report response objects for 204 status code', async () => {
|
|
@@ -337,7 +337,7 @@ describe('Oas3 response-contains-property', () => {
|
|
|
337
337
|
},
|
|
338
338
|
}),
|
|
339
339
|
});
|
|
340
|
-
expect(results).toMatchInlineSnapshot(`
|
|
340
|
+
expect(results).toMatchInlineSnapshot(`[]`);
|
|
341
341
|
});
|
|
342
342
|
|
|
343
343
|
it('should report response objects when there are no properties', async () => {
|
|
@@ -367,10 +367,10 @@ describe('Oas3 response-contains-property', () => {
|
|
|
367
367
|
}),
|
|
368
368
|
});
|
|
369
369
|
expect(results).toMatchInlineSnapshot(`
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
"location":
|
|
373
|
-
|
|
370
|
+
[
|
|
371
|
+
{
|
|
372
|
+
"location": [
|
|
373
|
+
{
|
|
374
374
|
"pointer": "#/paths/~1store~1subscribe/post/responses/200/content/application~1json/schema/properties",
|
|
375
375
|
"reportOnKey": true,
|
|
376
376
|
"source": Source {
|
|
@@ -392,10 +392,10 @@ describe('Oas3 response-contains-property', () => {
|
|
|
392
392
|
},
|
|
393
393
|
},
|
|
394
394
|
],
|
|
395
|
-
"message": "Response object must contain a top-level
|
|
395
|
+
"message": "Response object must contain a top-level "id" property.",
|
|
396
396
|
"ruleId": "response-contains-property",
|
|
397
397
|
"severity": "error",
|
|
398
|
-
"suggest":
|
|
398
|
+
"suggest": [],
|
|
399
399
|
},
|
|
400
400
|
]
|
|
401
401
|
`);
|
|
@@ -25,8 +25,8 @@ describe('OpenAPI Schema', () => {
|
|
|
25
25
|
spec: 'error',
|
|
26
26
|
})
|
|
27
27
|
).toMatchInlineSnapshot(`
|
|
28
|
-
|
|
29
|
-
|
|
28
|
+
[
|
|
29
|
+
{
|
|
30
30
|
"location": "#/info/title",
|
|
31
31
|
"message": "Expected type \`string\` but got \`null\`.",
|
|
32
32
|
},
|
|
@@ -58,8 +58,8 @@ describe('OpenAPI Schema', () => {
|
|
|
58
58
|
spec: 'error',
|
|
59
59
|
})
|
|
60
60
|
).toMatchInlineSnapshot(`
|
|
61
|
-
|
|
62
|
-
|
|
61
|
+
[
|
|
62
|
+
{
|
|
63
63
|
"location": "#/info/description",
|
|
64
64
|
"message": "Expected type \`string\` but got \`null\`.",
|
|
65
65
|
},
|
|
@@ -91,8 +91,8 @@ describe('OpenAPI Schema', () => {
|
|
|
91
91
|
spec: 'error',
|
|
92
92
|
})
|
|
93
93
|
).toMatchInlineSnapshot(`
|
|
94
|
-
|
|
95
|
-
|
|
94
|
+
[
|
|
95
|
+
{
|
|
96
96
|
"location": "#/info/termsOfService",
|
|
97
97
|
"message": "Expected type \`string\` but got \`null\`.",
|
|
98
98
|
},
|
|
@@ -127,7 +127,7 @@ describe('OpenAPI Schema', () => {
|
|
|
127
127
|
await validateDoc(source, {
|
|
128
128
|
spec: 'error',
|
|
129
129
|
})
|
|
130
|
-
).toMatchInlineSnapshot(`
|
|
130
|
+
).toMatchInlineSnapshot(`[]`);
|
|
131
131
|
});
|
|
132
132
|
|
|
133
133
|
it('should report if in the Contact Object in URL field is not string', async () => {
|
|
@@ -157,8 +157,8 @@ describe('OpenAPI Schema', () => {
|
|
|
157
157
|
spec: 'error',
|
|
158
158
|
})
|
|
159
159
|
).toMatchInlineSnapshot(`
|
|
160
|
-
|
|
161
|
-
|
|
160
|
+
[
|
|
161
|
+
{
|
|
162
162
|
"location": "#/info/contact/url",
|
|
163
163
|
"message": "Expected type \`string\` but got \`null\`.",
|
|
164
164
|
},
|
|
@@ -193,8 +193,8 @@ describe('OpenAPI Schema', () => {
|
|
|
193
193
|
spec: 'error',
|
|
194
194
|
})
|
|
195
195
|
).toMatchInlineSnapshot(`
|
|
196
|
-
|
|
197
|
-
|
|
196
|
+
[
|
|
197
|
+
{
|
|
198
198
|
"location": "#/info/contact/email",
|
|
199
199
|
"message": "Expected type \`string\` but got \`null\`.",
|
|
200
200
|
},
|
|
@@ -227,7 +227,7 @@ describe('OpenAPI Schema', () => {
|
|
|
227
227
|
await validateDoc(source, {
|
|
228
228
|
spec: 'error',
|
|
229
229
|
})
|
|
230
|
-
).toMatchInlineSnapshot(`
|
|
230
|
+
).toMatchInlineSnapshot(`[]`);
|
|
231
231
|
});
|
|
232
232
|
|
|
233
233
|
it('should report if the License Object missing field Name', async () => {
|
|
@@ -255,8 +255,8 @@ describe('OpenAPI Schema', () => {
|
|
|
255
255
|
spec: 'error',
|
|
256
256
|
})
|
|
257
257
|
).toMatchInlineSnapshot(`
|
|
258
|
-
|
|
259
|
-
|
|
258
|
+
[
|
|
259
|
+
{
|
|
260
260
|
"location": "#/info/license",
|
|
261
261
|
"message": "The field \`name\` must be present on this level.",
|
|
262
262
|
},
|
|
@@ -290,8 +290,8 @@ describe('OpenAPI Schema', () => {
|
|
|
290
290
|
spec: 'error',
|
|
291
291
|
})
|
|
292
292
|
).toMatchInlineSnapshot(`
|
|
293
|
-
|
|
294
|
-
|
|
293
|
+
[
|
|
294
|
+
{
|
|
295
295
|
"location": "#/info/license/url",
|
|
296
296
|
"message": "Expected type \`string\` but got \`null\`.",
|
|
297
297
|
},
|
|
@@ -323,7 +323,7 @@ describe('OpenAPI Schema', () => {
|
|
|
323
323
|
await validateDoc(source, {
|
|
324
324
|
spec: 'error',
|
|
325
325
|
})
|
|
326
|
-
).toMatchInlineSnapshot(`
|
|
326
|
+
).toMatchInlineSnapshot(`[]`);
|
|
327
327
|
});
|
|
328
328
|
|
|
329
329
|
it('should report if the Version field is not provided', async () => {
|
|
@@ -348,8 +348,8 @@ describe('OpenAPI Schema', () => {
|
|
|
348
348
|
spec: 'error',
|
|
349
349
|
})
|
|
350
350
|
).toMatchInlineSnapshot(`
|
|
351
|
-
|
|
352
|
-
|
|
351
|
+
[
|
|
352
|
+
{
|
|
353
353
|
"location": "#/info",
|
|
354
354
|
"message": "The field \`version\` must be present on this level.",
|
|
355
355
|
},
|
|
@@ -380,8 +380,8 @@ describe('OpenAPI Schema', () => {
|
|
|
380
380
|
spec: 'error',
|
|
381
381
|
})
|
|
382
382
|
).toMatchInlineSnapshot(`
|
|
383
|
-
|
|
384
|
-
|
|
383
|
+
[
|
|
384
|
+
{
|
|
385
385
|
"location": "#/info/version",
|
|
386
386
|
"message": "Expected type \`string\` but got \`null\`.",
|
|
387
387
|
},
|
|
@@ -24,7 +24,7 @@ it('should not report if summary field is valid', async () => {
|
|
|
24
24
|
await validateDoc(source, {
|
|
25
25
|
spec: 'error',
|
|
26
26
|
})
|
|
27
|
-
).toMatchInlineSnapshot(`
|
|
27
|
+
).toMatchInlineSnapshot(`[]`);
|
|
28
28
|
});
|
|
29
29
|
|
|
30
30
|
it('should report if summary field is not string ', async () => {
|
|
@@ -51,8 +51,8 @@ it('should report if summary field is not string ', async () => {
|
|
|
51
51
|
spec: 'error',
|
|
52
52
|
})
|
|
53
53
|
).toMatchInlineSnapshot(`
|
|
54
|
-
|
|
55
|
-
|
|
54
|
+
[
|
|
55
|
+
{
|
|
56
56
|
"location": "#/paths/~1ping/summary",
|
|
57
57
|
"message": "Expected type \`string\` but got \`null\`.",
|
|
58
58
|
},
|
|
@@ -83,7 +83,7 @@ it('should not report if description field is valid', async () => {
|
|
|
83
83
|
await validateDoc(source, {
|
|
84
84
|
spec: 'error',
|
|
85
85
|
})
|
|
86
|
-
).toMatchInlineSnapshot(`
|
|
86
|
+
).toMatchInlineSnapshot(`[]`);
|
|
87
87
|
});
|
|
88
88
|
|
|
89
89
|
it('should report if description field is not string', async () => {
|
|
@@ -110,8 +110,8 @@ it('should report if description field is not string', async () => {
|
|
|
110
110
|
spec: 'error',
|
|
111
111
|
})
|
|
112
112
|
).toMatchInlineSnapshot(`
|
|
113
|
-
|
|
114
|
-
|
|
113
|
+
[
|
|
114
|
+
{
|
|
115
115
|
"location": "#/paths/~1ping/description",
|
|
116
116
|
"message": "Expected type \`string\` but got \`null\`.",
|
|
117
117
|
},
|
|
@@ -141,7 +141,7 @@ it('should not report of a valid GET operation object', async () => {
|
|
|
141
141
|
await validateDoc(source, {
|
|
142
142
|
spec: 'error',
|
|
143
143
|
})
|
|
144
|
-
).toMatchInlineSnapshot(`
|
|
144
|
+
).toMatchInlineSnapshot(`[]`);
|
|
145
145
|
});
|
|
146
146
|
|
|
147
147
|
it('should not report of a valid PUT operation object', async () => {
|
|
@@ -171,7 +171,7 @@ it('should not report of a valid PUT operation object', async () => {
|
|
|
171
171
|
await validateDoc(source, {
|
|
172
172
|
spec: 'error',
|
|
173
173
|
})
|
|
174
|
-
).toMatchInlineSnapshot(`
|
|
174
|
+
).toMatchInlineSnapshot(`[]`);
|
|
175
175
|
});
|
|
176
176
|
|
|
177
177
|
it('should not report of a valid Post operation object', async () => {
|
|
@@ -209,7 +209,7 @@ it('should not report of a valid Post operation object', async () => {
|
|
|
209
209
|
await validateDoc(source, {
|
|
210
210
|
spec: 'error',
|
|
211
211
|
})
|
|
212
|
-
).toMatchInlineSnapshot(`
|
|
212
|
+
).toMatchInlineSnapshot(`[]`);
|
|
213
213
|
});
|
|
214
214
|
|
|
215
215
|
it('should not report of a valid delete operation object', async () => {
|
|
@@ -249,5 +249,5 @@ it('should not report of a valid delete operation object', async () => {
|
|
|
249
249
|
await validateDoc(source, {
|
|
250
250
|
spec: 'error',
|
|
251
251
|
})
|
|
252
|
-
).toMatchInlineSnapshot(`
|
|
252
|
+
).toMatchInlineSnapshot(`[]`);
|
|
253
253
|
});
|
|
@@ -24,7 +24,7 @@ describe('OpenAPI Schema', () => {
|
|
|
24
24
|
await validateDoc(source, {
|
|
25
25
|
spec: 'error',
|
|
26
26
|
})
|
|
27
|
-
).toMatchInlineSnapshot(`
|
|
27
|
+
).toMatchInlineSnapshot(`[]`);
|
|
28
28
|
});
|
|
29
29
|
|
|
30
30
|
it('should not report if Path object is empty ', async () => {
|
|
@@ -44,7 +44,7 @@ describe('OpenAPI Schema', () => {
|
|
|
44
44
|
await validateDoc(source, {
|
|
45
45
|
spec: 'error',
|
|
46
46
|
})
|
|
47
|
-
).toMatchInlineSnapshot(`
|
|
47
|
+
).toMatchInlineSnapshot(`[]`);
|
|
48
48
|
});
|
|
49
49
|
|
|
50
50
|
it('should report if Path object is not present ', async () => {
|
|
@@ -63,8 +63,8 @@ describe('OpenAPI Schema', () => {
|
|
|
63
63
|
spec: 'error',
|
|
64
64
|
})
|
|
65
65
|
).toMatchInlineSnapshot(`
|
|
66
|
-
|
|
67
|
-
|
|
66
|
+
[
|
|
67
|
+
{
|
|
68
68
|
"location": "#/",
|
|
69
69
|
"message": "The field \`paths\` must be present on this level.",
|
|
70
70
|
},
|
|
@@ -89,7 +89,7 @@ describe('OpenAPI Schema', () => {
|
|
|
89
89
|
await validateDoc(source, {
|
|
90
90
|
spec: 'error',
|
|
91
91
|
})
|
|
92
|
-
).toMatchInlineSnapshot(`
|
|
92
|
+
).toMatchInlineSnapshot(`[]`);
|
|
93
93
|
});
|
|
94
94
|
|
|
95
95
|
//Check: no error
|
|
@@ -116,8 +116,8 @@ describe('OpenAPI Schema', () => {
|
|
|
116
116
|
spec: 'error',
|
|
117
117
|
})
|
|
118
118
|
).toMatchInlineSnapshot(`
|
|
119
|
-
|
|
120
|
-
|
|
119
|
+
[
|
|
120
|
+
{
|
|
121
121
|
"location": "#/paths/ping",
|
|
122
122
|
"message": "Property \`ping\` is not expected here.",
|
|
123
123
|
},
|
|
@@ -153,8 +153,8 @@ describe('OpenAPI Schema', () => {
|
|
|
153
153
|
'no-identical-paths': 'error',
|
|
154
154
|
})
|
|
155
155
|
).toMatchInlineSnapshot(`
|
|
156
|
-
|
|
157
|
-
|
|
156
|
+
[
|
|
157
|
+
{
|
|
158
158
|
"location": "#/paths/~1pets~1{name}",
|
|
159
159
|
"message": "The path already exists which differs only by path parameter name(s): \`/pets/{petId}\` and \`/pets/{name}\`.",
|
|
160
160
|
},
|
|
@@ -189,7 +189,7 @@ describe('OpenAPI Schema', () => {
|
|
|
189
189
|
await validateDoc(source, {
|
|
190
190
|
spec: 'error',
|
|
191
191
|
})
|
|
192
|
-
).toMatchInlineSnapshot(`
|
|
192
|
+
).toMatchInlineSnapshot(`[]`);
|
|
193
193
|
});
|
|
194
194
|
|
|
195
195
|
it('should not report in case of ambiguous matching ', async () => {
|
|
@@ -219,7 +219,7 @@ describe('OpenAPI Schema', () => {
|
|
|
219
219
|
await validateDoc(source, {
|
|
220
220
|
spec: 'error',
|
|
221
221
|
})
|
|
222
|
-
).toMatchInlineSnapshot(`
|
|
222
|
+
).toMatchInlineSnapshot(`[]`);
|
|
223
223
|
});
|
|
224
224
|
|
|
225
225
|
it('should not report if Path Item is empty ', async () => {
|
|
@@ -240,7 +240,7 @@ describe('OpenAPI Schema', () => {
|
|
|
240
240
|
await validateDoc(source, {
|
|
241
241
|
spec: 'error',
|
|
242
242
|
})
|
|
243
|
-
).toMatchInlineSnapshot(`
|
|
243
|
+
).toMatchInlineSnapshot(`[]`);
|
|
244
244
|
});
|
|
245
245
|
|
|
246
246
|
it('should not report of a valid Parameter Object', async () => {
|
|
@@ -279,6 +279,6 @@ describe('OpenAPI Schema', () => {
|
|
|
279
279
|
await validateDoc(source, {
|
|
280
280
|
spec: 'error',
|
|
281
281
|
})
|
|
282
|
-
).toMatchInlineSnapshot(`
|
|
282
|
+
).toMatchInlineSnapshot(`[]`);
|
|
283
283
|
});
|
|
284
284
|
});
|
|
@@ -35,7 +35,7 @@ describe('Referenceable scalars', () => {
|
|
|
35
35
|
})
|
|
36
36
|
),
|
|
37
37
|
});
|
|
38
|
-
expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`
|
|
38
|
+
expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`[]`);
|
|
39
39
|
});
|
|
40
40
|
|
|
41
41
|
it('should not report invalid $ref on example with doNotResolveExamples', async () => {
|
|
@@ -72,6 +72,6 @@ describe('Referenceable scalars', () => {
|
|
|
72
72
|
})
|
|
73
73
|
),
|
|
74
74
|
});
|
|
75
|
-
expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`
|
|
75
|
+
expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`[]`);
|
|
76
76
|
});
|
|
77
77
|
});
|
|
@@ -25,7 +25,7 @@ describe('OpenAPI Schema', () => {
|
|
|
25
25
|
await validateDoc(source, {
|
|
26
26
|
spec: 'error',
|
|
27
27
|
})
|
|
28
|
-
).toMatchInlineSnapshot(`
|
|
28
|
+
).toMatchInlineSnapshot(`[]`);
|
|
29
29
|
});
|
|
30
30
|
|
|
31
31
|
it('should report on empty server URL', async () => {
|
|
@@ -51,8 +51,8 @@ describe('OpenAPI Schema', () => {
|
|
|
51
51
|
spec: 'error',
|
|
52
52
|
})
|
|
53
53
|
).toMatchInlineSnapshot(`
|
|
54
|
-
|
|
55
|
-
|
|
54
|
+
[
|
|
55
|
+
{
|
|
56
56
|
"location": "#/servers/0/url",
|
|
57
57
|
"message": "Expected type \`string\` but got \`null\`.",
|
|
58
58
|
},
|
|
@@ -83,8 +83,8 @@ describe('OpenAPI Schema', () => {
|
|
|
83
83
|
spec: 'error',
|
|
84
84
|
})
|
|
85
85
|
).toMatchInlineSnapshot(`
|
|
86
|
-
|
|
87
|
-
|
|
86
|
+
[
|
|
87
|
+
{
|
|
88
88
|
"location": "#/servers/0",
|
|
89
89
|
"message": "The field \`url\` must be present on this level.",
|
|
90
90
|
},
|
|
@@ -116,8 +116,8 @@ describe('OpenAPI Schema', () => {
|
|
|
116
116
|
spec: 'error',
|
|
117
117
|
})
|
|
118
118
|
).toMatchInlineSnapshot(`
|
|
119
|
-
|
|
120
|
-
|
|
119
|
+
[
|
|
120
|
+
{
|
|
121
121
|
"location": "#/servers/0/description",
|
|
122
122
|
"message": "Expected type \`string\` but got \`null\`.",
|
|
123
123
|
},
|
|
@@ -147,7 +147,7 @@ describe('OpenAPI Schema', () => {
|
|
|
147
147
|
await validateDoc(source, {
|
|
148
148
|
spec: 'error',
|
|
149
149
|
})
|
|
150
|
-
).toMatchInlineSnapshot(`
|
|
150
|
+
).toMatchInlineSnapshot(`[]`);
|
|
151
151
|
});
|
|
152
152
|
|
|
153
153
|
it('should report if fields type in servers are not array', async () => {
|
|
@@ -173,8 +173,8 @@ describe('OpenAPI Schema', () => {
|
|
|
173
173
|
spec: 'error',
|
|
174
174
|
})
|
|
175
175
|
).toMatchInlineSnapshot(`
|
|
176
|
-
|
|
177
|
-
|
|
176
|
+
[
|
|
177
|
+
{
|
|
178
178
|
"location": "#/servers",
|
|
179
179
|
"message": "Expected type \`ServerList\` (array) but got \`object\`",
|
|
180
180
|
},
|
|
@@ -209,7 +209,7 @@ describe('OpenAPI Schema', () => {
|
|
|
209
209
|
await validateDoc(source, {
|
|
210
210
|
spec: 'error',
|
|
211
211
|
})
|
|
212
|
-
).toMatchInlineSnapshot(`
|
|
212
|
+
).toMatchInlineSnapshot(`[]`);
|
|
213
213
|
});
|
|
214
214
|
|
|
215
215
|
it('should not report if variables are used for a server configuration', async () => {
|
|
@@ -244,7 +244,7 @@ describe('OpenAPI Schema', () => {
|
|
|
244
244
|
await validateDoc(source, {
|
|
245
245
|
spec: 'error',
|
|
246
246
|
})
|
|
247
|
-
).toMatchInlineSnapshot(`
|
|
247
|
+
).toMatchInlineSnapshot(`[]`);
|
|
248
248
|
});
|
|
249
249
|
|
|
250
250
|
it('should report if array in enum is empty', async () => {
|
|
@@ -279,8 +279,8 @@ describe('OpenAPI Schema', () => {
|
|
|
279
279
|
spec: 'error',
|
|
280
280
|
})
|
|
281
281
|
).toMatchInlineSnapshot(`
|
|
282
|
-
|
|
283
|
-
|
|
282
|
+
[
|
|
283
|
+
{
|
|
284
284
|
"location": "#/servers/0/variables/port/enum",
|
|
285
285
|
"message": "Expected type \`array\` but got \`null\`.",
|
|
286
286
|
},
|
|
@@ -319,8 +319,8 @@ describe('OpenAPI Schema', () => {
|
|
|
319
319
|
'no-undefined-server-variable': 'error',
|
|
320
320
|
})
|
|
321
321
|
).toMatchInlineSnapshot(`
|
|
322
|
-
|
|
323
|
-
|
|
322
|
+
[
|
|
323
|
+
{
|
|
324
324
|
"location": "#/servers/0/url",
|
|
325
325
|
"message": "The \`basePath\` variable is not defined in the \`variables\` objects.",
|
|
326
326
|
},
|
|
@@ -359,12 +359,12 @@ describe('OpenAPI Schema', () => {
|
|
|
359
359
|
spec: 'error',
|
|
360
360
|
})
|
|
361
361
|
).toMatchInlineSnapshot(`
|
|
362
|
-
|
|
363
|
-
|
|
362
|
+
[
|
|
363
|
+
{
|
|
364
364
|
"location": "#/servers/0/variables/username",
|
|
365
365
|
"message": "The field \`default\` must be present on this level.",
|
|
366
366
|
},
|
|
367
|
-
|
|
367
|
+
{
|
|
368
368
|
"location": "#/servers/0/variables/port",
|
|
369
369
|
"message": "The field \`default\` must be present on this level.",
|
|
370
370
|
},
|
|
@@ -405,8 +405,8 @@ describe('OpenAPI Schema', () => {
|
|
|
405
405
|
spec: 'error',
|
|
406
406
|
})
|
|
407
407
|
).toMatchInlineSnapshot(`
|
|
408
|
-
|
|
409
|
-
|
|
408
|
+
[
|
|
409
|
+
{
|
|
410
410
|
"location": "#/servers/0/variables/username/default",
|
|
411
411
|
"message": "Expected type \`string\` but got \`null\`.",
|
|
412
412
|
},
|
|
@@ -448,8 +448,8 @@ describe('OpenAPI Schema', () => {
|
|
|
448
448
|
spec: 'error',
|
|
449
449
|
})
|
|
450
450
|
).toMatchInlineSnapshot(`
|
|
451
|
-
|
|
452
|
-
|
|
451
|
+
[
|
|
452
|
+
{
|
|
453
453
|
"location": "#/servers/0/variables/username/description",
|
|
454
454
|
"message": "Expected type \`string\` but got \`null\`.",
|
|
455
455
|
},
|
|
@@ -476,7 +476,7 @@ describe('OpenAPI Schema', () => {
|
|
|
476
476
|
await validateDoc(source, {
|
|
477
477
|
spec: 'error',
|
|
478
478
|
})
|
|
479
|
-
).toMatchInlineSnapshot(`
|
|
479
|
+
).toMatchInlineSnapshot(`[]`);
|
|
480
480
|
});
|
|
481
481
|
|
|
482
482
|
it('should not report if servers property is an empty array', async () => {
|
|
@@ -500,6 +500,6 @@ describe('OpenAPI Schema', () => {
|
|
|
500
500
|
await validateDoc(source, {
|
|
501
501
|
spec: 'error',
|
|
502
502
|
})
|
|
503
|
-
).toMatchInlineSnapshot(`
|
|
503
|
+
).toMatchInlineSnapshot(`[]`);
|
|
504
504
|
});
|
|
505
505
|
});
|