@redocly/openapi-core 1.3.0 → 1.4.1
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 +18 -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 +25 -25
- 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 +6 -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.js +26 -14
- 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/decorators/oas2/remove-unused-components.d.ts +2 -0
- package/lib/{rules → decorators}/oas2/remove-unused-components.js +1 -1
- package/lib/decorators/oas3/remove-unused-components.d.ts +2 -0
- package/lib/{rules → decorators}/oas3/remove-unused-components.js +2 -2
- package/lib/env.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/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/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 +18 -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 +38 -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/bundle.ts +4 -4
- 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/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 +15 -0
- package/src/decorators/common/media-type-examples-override.ts +2 -2
- package/src/{rules → decorators}/oas2/remove-unused-components.ts +3 -3
- package/src/{rules → decorators}/oas3/remove-unused-components.ts +3 -3
- package/src/env.ts +1 -1
- 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/oas3_1.ts +12 -0
- package/src/types/redocly-yaml.ts +75 -40
- package/src/visitors.ts +10 -21
- package/src/walk.ts +23 -10
- package/tsconfig.tsbuildinfo +1 -1
- package/lib/rules/oas2/remove-unused-components.d.ts +0 -2
- package/lib/rules/oas3/remove-unused-components.d.ts +0 -2
- /package/src/{rules → decorators}/oas2/__tests__/remove-unused-components.test.ts +0 -0
- /package/src/{rules → decorators}/oas3/__tests__/remove-unused-components.test.ts +0 -0
|
@@ -40,10 +40,10 @@ describe('Oas3 component-name-unique', () => {
|
|
|
40
40
|
);
|
|
41
41
|
|
|
42
42
|
expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
"location":
|
|
46
|
-
|
|
43
|
+
[
|
|
44
|
+
{
|
|
45
|
+
"location": [
|
|
46
|
+
{
|
|
47
47
|
"pointer": "#/",
|
|
48
48
|
"reportOnKey": false,
|
|
49
49
|
"source": "/foobar.yaml",
|
|
@@ -54,7 +54,7 @@ describe('Oas3 component-name-unique', () => {
|
|
|
54
54
|
- /test.yaml#/components/schemas/SomeSchema",
|
|
55
55
|
"ruleId": "component-name-unique",
|
|
56
56
|
"severity": "error",
|
|
57
|
-
"suggest":
|
|
57
|
+
"suggest": [],
|
|
58
58
|
},
|
|
59
59
|
]
|
|
60
60
|
`);
|
|
@@ -95,24 +95,24 @@ describe('Oas3 component-name-unique', () => {
|
|
|
95
95
|
);
|
|
96
96
|
|
|
97
97
|
expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
98
|
+
[
|
|
99
|
+
{
|
|
100
|
+
"location": [
|
|
101
|
+
{
|
|
102
|
+
"pointer": "#/",
|
|
103
|
+
"reportOnKey": false,
|
|
104
|
+
"source": "/foobar.yaml",
|
|
105
|
+
},
|
|
106
|
+
],
|
|
107
|
+
"message": "Component 'schemas/SomeSchema' is not unique. It is defined at:
|
|
108
|
+
- /foobar.yaml#/components/schemas/SomeSchema
|
|
109
|
+
- /SomeSchema.yaml",
|
|
110
|
+
"ruleId": "component-name-unique",
|
|
111
|
+
"severity": "error",
|
|
112
|
+
"suggest": [],
|
|
113
|
+
},
|
|
114
|
+
]
|
|
115
|
+
`);
|
|
116
116
|
});
|
|
117
117
|
|
|
118
118
|
it('should not report on multiple schemas with different names', async () => {
|
|
@@ -150,7 +150,7 @@ describe('Oas3 component-name-unique', () => {
|
|
|
150
150
|
additionalDocuments
|
|
151
151
|
);
|
|
152
152
|
|
|
153
|
-
expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(
|
|
153
|
+
expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`[]`);
|
|
154
154
|
});
|
|
155
155
|
});
|
|
156
156
|
|
|
@@ -198,24 +198,24 @@ describe('Oas3 component-name-unique', () => {
|
|
|
198
198
|
);
|
|
199
199
|
|
|
200
200
|
expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
201
|
+
[
|
|
202
|
+
{
|
|
203
|
+
"location": [
|
|
204
|
+
{
|
|
205
|
+
"pointer": "#/",
|
|
206
|
+
"reportOnKey": false,
|
|
207
|
+
"source": "/foobar.yaml",
|
|
208
|
+
},
|
|
209
|
+
],
|
|
210
|
+
"message": "Component 'parameters/ParameterOne' is not unique. It is defined at:
|
|
211
|
+
- /foobar.yaml#/components/parameters/ParameterOne
|
|
212
|
+
- /test.yaml#/components/parameters/ParameterOne",
|
|
213
|
+
"ruleId": "component-name-unique",
|
|
214
|
+
"severity": "error",
|
|
215
|
+
"suggest": [],
|
|
216
|
+
},
|
|
217
|
+
]
|
|
218
|
+
`);
|
|
219
219
|
});
|
|
220
220
|
|
|
221
221
|
it('should report on multiple parameters with same component name - filename', async () => {
|
|
@@ -257,24 +257,24 @@ describe('Oas3 component-name-unique', () => {
|
|
|
257
257
|
);
|
|
258
258
|
|
|
259
259
|
expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
260
|
+
[
|
|
261
|
+
{
|
|
262
|
+
"location": [
|
|
263
|
+
{
|
|
264
|
+
"pointer": "#/",
|
|
265
|
+
"reportOnKey": false,
|
|
266
|
+
"source": "/foobar.yaml",
|
|
267
|
+
},
|
|
268
|
+
],
|
|
269
|
+
"message": "Component 'parameters/ParameterOne' is not unique. It is defined at:
|
|
270
|
+
- /foobar.yaml#/components/parameters/ParameterOne
|
|
271
|
+
- /ParameterOne.yaml",
|
|
272
|
+
"ruleId": "component-name-unique",
|
|
273
|
+
"severity": "error",
|
|
274
|
+
"suggest": [],
|
|
275
|
+
},
|
|
276
|
+
]
|
|
277
|
+
`);
|
|
278
278
|
});
|
|
279
279
|
|
|
280
280
|
it('should not report on multiple parameters with different component names', async () => {
|
|
@@ -319,7 +319,7 @@ describe('Oas3 component-name-unique', () => {
|
|
|
319
319
|
additionalDocuments
|
|
320
320
|
);
|
|
321
321
|
|
|
322
|
-
expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(
|
|
322
|
+
expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`[]`);
|
|
323
323
|
});
|
|
324
324
|
});
|
|
325
325
|
|
|
@@ -374,24 +374,24 @@ describe('Oas3 component-name-unique', () => {
|
|
|
374
374
|
);
|
|
375
375
|
|
|
376
376
|
expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
377
|
+
[
|
|
378
|
+
{
|
|
379
|
+
"location": [
|
|
380
|
+
{
|
|
381
|
+
"pointer": "#/",
|
|
382
|
+
"reportOnKey": false,
|
|
383
|
+
"source": "/foobar.yaml",
|
|
384
|
+
},
|
|
385
|
+
],
|
|
386
|
+
"message": "Component 'responses/SuccessResponse' is not unique. It is defined at:
|
|
387
|
+
- /foobar.yaml#/components/responses/SuccessResponse
|
|
388
|
+
- /test.yaml#/components/responses/SuccessResponse",
|
|
389
|
+
"ruleId": "component-name-unique",
|
|
390
|
+
"severity": "error",
|
|
391
|
+
"suggest": [],
|
|
392
|
+
},
|
|
393
|
+
]
|
|
394
|
+
`);
|
|
395
395
|
});
|
|
396
396
|
|
|
397
397
|
it('should report on multiple responses with same component name - filename', async () => {
|
|
@@ -440,24 +440,24 @@ describe('Oas3 component-name-unique', () => {
|
|
|
440
440
|
);
|
|
441
441
|
|
|
442
442
|
expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
443
|
+
[
|
|
444
|
+
{
|
|
445
|
+
"location": [
|
|
446
|
+
{
|
|
447
|
+
"pointer": "#/",
|
|
448
|
+
"reportOnKey": false,
|
|
449
|
+
"source": "/foobar.yaml",
|
|
450
|
+
},
|
|
451
|
+
],
|
|
452
|
+
"message": "Component 'responses/SuccessResponse' is not unique. It is defined at:
|
|
453
|
+
- /foobar.yaml#/components/responses/SuccessResponse
|
|
454
|
+
- /SuccessResponse.yaml",
|
|
455
|
+
"ruleId": "component-name-unique",
|
|
456
|
+
"severity": "error",
|
|
457
|
+
"suggest": [],
|
|
458
|
+
},
|
|
459
|
+
]
|
|
460
|
+
`);
|
|
461
461
|
});
|
|
462
462
|
|
|
463
463
|
it('should not report on multiple responses with different component names', async () => {
|
|
@@ -509,7 +509,7 @@ describe('Oas3 component-name-unique', () => {
|
|
|
509
509
|
additionalDocuments
|
|
510
510
|
);
|
|
511
511
|
|
|
512
|
-
expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(
|
|
512
|
+
expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`[]`);
|
|
513
513
|
});
|
|
514
514
|
});
|
|
515
515
|
|
|
@@ -561,24 +561,24 @@ describe('Oas3 component-name-unique', () => {
|
|
|
561
561
|
);
|
|
562
562
|
|
|
563
563
|
expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
564
|
+
[
|
|
565
|
+
{
|
|
566
|
+
"location": [
|
|
567
|
+
{
|
|
568
|
+
"pointer": "#/",
|
|
569
|
+
"reportOnKey": false,
|
|
570
|
+
"source": "/foobar.yaml",
|
|
571
|
+
},
|
|
572
|
+
],
|
|
573
|
+
"message": "Component 'requestBodies/MyRequestBody' is not unique. It is defined at:
|
|
574
|
+
- /foobar.yaml#/components/requestBodies/MyRequestBody
|
|
575
|
+
- /test.yaml#/components/requestBodies/MyRequestBody",
|
|
576
|
+
"ruleId": "component-name-unique",
|
|
577
|
+
"severity": "error",
|
|
578
|
+
"suggest": [],
|
|
579
|
+
},
|
|
580
|
+
]
|
|
581
|
+
`);
|
|
582
582
|
});
|
|
583
583
|
|
|
584
584
|
it('should report on multiple responses with same component name - filename', async () => {
|
|
@@ -628,24 +628,24 @@ describe('Oas3 component-name-unique', () => {
|
|
|
628
628
|
);
|
|
629
629
|
|
|
630
630
|
expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
631
|
+
[
|
|
632
|
+
{
|
|
633
|
+
"location": [
|
|
634
|
+
{
|
|
635
|
+
"pointer": "#/",
|
|
636
|
+
"reportOnKey": false,
|
|
637
|
+
"source": "/foobar.yaml",
|
|
638
|
+
},
|
|
639
|
+
],
|
|
640
|
+
"message": "Component 'requestBodies/MyRequestBody' is not unique. It is defined at:
|
|
641
|
+
- /foobar.yaml#/components/requestBodies/MyRequestBody
|
|
642
|
+
- /MyRequestBody.yaml",
|
|
643
|
+
"ruleId": "component-name-unique",
|
|
644
|
+
"severity": "error",
|
|
645
|
+
"suggest": [],
|
|
646
|
+
},
|
|
647
|
+
]
|
|
648
|
+
`);
|
|
649
649
|
});
|
|
650
650
|
|
|
651
651
|
it('should not report on multiple responses with different component names', async () => {
|
|
@@ -694,7 +694,7 @@ describe('Oas3 component-name-unique', () => {
|
|
|
694
694
|
additionalDocuments
|
|
695
695
|
);
|
|
696
696
|
|
|
697
|
-
expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(
|
|
697
|
+
expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`[]`);
|
|
698
698
|
});
|
|
699
699
|
});
|
|
700
700
|
|
|
@@ -757,39 +757,39 @@ describe('Oas3 component-name-unique', () => {
|
|
|
757
757
|
);
|
|
758
758
|
|
|
759
759
|
expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
760
|
+
[
|
|
761
|
+
{
|
|
762
|
+
"location": [
|
|
763
|
+
{
|
|
764
|
+
"pointer": "#/",
|
|
765
|
+
"reportOnKey": false,
|
|
766
|
+
"source": "/foobar.yaml",
|
|
767
|
+
},
|
|
768
|
+
],
|
|
769
|
+
"message": "Component 'requestBodies/MyRequestBody' is not unique. It is defined at:
|
|
770
|
+
- /foobar.yaml#/components/requestBodies/MyRequestBody
|
|
771
|
+
- /test.yaml#/components/requestBodies/MyRequestBody",
|
|
772
|
+
"ruleId": "component-name-unique",
|
|
773
|
+
"severity": "error",
|
|
774
|
+
"suggest": [],
|
|
775
|
+
},
|
|
776
|
+
{
|
|
777
|
+
"location": [
|
|
778
|
+
{
|
|
779
|
+
"pointer": "#/",
|
|
780
|
+
"reportOnKey": false,
|
|
781
|
+
"source": "/foobar.yaml",
|
|
782
|
+
},
|
|
783
|
+
],
|
|
784
|
+
"message": "Component 'schemas/SomeSchema' is not unique. It is defined at:
|
|
785
|
+
- /foobar.yaml#/components/schemas/SomeSchema
|
|
786
|
+
- /test.yaml#/components/schemas/SomeSchema",
|
|
787
|
+
"ruleId": "component-name-unique",
|
|
788
|
+
"severity": "error",
|
|
789
|
+
"suggest": [],
|
|
790
|
+
},
|
|
791
|
+
]
|
|
792
|
+
`);
|
|
793
793
|
});
|
|
794
794
|
|
|
795
795
|
it('should not report if severity is off for specific component type', async () => {
|
|
@@ -800,24 +800,24 @@ describe('Oas3 component-name-unique', () => {
|
|
|
800
800
|
);
|
|
801
801
|
|
|
802
802
|
expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
803
|
+
[
|
|
804
|
+
{
|
|
805
|
+
"location": [
|
|
806
|
+
{
|
|
807
|
+
"pointer": "#/",
|
|
808
|
+
"reportOnKey": false,
|
|
809
|
+
"source": "/foobar.yaml",
|
|
810
|
+
},
|
|
811
|
+
],
|
|
812
|
+
"message": "Component 'requestBodies/MyRequestBody' is not unique. It is defined at:
|
|
813
|
+
- /foobar.yaml#/components/requestBodies/MyRequestBody
|
|
814
|
+
- /test.yaml#/components/requestBodies/MyRequestBody",
|
|
815
|
+
"ruleId": "component-name-unique",
|
|
816
|
+
"severity": "error",
|
|
817
|
+
"suggest": [],
|
|
818
|
+
},
|
|
819
|
+
]
|
|
820
|
+
`);
|
|
821
821
|
});
|
|
822
822
|
});
|
|
823
823
|
});
|
|
@@ -28,10 +28,10 @@ describe('Oas3 as3-no-server-variables-empty-enum', () => {
|
|
|
28
28
|
});
|
|
29
29
|
|
|
30
30
|
expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
"location":
|
|
34
|
-
|
|
31
|
+
[
|
|
32
|
+
{
|
|
33
|
+
"location": [
|
|
34
|
+
{
|
|
35
35
|
"pointer": "#/servers",
|
|
36
36
|
"reportOnKey": true,
|
|
37
37
|
"source": "",
|
|
@@ -40,11 +40,11 @@ describe('Oas3 as3-no-server-variables-empty-enum', () => {
|
|
|
40
40
|
"message": "Server variable with \`enum\` must be a non-empty array.",
|
|
41
41
|
"ruleId": "no-server-variables-empty-enum",
|
|
42
42
|
"severity": "error",
|
|
43
|
-
"suggest":
|
|
43
|
+
"suggest": [],
|
|
44
44
|
},
|
|
45
|
-
|
|
46
|
-
"location":
|
|
47
|
-
|
|
45
|
+
{
|
|
46
|
+
"location": [
|
|
47
|
+
{
|
|
48
48
|
"pointer": "#/servers",
|
|
49
49
|
"reportOnKey": true,
|
|
50
50
|
"source": "",
|
|
@@ -53,7 +53,7 @@ describe('Oas3 as3-no-server-variables-empty-enum', () => {
|
|
|
53
53
|
"message": "Server variable define \`enum\` and \`default\`. \`enum\` must include default value",
|
|
54
54
|
"ruleId": "no-server-variables-empty-enum",
|
|
55
55
|
"severity": "error",
|
|
56
|
-
"suggest":
|
|
56
|
+
"suggest": [],
|
|
57
57
|
},
|
|
58
58
|
]
|
|
59
59
|
`);
|
|
@@ -82,10 +82,10 @@ describe('Oas3 as3-no-server-variables-empty-enum', () => {
|
|
|
82
82
|
});
|
|
83
83
|
|
|
84
84
|
expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
"location":
|
|
88
|
-
|
|
85
|
+
[
|
|
86
|
+
{
|
|
87
|
+
"location": [
|
|
88
|
+
{
|
|
89
89
|
"pointer": "#/servers",
|
|
90
90
|
"reportOnKey": true,
|
|
91
91
|
"source": "",
|
|
@@ -94,7 +94,7 @@ describe('Oas3 as3-no-server-variables-empty-enum', () => {
|
|
|
94
94
|
"message": "Server variable with \`enum\` must be a non-empty array.",
|
|
95
95
|
"ruleId": "no-server-variables-empty-enum",
|
|
96
96
|
"severity": "error",
|
|
97
|
-
"suggest":
|
|
97
|
+
"suggest": [],
|
|
98
98
|
},
|
|
99
99
|
]
|
|
100
100
|
`);
|
|
@@ -120,7 +120,7 @@ describe('Oas3 as3-no-server-variables-empty-enum', () => {
|
|
|
120
120
|
config: await makeConfig({ 'no-server-variables-empty-enum': 'error' }),
|
|
121
121
|
});
|
|
122
122
|
|
|
123
|
-
expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`
|
|
123
|
+
expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`[]`);
|
|
124
124
|
});
|
|
125
125
|
|
|
126
126
|
it('oas3-no-server-variables-empty-enum: should be success because variable is empty object', async () => {
|
|
@@ -144,7 +144,7 @@ describe('Oas3 as3-no-server-variables-empty-enum', () => {
|
|
|
144
144
|
config: await makeConfig({ 'no-server-variables-empty-enum': 'error' }),
|
|
145
145
|
});
|
|
146
146
|
|
|
147
|
-
expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`
|
|
147
|
+
expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`[]`);
|
|
148
148
|
});
|
|
149
149
|
|
|
150
150
|
it('oas3-no-server-variables-empty-enum: should be success because enum contains default value', async () => {
|
|
@@ -171,7 +171,7 @@ describe('Oas3 as3-no-server-variables-empty-enum', () => {
|
|
|
171
171
|
config: await makeConfig({ 'no-server-variables-empty-enum': 'error' }),
|
|
172
172
|
});
|
|
173
173
|
|
|
174
|
-
expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`
|
|
174
|
+
expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`[]`);
|
|
175
175
|
});
|
|
176
176
|
|
|
177
177
|
it('oas3-no-server-variables-empty-enum: should be success because enum contains default value', async () => {
|
|
@@ -200,6 +200,6 @@ describe('Oas3 as3-no-server-variables-empty-enum', () => {
|
|
|
200
200
|
config: await makeConfig({ 'no-server-variables-empty-enum': 'error' }),
|
|
201
201
|
});
|
|
202
202
|
|
|
203
|
-
expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`
|
|
203
|
+
expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`[]`);
|
|
204
204
|
});
|
|
205
205
|
});
|
|
@@ -24,10 +24,10 @@ describe('Oas3 oas3-no-example-value-and-externalValue', () => {
|
|
|
24
24
|
});
|
|
25
25
|
|
|
26
26
|
expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
"location":
|
|
30
|
-
|
|
27
|
+
[
|
|
28
|
+
{
|
|
29
|
+
"location": [
|
|
30
|
+
{
|
|
31
31
|
"pointer": "#/components/examples/some/value",
|
|
32
32
|
"reportOnKey": true,
|
|
33
33
|
"source": "foobar.yaml",
|
|
@@ -36,7 +36,7 @@ describe('Oas3 oas3-no-example-value-and-externalValue', () => {
|
|
|
36
36
|
"message": "Example object can have either \`value\` or \`externalValue\` fields.",
|
|
37
37
|
"ruleId": "no-example-value-and-externalValue",
|
|
38
38
|
"severity": "error",
|
|
39
|
-
"suggest":
|
|
39
|
+
"suggest": [],
|
|
40
40
|
},
|
|
41
41
|
]
|
|
42
42
|
`);
|
|
@@ -60,6 +60,6 @@ describe('Oas3 oas3-no-example-value-and-externalValue', () => {
|
|
|
60
60
|
config: await makeConfig({ 'no-example-value-and-externalValue': 'error' }),
|
|
61
61
|
});
|
|
62
62
|
|
|
63
|
-
expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`
|
|
63
|
+
expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`[]`);
|
|
64
64
|
});
|
|
65
65
|
});
|