@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
|
@@ -37,14 +37,14 @@ describe('no-invalid-media-type-examples', () => {
|
|
|
37
37
|
});
|
|
38
38
|
|
|
39
39
|
expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
"from":
|
|
40
|
+
[
|
|
41
|
+
{
|
|
42
|
+
"from": {
|
|
43
43
|
"pointer": "#/paths/~1pet/get/responses/200/content/application~1json",
|
|
44
44
|
"source": "foobar.yaml",
|
|
45
45
|
},
|
|
46
|
-
"location":
|
|
47
|
-
|
|
46
|
+
"location": [
|
|
47
|
+
{
|
|
48
48
|
"pointer": "#/paths/~1pet/get/responses/200/content/application~1json/example/a",
|
|
49
49
|
"reportOnKey": false,
|
|
50
50
|
"source": "foobar.yaml",
|
|
@@ -53,15 +53,15 @@ describe('no-invalid-media-type-examples', () => {
|
|
|
53
53
|
"message": "Example value must conform to the schema: \`a\` property type must be string.",
|
|
54
54
|
"ruleId": "no-invalid-media-type-examples",
|
|
55
55
|
"severity": "error",
|
|
56
|
-
"suggest":
|
|
56
|
+
"suggest": [],
|
|
57
57
|
},
|
|
58
|
-
|
|
59
|
-
"from":
|
|
58
|
+
{
|
|
59
|
+
"from": {
|
|
60
60
|
"pointer": "#/paths/~1pet/get/responses/200/content/application~1json",
|
|
61
61
|
"source": "foobar.yaml",
|
|
62
62
|
},
|
|
63
|
-
"location":
|
|
64
|
-
|
|
63
|
+
"location": [
|
|
64
|
+
{
|
|
65
65
|
"pointer": "#/paths/~1pet/get/responses/200/content/application~1json/example/b",
|
|
66
66
|
"reportOnKey": false,
|
|
67
67
|
"source": "foobar.yaml",
|
|
@@ -70,7 +70,7 @@ describe('no-invalid-media-type-examples', () => {
|
|
|
70
70
|
"message": "Example value must conform to the schema: \`b\` property type must be number.",
|
|
71
71
|
"ruleId": "no-invalid-media-type-examples",
|
|
72
72
|
"severity": "error",
|
|
73
|
-
"suggest":
|
|
73
|
+
"suggest": [],
|
|
74
74
|
},
|
|
75
75
|
]
|
|
76
76
|
`);
|
|
@@ -115,14 +115,14 @@ describe('no-invalid-media-type-examples', () => {
|
|
|
115
115
|
});
|
|
116
116
|
|
|
117
117
|
expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
"from":
|
|
118
|
+
[
|
|
119
|
+
{
|
|
120
|
+
"from": {
|
|
121
121
|
"pointer": "#/paths/~1pet/get/responses/200/content/application~1json",
|
|
122
122
|
"source": "foobar.yaml",
|
|
123
123
|
},
|
|
124
|
-
"location":
|
|
125
|
-
|
|
124
|
+
"location": [
|
|
125
|
+
{
|
|
126
126
|
"pointer": "#/paths/~1pet/get/responses/200/content/application~1json/example/c",
|
|
127
127
|
"reportOnKey": true,
|
|
128
128
|
"source": "foobar.yaml",
|
|
@@ -131,7 +131,7 @@ describe('no-invalid-media-type-examples', () => {
|
|
|
131
131
|
"message": "Example value must conform to the schema: must NOT have unevaluated properties \`c\`.",
|
|
132
132
|
"ruleId": "no-invalid-media-type-examples",
|
|
133
133
|
"severity": "error",
|
|
134
|
-
"suggest":
|
|
134
|
+
"suggest": [],
|
|
135
135
|
},
|
|
136
136
|
]
|
|
137
137
|
`);
|
|
@@ -174,7 +174,7 @@ describe('no-invalid-media-type-examples', () => {
|
|
|
174
174
|
}),
|
|
175
175
|
});
|
|
176
176
|
|
|
177
|
-
expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`
|
|
177
|
+
expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`[]`);
|
|
178
178
|
});
|
|
179
179
|
|
|
180
180
|
it('should not report on valid example with allowAdditionalProperties and allOf and $ref', async () => {
|
|
@@ -223,7 +223,7 @@ describe('no-invalid-media-type-examples', () => {
|
|
|
223
223
|
}),
|
|
224
224
|
});
|
|
225
225
|
|
|
226
|
-
expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`
|
|
226
|
+
expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`[]`);
|
|
227
227
|
});
|
|
228
228
|
|
|
229
229
|
it('should not on invalid examples', async () => {
|
|
@@ -274,14 +274,14 @@ describe('no-invalid-media-type-examples', () => {
|
|
|
274
274
|
});
|
|
275
275
|
|
|
276
276
|
expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
"from":
|
|
277
|
+
[
|
|
278
|
+
{
|
|
279
|
+
"from": {
|
|
280
280
|
"pointer": "#/paths/~1pet/get/responses/200/content/application~1json",
|
|
281
281
|
"source": "foobar.yaml",
|
|
282
282
|
},
|
|
283
|
-
"location":
|
|
284
|
-
|
|
283
|
+
"location": [
|
|
284
|
+
{
|
|
285
285
|
"pointer": "#/components/examples/test/value/a",
|
|
286
286
|
"reportOnKey": false,
|
|
287
287
|
"source": "foobar.yaml",
|
|
@@ -290,7 +290,7 @@ describe('no-invalid-media-type-examples', () => {
|
|
|
290
290
|
"message": "Example value must conform to the schema: \`a\` property type must be string.",
|
|
291
291
|
"ruleId": "no-invalid-media-type-examples",
|
|
292
292
|
"severity": "error",
|
|
293
|
-
"suggest":
|
|
293
|
+
"suggest": [],
|
|
294
294
|
},
|
|
295
295
|
]
|
|
296
296
|
`);
|
|
@@ -321,7 +321,7 @@ describe('no-invalid-media-type-examples', () => {
|
|
|
321
321
|
config: await makeConfig({ 'no-invalid-media-type-examples': 'error' }),
|
|
322
322
|
});
|
|
323
323
|
|
|
324
|
-
expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`
|
|
324
|
+
expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`[]`);
|
|
325
325
|
});
|
|
326
326
|
|
|
327
327
|
it('should not report if no schema', async () => {
|
|
@@ -353,7 +353,7 @@ describe('no-invalid-media-type-examples', () => {
|
|
|
353
353
|
config: await makeConfig({ 'no-invalid-media-type-examples': 'error' }),
|
|
354
354
|
});
|
|
355
355
|
|
|
356
|
-
expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`
|
|
356
|
+
expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`[]`);
|
|
357
357
|
});
|
|
358
358
|
|
|
359
359
|
it('should work with cross-file $ref', async () => {
|
|
@@ -388,7 +388,7 @@ describe('no-invalid-media-type-examples', () => {
|
|
|
388
388
|
config: await makeConfig({ 'no-invalid-media-type-examples': 'error' }),
|
|
389
389
|
});
|
|
390
390
|
|
|
391
|
-
expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`
|
|
391
|
+
expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`[]`);
|
|
392
392
|
});
|
|
393
393
|
|
|
394
394
|
it('should not throw for ajv throw', async () => {
|
|
@@ -417,23 +417,23 @@ describe('no-invalid-media-type-examples', () => {
|
|
|
417
417
|
});
|
|
418
418
|
|
|
419
419
|
expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
"from":
|
|
420
|
+
[
|
|
421
|
+
{
|
|
422
|
+
"from": {
|
|
423
423
|
"pointer": "#/paths/~1pet/get/responses/200/content/application~1json",
|
|
424
424
|
"source": "foobar.yaml",
|
|
425
425
|
},
|
|
426
|
-
"location":
|
|
427
|
-
|
|
426
|
+
"location": [
|
|
427
|
+
{
|
|
428
428
|
"pointer": "#/paths/~1pet/get/responses/200/content/application~1json/schema",
|
|
429
429
|
"reportOnKey": false,
|
|
430
430
|
"source": "foobar.yaml",
|
|
431
431
|
},
|
|
432
432
|
],
|
|
433
|
-
"message": "Example validation errored:
|
|
433
|
+
"message": "Example validation errored: "nullable" cannot be used without "type".",
|
|
434
434
|
"ruleId": "no-invalid-media-type-examples",
|
|
435
435
|
"severity": "error",
|
|
436
|
-
"suggest":
|
|
436
|
+
"suggest": [],
|
|
437
437
|
},
|
|
438
438
|
]
|
|
439
439
|
`);
|
|
@@ -468,6 +468,6 @@ describe('no-invalid-media-type-examples', () => {
|
|
|
468
468
|
config: await makeConfig({ 'no-invalid-media-type-examples': 'error' }),
|
|
469
469
|
});
|
|
470
470
|
|
|
471
|
-
expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`
|
|
471
|
+
expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`[]`);
|
|
472
472
|
});
|
|
473
473
|
});
|
|
@@ -21,10 +21,10 @@ describe('Oas3 oas3-no-server-example.com', () => {
|
|
|
21
21
|
});
|
|
22
22
|
|
|
23
23
|
expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
"location":
|
|
27
|
-
|
|
24
|
+
[
|
|
25
|
+
{
|
|
26
|
+
"location": [
|
|
27
|
+
{
|
|
28
28
|
"pointer": "#/servers/0/url",
|
|
29
29
|
"reportOnKey": false,
|
|
30
30
|
"source": "foobar.yaml",
|
|
@@ -33,7 +33,7 @@ describe('Oas3 oas3-no-server-example.com', () => {
|
|
|
33
33
|
"message": "Server \`url\` should not point to example.com or localhost.",
|
|
34
34
|
"ruleId": "no-server-example.com",
|
|
35
35
|
"severity": "error",
|
|
36
|
-
"suggest":
|
|
36
|
+
"suggest": [],
|
|
37
37
|
},
|
|
38
38
|
]
|
|
39
39
|
`);
|
|
@@ -55,7 +55,7 @@ describe('Oas3 oas3-no-server-example.com', () => {
|
|
|
55
55
|
config: await makeConfig({ 'no-server-example.com': 'error' }),
|
|
56
56
|
});
|
|
57
57
|
|
|
58
|
-
expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`
|
|
58
|
+
expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`[]`);
|
|
59
59
|
});
|
|
60
60
|
|
|
61
61
|
it('oas3-no-server-example.com: should report on server object with "foo.example.com" url', async () => {
|
|
@@ -75,10 +75,10 @@ describe('Oas3 oas3-no-server-example.com', () => {
|
|
|
75
75
|
});
|
|
76
76
|
|
|
77
77
|
expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
"location":
|
|
81
|
-
|
|
78
|
+
[
|
|
79
|
+
{
|
|
80
|
+
"location": [
|
|
81
|
+
{
|
|
82
82
|
"pointer": "#/servers/0/url",
|
|
83
83
|
"reportOnKey": false,
|
|
84
84
|
"source": "foobar.yaml",
|
|
@@ -87,7 +87,7 @@ describe('Oas3 oas3-no-server-example.com', () => {
|
|
|
87
87
|
"message": "Server \`url\` should not point to example.com or localhost.",
|
|
88
88
|
"ruleId": "no-server-example.com",
|
|
89
89
|
"severity": "error",
|
|
90
|
-
"suggest":
|
|
90
|
+
"suggest": [],
|
|
91
91
|
},
|
|
92
92
|
]
|
|
93
93
|
`);
|
|
@@ -21,10 +21,10 @@ describe('Oas3 oas3-no-server-trailing-slash', () => {
|
|
|
21
21
|
});
|
|
22
22
|
|
|
23
23
|
expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
"location":
|
|
27
|
-
|
|
24
|
+
[
|
|
25
|
+
{
|
|
26
|
+
"location": [
|
|
27
|
+
{
|
|
28
28
|
"pointer": "#/servers/0/url",
|
|
29
29
|
"reportOnKey": false,
|
|
30
30
|
"source": "foobar.yaml",
|
|
@@ -33,7 +33,7 @@ describe('Oas3 oas3-no-server-trailing-slash', () => {
|
|
|
33
33
|
"message": "Server \`url\` should not have a trailing slash.",
|
|
34
34
|
"ruleId": "no-server-trailing-slash",
|
|
35
35
|
"severity": "error",
|
|
36
|
-
"suggest":
|
|
36
|
+
"suggest": [],
|
|
37
37
|
},
|
|
38
38
|
]
|
|
39
39
|
`);
|
|
@@ -55,7 +55,7 @@ describe('Oas3 oas3-no-server-trailing-slash', () => {
|
|
|
55
55
|
config: await makeConfig({ 'no-server-trailing-slash': 'error' }),
|
|
56
56
|
});
|
|
57
57
|
|
|
58
|
-
expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`
|
|
58
|
+
expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`[]`);
|
|
59
59
|
});
|
|
60
60
|
|
|
61
61
|
it('oas3-no-server-trailing-slash: should not report on server object with no trailing slash if the url is root', async () => {
|
|
@@ -74,6 +74,6 @@ describe('Oas3 oas3-no-server-trailing-slash', () => {
|
|
|
74
74
|
config: await makeConfig({ 'no-server-trailing-slash': 'error' }),
|
|
75
75
|
});
|
|
76
76
|
|
|
77
|
-
expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`
|
|
77
|
+
expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`[]`);
|
|
78
78
|
});
|
|
79
79
|
});
|
|
@@ -46,84 +46,84 @@ describe('Oas3 no-unused-components', () => {
|
|
|
46
46
|
});
|
|
47
47
|
|
|
48
48
|
expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
"location":
|
|
52
|
-
|
|
49
|
+
[
|
|
50
|
+
{
|
|
51
|
+
"location": [
|
|
52
|
+
{
|
|
53
53
|
"pointer": "#/components/parameters/unused",
|
|
54
54
|
"reportOnKey": true,
|
|
55
55
|
"source": "foobar.yaml",
|
|
56
56
|
},
|
|
57
57
|
],
|
|
58
|
-
"message": "Component:
|
|
58
|
+
"message": "Component: "unused" is never used.",
|
|
59
59
|
"ruleId": "no-unused-components",
|
|
60
60
|
"severity": "error",
|
|
61
|
-
"suggest":
|
|
61
|
+
"suggest": [],
|
|
62
62
|
},
|
|
63
|
-
|
|
64
|
-
"location":
|
|
65
|
-
|
|
63
|
+
{
|
|
64
|
+
"location": [
|
|
65
|
+
{
|
|
66
66
|
"pointer": "#/components/schemas/Unused",
|
|
67
67
|
"reportOnKey": true,
|
|
68
68
|
"source": "foobar.yaml",
|
|
69
69
|
},
|
|
70
70
|
],
|
|
71
|
-
"message": "Component:
|
|
71
|
+
"message": "Component: "Unused" is never used.",
|
|
72
72
|
"ruleId": "no-unused-components",
|
|
73
73
|
"severity": "error",
|
|
74
|
-
"suggest":
|
|
74
|
+
"suggest": [],
|
|
75
75
|
},
|
|
76
|
-
|
|
77
|
-
"location":
|
|
78
|
-
|
|
76
|
+
{
|
|
77
|
+
"location": [
|
|
78
|
+
{
|
|
79
79
|
"pointer": "#/components/responses/unused",
|
|
80
80
|
"reportOnKey": true,
|
|
81
81
|
"source": "foobar.yaml",
|
|
82
82
|
},
|
|
83
83
|
],
|
|
84
|
-
"message": "Component:
|
|
84
|
+
"message": "Component: "unused" is never used.",
|
|
85
85
|
"ruleId": "no-unused-components",
|
|
86
86
|
"severity": "error",
|
|
87
|
-
"suggest":
|
|
87
|
+
"suggest": [],
|
|
88
88
|
},
|
|
89
|
-
|
|
90
|
-
"location":
|
|
91
|
-
|
|
89
|
+
{
|
|
90
|
+
"location": [
|
|
91
|
+
{
|
|
92
92
|
"pointer": "#/components/examples/unused",
|
|
93
93
|
"reportOnKey": true,
|
|
94
94
|
"source": "foobar.yaml",
|
|
95
95
|
},
|
|
96
96
|
],
|
|
97
|
-
"message": "Component:
|
|
97
|
+
"message": "Component: "unused" is never used.",
|
|
98
98
|
"ruleId": "no-unused-components",
|
|
99
99
|
"severity": "error",
|
|
100
|
-
"suggest":
|
|
100
|
+
"suggest": [],
|
|
101
101
|
},
|
|
102
|
-
|
|
103
|
-
"location":
|
|
104
|
-
|
|
102
|
+
{
|
|
103
|
+
"location": [
|
|
104
|
+
{
|
|
105
105
|
"pointer": "#/components/requestBodies/unused",
|
|
106
106
|
"reportOnKey": true,
|
|
107
107
|
"source": "foobar.yaml",
|
|
108
108
|
},
|
|
109
109
|
],
|
|
110
|
-
"message": "Component:
|
|
110
|
+
"message": "Component: "unused" is never used.",
|
|
111
111
|
"ruleId": "no-unused-components",
|
|
112
112
|
"severity": "error",
|
|
113
|
-
"suggest":
|
|
113
|
+
"suggest": [],
|
|
114
114
|
},
|
|
115
|
-
|
|
116
|
-
"location":
|
|
117
|
-
|
|
115
|
+
{
|
|
116
|
+
"location": [
|
|
117
|
+
{
|
|
118
118
|
"pointer": "#/components/headers/unused",
|
|
119
119
|
"reportOnKey": true,
|
|
120
120
|
"source": "foobar.yaml",
|
|
121
121
|
},
|
|
122
122
|
],
|
|
123
|
-
"message": "Component:
|
|
123
|
+
"message": "Component: "unused" is never used.",
|
|
124
124
|
"ruleId": "no-unused-components",
|
|
125
125
|
"severity": "error",
|
|
126
|
-
"suggest":
|
|
126
|
+
"suggest": [],
|
|
127
127
|
},
|
|
128
128
|
]
|
|
129
129
|
`);
|
|
@@ -35,10 +35,10 @@ describe('Oas3 operation-4xx-problem-details-rfc7807', () => {
|
|
|
35
35
|
config: await makeConfig({ 'operation-4xx-problem-details-rfc7807': 'error' }),
|
|
36
36
|
});
|
|
37
37
|
expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
"location":
|
|
41
|
-
|
|
38
|
+
[
|
|
39
|
+
{
|
|
40
|
+
"location": [
|
|
41
|
+
{
|
|
42
42
|
"pointer": "#/paths/~1pets/get/responses/400",
|
|
43
43
|
"reportOnKey": true,
|
|
44
44
|
"source": "foobar.yaml",
|
|
@@ -47,7 +47,7 @@ describe('Oas3 operation-4xx-problem-details-rfc7807', () => {
|
|
|
47
47
|
"message": "Response \`4xx\` must have content-type \`application/problem+json\`.",
|
|
48
48
|
"ruleId": "operation-4xx-problem-details-rfc7807",
|
|
49
49
|
"severity": "error",
|
|
50
|
-
"suggest":
|
|
50
|
+
"suggest": [],
|
|
51
51
|
},
|
|
52
52
|
]
|
|
53
53
|
`);
|
|
@@ -82,10 +82,10 @@ describe('Oas3 operation-4xx-problem-details-rfc7807', () => {
|
|
|
82
82
|
config: await makeConfig({ 'operation-4xx-problem-details-rfc7807': 'error' }),
|
|
83
83
|
});
|
|
84
84
|
expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
"location":
|
|
88
|
-
|
|
85
|
+
[
|
|
86
|
+
{
|
|
87
|
+
"location": [
|
|
88
|
+
{
|
|
89
89
|
"pointer": "#/paths/~1pets/get/responses/400/content/application~1problem+json/schema/properties/type",
|
|
90
90
|
"reportOnKey": true,
|
|
91
91
|
"source": "foobar.yaml",
|
|
@@ -94,7 +94,7 @@ describe('Oas3 operation-4xx-problem-details-rfc7807', () => {
|
|
|
94
94
|
"message": "SchemaProperties object should contain \`type\` field.",
|
|
95
95
|
"ruleId": "operation-4xx-problem-details-rfc7807",
|
|
96
96
|
"severity": "error",
|
|
97
|
-
"suggest":
|
|
97
|
+
"suggest": [],
|
|
98
98
|
},
|
|
99
99
|
]
|
|
100
100
|
`);
|
|
@@ -125,10 +125,10 @@ describe('Oas3 operation-4xx-problem-details-rfc7807', () => {
|
|
|
125
125
|
config: await makeConfig({ 'operation-4xx-problem-details-rfc7807': 'error' }),
|
|
126
126
|
});
|
|
127
127
|
expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
"location":
|
|
131
|
-
|
|
128
|
+
[
|
|
129
|
+
{
|
|
130
|
+
"location": [
|
|
131
|
+
{
|
|
132
132
|
"pointer": "#/paths/~1pets/get/responses/400/content/application~1problem+json/schema",
|
|
133
133
|
"reportOnKey": true,
|
|
134
134
|
"source": "foobar.yaml",
|
|
@@ -137,7 +137,7 @@ describe('Oas3 operation-4xx-problem-details-rfc7807', () => {
|
|
|
137
137
|
"message": "MediaType object should contain \`schema\` field.",
|
|
138
138
|
"ruleId": "operation-4xx-problem-details-rfc7807",
|
|
139
139
|
"severity": "error",
|
|
140
|
-
"suggest":
|
|
140
|
+
"suggest": [],
|
|
141
141
|
},
|
|
142
142
|
]
|
|
143
143
|
`);
|
|
@@ -34,10 +34,10 @@ describe('Oas3 response-contains-header', () => {
|
|
|
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/200/headers",
|
|
42
42
|
"reportOnKey": true,
|
|
43
43
|
"source": Source {
|
|
@@ -61,10 +61,10 @@ describe('Oas3 response-contains-header', () => {
|
|
|
61
61
|
},
|
|
62
62
|
},
|
|
63
63
|
],
|
|
64
|
-
"message": "Response object must contain a
|
|
64
|
+
"message": "Response object must contain a "Content-Length" header.",
|
|
65
65
|
"ruleId": "response-contains-header",
|
|
66
66
|
"severity": "error",
|
|
67
|
-
"suggest":
|
|
67
|
+
"suggest": [],
|
|
68
68
|
},
|
|
69
69
|
]
|
|
70
70
|
`);
|
|
@@ -117,10 +117,10 @@ describe('Oas3 response-contains-header', () => {
|
|
|
117
117
|
}),
|
|
118
118
|
});
|
|
119
119
|
expect(results).toMatchInlineSnapshot(`
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
"location":
|
|
123
|
-
|
|
120
|
+
[
|
|
121
|
+
{
|
|
122
|
+
"location": [
|
|
123
|
+
{
|
|
124
124
|
"pointer": "#/paths/~1store~1subscribe/post/responses/200/headers",
|
|
125
125
|
"reportOnKey": true,
|
|
126
126
|
"source": Source {
|
|
@@ -159,14 +159,14 @@ describe('Oas3 response-contains-header', () => {
|
|
|
159
159
|
},
|
|
160
160
|
},
|
|
161
161
|
],
|
|
162
|
-
"message": "Response object must contain a
|
|
162
|
+
"message": "Response object must contain a "x-request-id" header.",
|
|
163
163
|
"ruleId": "response-contains-header",
|
|
164
164
|
"severity": "error",
|
|
165
|
-
"suggest":
|
|
165
|
+
"suggest": [],
|
|
166
166
|
},
|
|
167
|
-
|
|
168
|
-
"location":
|
|
169
|
-
|
|
167
|
+
{
|
|
168
|
+
"location": [
|
|
169
|
+
{
|
|
170
170
|
"pointer": "#/paths/~1store~1subscribe/post/responses/400/headers",
|
|
171
171
|
"reportOnKey": true,
|
|
172
172
|
"source": Source {
|
|
@@ -205,10 +205,10 @@ describe('Oas3 response-contains-header', () => {
|
|
|
205
205
|
},
|
|
206
206
|
},
|
|
207
207
|
],
|
|
208
|
-
"message": "Response object must contain a
|
|
208
|
+
"message": "Response object must contain a "Content-Length" header.",
|
|
209
209
|
"ruleId": "response-contains-header",
|
|
210
210
|
"severity": "error",
|
|
211
|
-
"suggest":
|
|
211
|
+
"suggest": [],
|
|
212
212
|
},
|
|
213
213
|
]
|
|
214
214
|
`);
|
|
@@ -268,7 +268,7 @@ describe('Oas3 response-contains-header', () => {
|
|
|
268
268
|
},
|
|
269
269
|
}),
|
|
270
270
|
});
|
|
271
|
-
expect(results).toMatchInlineSnapshot(`
|
|
271
|
+
expect(results).toMatchInlineSnapshot(`[]`);
|
|
272
272
|
});
|
|
273
273
|
|
|
274
274
|
it('should not report response object containing header name upper cased', async () => {
|
|
@@ -300,7 +300,7 @@ describe('Oas3 response-contains-header', () => {
|
|
|
300
300
|
},
|
|
301
301
|
}),
|
|
302
302
|
});
|
|
303
|
-
expect(results).toMatchInlineSnapshot(`
|
|
303
|
+
expect(results).toMatchInlineSnapshot(`[]`);
|
|
304
304
|
});
|
|
305
305
|
|
|
306
306
|
it('should not report response object containing header name in the rule upper cased', async () => {
|
|
@@ -332,7 +332,7 @@ describe('Oas3 response-contains-header', () => {
|
|
|
332
332
|
},
|
|
333
333
|
}),
|
|
334
334
|
});
|
|
335
|
-
expect(results).toMatchInlineSnapshot(`
|
|
335
|
+
expect(results).toMatchInlineSnapshot(`[]`);
|
|
336
336
|
});
|
|
337
337
|
|
|
338
338
|
it('should report even if the response is null', async () => {
|
|
@@ -360,10 +360,10 @@ describe('Oas3 response-contains-header', () => {
|
|
|
360
360
|
});
|
|
361
361
|
|
|
362
362
|
expect(results).toMatchInlineSnapshot(`
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
"location":
|
|
366
|
-
|
|
363
|
+
[
|
|
364
|
+
{
|
|
365
|
+
"location": [
|
|
366
|
+
{
|
|
367
367
|
"pointer": "#/paths/~1test~1/put/responses/200/headers",
|
|
368
368
|
"reportOnKey": true,
|
|
369
369
|
"source": Source {
|
|
@@ -378,10 +378,10 @@ describe('Oas3 response-contains-header', () => {
|
|
|
378
378
|
},
|
|
379
379
|
},
|
|
380
380
|
],
|
|
381
|
-
"message": "Response object must contain a
|
|
381
|
+
"message": "Response object must contain a "X-Test-Header" header.",
|
|
382
382
|
"ruleId": "response-contains-header",
|
|
383
383
|
"severity": "error",
|
|
384
|
-
"suggest":
|
|
384
|
+
"suggest": [],
|
|
385
385
|
},
|
|
386
386
|
]
|
|
387
387
|
`);
|