@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
|
@@ -25,10 +25,10 @@ describe('Oas3 operation-4xx-response', () => {
|
|
|
25
25
|
});
|
|
26
26
|
|
|
27
27
|
expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
"location":
|
|
31
|
-
|
|
28
|
+
[
|
|
29
|
+
{
|
|
30
|
+
"location": [
|
|
31
|
+
{
|
|
32
32
|
"pointer": "#/paths/~1test/put/responses",
|
|
33
33
|
"reportOnKey": true,
|
|
34
34
|
"source": "foobar.yaml",
|
|
@@ -37,7 +37,7 @@ describe('Oas3 operation-4xx-response', () => {
|
|
|
37
37
|
"message": "Operation must have at least one \`4XX\` response.",
|
|
38
38
|
"ruleId": "operation-4xx-response",
|
|
39
39
|
"severity": "error",
|
|
40
|
-
"suggest":
|
|
40
|
+
"suggest": [],
|
|
41
41
|
},
|
|
42
42
|
]
|
|
43
43
|
`);
|
|
@@ -63,7 +63,7 @@ describe('Oas3 operation-4xx-response', () => {
|
|
|
63
63
|
config: await makeConfig({ 'operation-4xx-response': 'error' }),
|
|
64
64
|
});
|
|
65
65
|
|
|
66
|
-
expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`
|
|
66
|
+
expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`[]`);
|
|
67
67
|
});
|
|
68
68
|
|
|
69
69
|
it('should not report for present 4XX response', async () => {
|
|
@@ -86,7 +86,7 @@ describe('Oas3 operation-4xx-response', () => {
|
|
|
86
86
|
config: await makeConfig({ 'operation-4xx-response': 'error' }),
|
|
87
87
|
});
|
|
88
88
|
|
|
89
|
-
expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`
|
|
89
|
+
expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`[]`);
|
|
90
90
|
});
|
|
91
91
|
|
|
92
92
|
it('should report if default is present but missing 4xx response', async () => {
|
|
@@ -110,10 +110,10 @@ describe('Oas3 operation-4xx-response', () => {
|
|
|
110
110
|
});
|
|
111
111
|
|
|
112
112
|
expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
"location":
|
|
116
|
-
|
|
113
|
+
[
|
|
114
|
+
{
|
|
115
|
+
"location": [
|
|
116
|
+
{
|
|
117
117
|
"pointer": "#/paths/~1test~1/put/responses",
|
|
118
118
|
"reportOnKey": true,
|
|
119
119
|
"source": "foobar.yaml",
|
|
@@ -122,7 +122,7 @@ describe('Oas3 operation-4xx-response', () => {
|
|
|
122
122
|
"message": "Operation must have at least one \`4XX\` response.",
|
|
123
123
|
"ruleId": "operation-4xx-response",
|
|
124
124
|
"severity": "error",
|
|
125
|
-
"suggest":
|
|
125
|
+
"suggest": [],
|
|
126
126
|
},
|
|
127
127
|
]
|
|
128
128
|
`);
|
|
@@ -147,10 +147,10 @@ describe('Oas3 operation-4xx-response', () => {
|
|
|
147
147
|
});
|
|
148
148
|
|
|
149
149
|
expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
"location":
|
|
153
|
-
|
|
150
|
+
[
|
|
151
|
+
{
|
|
152
|
+
"location": [
|
|
153
|
+
{
|
|
154
154
|
"pointer": "#/paths/~1test~1/put/responses",
|
|
155
155
|
"reportOnKey": true,
|
|
156
156
|
"source": "foobar.yaml",
|
|
@@ -159,7 +159,7 @@ describe('Oas3 operation-4xx-response', () => {
|
|
|
159
159
|
"message": "Operation must have at least one \`2XX\` response.",
|
|
160
160
|
"ruleId": "operation-2xx-response",
|
|
161
161
|
"severity": "error",
|
|
162
|
-
"suggest":
|
|
162
|
+
"suggest": [],
|
|
163
163
|
},
|
|
164
164
|
]
|
|
165
165
|
`);
|
|
@@ -188,10 +188,10 @@ describe('Oas3 operation-4xx-response', () => {
|
|
|
188
188
|
});
|
|
189
189
|
|
|
190
190
|
expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
"location":
|
|
194
|
-
|
|
191
|
+
[
|
|
192
|
+
{
|
|
193
|
+
"location": [
|
|
194
|
+
{
|
|
195
195
|
"pointer": "#/webhooks/~1test~1/put/responses",
|
|
196
196
|
"reportOnKey": true,
|
|
197
197
|
"source": "foobar.yaml",
|
|
@@ -200,7 +200,7 @@ describe('Oas3 operation-4xx-response', () => {
|
|
|
200
200
|
"message": "Operation must have at least one \`4XX\` response.",
|
|
201
201
|
"ruleId": "operation-4xx-response",
|
|
202
202
|
"severity": "error",
|
|
203
|
-
"suggest":
|
|
203
|
+
"suggest": [],
|
|
204
204
|
},
|
|
205
205
|
]
|
|
206
206
|
`);
|
|
@@ -226,6 +226,6 @@ describe('Oas3 operation-4xx-response', () => {
|
|
|
226
226
|
config: await makeConfig({ 'operation-4xx-response': 'error' }),
|
|
227
227
|
});
|
|
228
228
|
|
|
229
|
-
expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`
|
|
229
|
+
expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`[]`);
|
|
230
230
|
});
|
|
231
231
|
});
|
|
@@ -30,10 +30,10 @@ describe('Oas3 operation-operationId-unique', () => {
|
|
|
30
30
|
});
|
|
31
31
|
|
|
32
32
|
expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
"location":
|
|
36
|
-
|
|
33
|
+
[
|
|
34
|
+
{
|
|
35
|
+
"location": [
|
|
36
|
+
{
|
|
37
37
|
"pointer": "#/paths/~1test2/post/test2",
|
|
38
38
|
"reportOnKey": false,
|
|
39
39
|
"source": "foobar.yaml",
|
|
@@ -42,7 +42,7 @@ describe('Oas3 operation-operationId-unique', () => {
|
|
|
42
42
|
"message": "Every operation must have a unique \`operationId\`.",
|
|
43
43
|
"ruleId": "operation-operationId-unique",
|
|
44
44
|
"severity": "error",
|
|
45
|
-
"suggest":
|
|
45
|
+
"suggest": [],
|
|
46
46
|
},
|
|
47
47
|
]
|
|
48
48
|
`);
|
|
@@ -71,6 +71,6 @@ describe('Oas3 operation-operationId-unique', () => {
|
|
|
71
71
|
config: await makeConfig({ 'peration-operationId-unique': 'error' }),
|
|
72
72
|
});
|
|
73
73
|
|
|
74
|
-
expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`
|
|
74
|
+
expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`[]`);
|
|
75
75
|
});
|
|
76
76
|
});
|
|
@@ -25,10 +25,10 @@ describe('Oas3 operation-operationId-url-safe', () => {
|
|
|
25
25
|
});
|
|
26
26
|
|
|
27
27
|
expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
"location":
|
|
31
|
-
|
|
28
|
+
[
|
|
29
|
+
{
|
|
30
|
+
"location": [
|
|
31
|
+
{
|
|
32
32
|
"pointer": "#/paths/~1test/put/operationId",
|
|
33
33
|
"reportOnKey": false,
|
|
34
34
|
"source": "foobar.yaml",
|
|
@@ -37,7 +37,7 @@ describe('Oas3 operation-operationId-url-safe', () => {
|
|
|
37
37
|
"message": "Operation \`operationId\` should not have URL invalid characters.",
|
|
38
38
|
"ruleId": "operation-operationId-url-safe",
|
|
39
39
|
"severity": "error",
|
|
40
|
-
"suggest":
|
|
40
|
+
"suggest": [],
|
|
41
41
|
},
|
|
42
42
|
]
|
|
43
43
|
`);
|
|
@@ -26,10 +26,10 @@ describe('Oas3 operation-parameters-unique', () => {
|
|
|
26
26
|
});
|
|
27
27
|
|
|
28
28
|
expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
"location":
|
|
32
|
-
|
|
29
|
+
[
|
|
30
|
+
{
|
|
31
|
+
"location": [
|
|
32
|
+
{
|
|
33
33
|
"pointer": "#/paths/~1test/parameters/1",
|
|
34
34
|
"reportOnKey": false,
|
|
35
35
|
"source": "foobar.yaml",
|
|
@@ -39,7 +39,7 @@ describe('Oas3 operation-parameters-unique', () => {
|
|
|
39
39
|
Repeats of \`in:query\` + \`name:a\`.",
|
|
40
40
|
"ruleId": "operation-parameters-unique",
|
|
41
41
|
"severity": "error",
|
|
42
|
-
"suggest":
|
|
42
|
+
"suggest": [],
|
|
43
43
|
},
|
|
44
44
|
]
|
|
45
45
|
`);
|
|
@@ -68,7 +68,7 @@ describe('Oas3 operation-parameters-unique', () => {
|
|
|
68
68
|
config: await makeConfig({ 'operation-parameters-unique': 'error' }),
|
|
69
69
|
});
|
|
70
70
|
|
|
71
|
-
expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`
|
|
71
|
+
expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`[]`);
|
|
72
72
|
});
|
|
73
73
|
|
|
74
74
|
it('should report when operation with duplicated params', async () => {
|
|
@@ -99,10 +99,10 @@ describe('Oas3 operation-parameters-unique', () => {
|
|
|
99
99
|
});
|
|
100
100
|
|
|
101
101
|
expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
"location":
|
|
105
|
-
|
|
102
|
+
[
|
|
103
|
+
{
|
|
104
|
+
"location": [
|
|
105
|
+
{
|
|
106
106
|
"pointer": "#/paths/~1test/put/parameters/2",
|
|
107
107
|
"reportOnKey": false,
|
|
108
108
|
"source": "foobar.yaml",
|
|
@@ -111,7 +111,7 @@ describe('Oas3 operation-parameters-unique', () => {
|
|
|
111
111
|
"message": "Operations must have unique \`name\` + \`in\` parameters. Repeats of \`in:query\` + \`name:a\`.",
|
|
112
112
|
"ruleId": "operation-parameters-unique",
|
|
113
113
|
"severity": "error",
|
|
114
|
-
"suggest":
|
|
114
|
+
"suggest": [],
|
|
115
115
|
},
|
|
116
116
|
]
|
|
117
117
|
`);
|
|
@@ -147,10 +147,10 @@ describe('Oas3 operation-parameters-unique', () => {
|
|
|
147
147
|
});
|
|
148
148
|
|
|
149
149
|
expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
"location":
|
|
153
|
-
|
|
150
|
+
[
|
|
151
|
+
{
|
|
152
|
+
"location": [
|
|
153
|
+
{
|
|
154
154
|
"pointer": "#/paths/~1test/put/parameters/2",
|
|
155
155
|
"reportOnKey": false,
|
|
156
156
|
"source": "foobar.yaml",
|
|
@@ -159,7 +159,7 @@ describe('Oas3 operation-parameters-unique', () => {
|
|
|
159
159
|
"message": "Operations must have unique \`name\` + \`in\` parameters. Repeats of \`in:query\` + \`name:a\`.",
|
|
160
160
|
"ruleId": "operation-parameters-unique",
|
|
161
161
|
"severity": "error",
|
|
162
|
-
"suggest":
|
|
162
|
+
"suggest": [],
|
|
163
163
|
},
|
|
164
164
|
]
|
|
165
165
|
`);
|
|
@@ -28,10 +28,10 @@ describe('Oas3 operation-singular-tag', () => {
|
|
|
28
28
|
});
|
|
29
29
|
|
|
30
30
|
expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
"location":
|
|
34
|
-
|
|
31
|
+
[
|
|
32
|
+
{
|
|
33
|
+
"location": [
|
|
34
|
+
{
|
|
35
35
|
"pointer": "#/paths/~1some/get/tags",
|
|
36
36
|
"reportOnKey": true,
|
|
37
37
|
"source": "foobar.yaml",
|
|
@@ -40,7 +40,7 @@ describe('Oas3 operation-singular-tag', () => {
|
|
|
40
40
|
"message": "Operation \`tags\` object should have only one tag.",
|
|
41
41
|
"ruleId": "operation-singular-tag",
|
|
42
42
|
"severity": "error",
|
|
43
|
-
"suggest":
|
|
43
|
+
"suggest": [],
|
|
44
44
|
},
|
|
45
45
|
]
|
|
46
46
|
`);
|
|
@@ -67,6 +67,6 @@ describe('Oas3 operation-singular-tag', () => {
|
|
|
67
67
|
config: await makeConfig({ 'operation-singular-tag': 'error' }),
|
|
68
68
|
});
|
|
69
69
|
|
|
70
|
-
expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`
|
|
70
|
+
expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`[]`);
|
|
71
71
|
});
|
|
72
72
|
});
|
|
@@ -27,10 +27,10 @@ describe('Common path-http-verbs-order', () => {
|
|
|
27
27
|
});
|
|
28
28
|
|
|
29
29
|
expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
"location":
|
|
33
|
-
|
|
30
|
+
[
|
|
31
|
+
{
|
|
32
|
+
"location": [
|
|
33
|
+
{
|
|
34
34
|
"pointer": "#/paths/~1some/post",
|
|
35
35
|
"reportOnKey": true,
|
|
36
36
|
"source": "foobar.yaml",
|
|
@@ -39,11 +39,11 @@ describe('Common path-http-verbs-order', () => {
|
|
|
39
39
|
"message": "Operation http verbs must be ordered.",
|
|
40
40
|
"ruleId": "path-http-verbs-order",
|
|
41
41
|
"severity": "error",
|
|
42
|
-
"suggest":
|
|
42
|
+
"suggest": [],
|
|
43
43
|
},
|
|
44
|
-
|
|
45
|
-
"location":
|
|
46
|
-
|
|
44
|
+
{
|
|
45
|
+
"location": [
|
|
46
|
+
{
|
|
47
47
|
"pointer": "#/paths/~1some/get",
|
|
48
48
|
"reportOnKey": true,
|
|
49
49
|
"source": "foobar.yaml",
|
|
@@ -52,7 +52,7 @@ describe('Common path-http-verbs-order', () => {
|
|
|
52
52
|
"message": "Operation http verbs must be ordered.",
|
|
53
53
|
"ruleId": "path-http-verbs-order",
|
|
54
54
|
"severity": "error",
|
|
55
|
-
"suggest":
|
|
55
|
+
"suggest": [],
|
|
56
56
|
},
|
|
57
57
|
]
|
|
58
58
|
`);
|
|
@@ -90,6 +90,6 @@ describe('Common path-http-verbs-order', () => {
|
|
|
90
90
|
config: await makeConfig({ 'path-http-verbs-order': 'error' }),
|
|
91
91
|
});
|
|
92
92
|
|
|
93
|
-
expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`
|
|
93
|
+
expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`[]`);
|
|
94
94
|
});
|
|
95
95
|
});
|
|
@@ -23,10 +23,10 @@ describe('Oas3 path-not-include-query', () => {
|
|
|
23
23
|
});
|
|
24
24
|
|
|
25
25
|
expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
"location":
|
|
29
|
-
|
|
26
|
+
[
|
|
27
|
+
{
|
|
28
|
+
"location": [
|
|
29
|
+
{
|
|
30
30
|
"pointer": "#/paths/~1some?input",
|
|
31
31
|
"reportOnKey": true,
|
|
32
32
|
"source": "foobar.yaml",
|
|
@@ -35,7 +35,7 @@ describe('Oas3 path-not-include-query', () => {
|
|
|
35
35
|
"message": "Don't put query string items in the path, they belong in parameters with \`in: query\`.",
|
|
36
36
|
"ruleId": "path-not-include-query",
|
|
37
37
|
"severity": "error",
|
|
38
|
-
"suggest":
|
|
38
|
+
"suggest": [],
|
|
39
39
|
},
|
|
40
40
|
]
|
|
41
41
|
`);
|
|
@@ -59,6 +59,6 @@ describe('Oas3 path-not-include-query', () => {
|
|
|
59
59
|
config: await makeConfig({ 'path-not-include-query': 'error' }),
|
|
60
60
|
});
|
|
61
61
|
|
|
62
|
-
expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`
|
|
62
|
+
expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`[]`);
|
|
63
63
|
});
|
|
64
64
|
});
|
|
@@ -27,7 +27,7 @@ describe('Oas3 path-params-defined', () => {
|
|
|
27
27
|
config: await makeConfig({ 'path-params-defined': 'error' }),
|
|
28
28
|
});
|
|
29
29
|
|
|
30
|
-
expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`
|
|
30
|
+
expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`[]`);
|
|
31
31
|
});
|
|
32
32
|
|
|
33
33
|
it('should report on undefined param params', async () => {
|
|
@@ -56,10 +56,10 @@ describe('Oas3 path-params-defined', () => {
|
|
|
56
56
|
});
|
|
57
57
|
|
|
58
58
|
expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
"location":
|
|
62
|
-
|
|
59
|
+
[
|
|
60
|
+
{
|
|
61
|
+
"location": [
|
|
62
|
+
{
|
|
63
63
|
"pointer": "#/paths/~1pets~1{a}~1{b}/get/parameters",
|
|
64
64
|
"reportOnKey": true,
|
|
65
65
|
"source": "foobar.yaml",
|
|
@@ -68,7 +68,7 @@ describe('Oas3 path-params-defined', () => {
|
|
|
68
68
|
"message": "The operation does not define the path parameter \`{b}\` expected by path \`/pets/{a}/{b}\`.",
|
|
69
69
|
"ruleId": "path-params-defined",
|
|
70
70
|
"severity": "error",
|
|
71
|
-
"suggest":
|
|
71
|
+
"suggest": [],
|
|
72
72
|
},
|
|
73
73
|
]
|
|
74
74
|
`);
|
|
@@ -100,10 +100,10 @@ describe('Oas3 path-params-defined', () => {
|
|
|
100
100
|
});
|
|
101
101
|
|
|
102
102
|
expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
"location":
|
|
106
|
-
|
|
103
|
+
[
|
|
104
|
+
{
|
|
105
|
+
"location": [
|
|
106
|
+
{
|
|
107
107
|
"pointer": "#/paths/~1pets~1{a}/parameters/1/name",
|
|
108
108
|
"reportOnKey": false,
|
|
109
109
|
"source": "foobar.yaml",
|
|
@@ -112,11 +112,11 @@ describe('Oas3 path-params-defined', () => {
|
|
|
112
112
|
"message": "Path parameter \`d\` is not used in the path \`/pets/{a}\`.",
|
|
113
113
|
"ruleId": "path-params-defined",
|
|
114
114
|
"severity": "error",
|
|
115
|
-
"suggest":
|
|
115
|
+
"suggest": [],
|
|
116
116
|
},
|
|
117
|
-
|
|
118
|
-
"location":
|
|
119
|
-
|
|
117
|
+
{
|
|
118
|
+
"location": [
|
|
119
|
+
{
|
|
120
120
|
"pointer": "#/paths/~1pets~1{a}/get/parameters/0/name",
|
|
121
121
|
"reportOnKey": false,
|
|
122
122
|
"source": "foobar.yaml",
|
|
@@ -125,7 +125,7 @@ describe('Oas3 path-params-defined', () => {
|
|
|
125
125
|
"message": "Path parameter \`c\` is not used in the path \`/pets/{a}\`.",
|
|
126
126
|
"ruleId": "path-params-defined",
|
|
127
127
|
"severity": "error",
|
|
128
|
-
"suggest":
|
|
128
|
+
"suggest": [],
|
|
129
129
|
},
|
|
130
130
|
]
|
|
131
131
|
`);
|
|
@@ -154,10 +154,10 @@ describe('Oas3 path-params-defined', () => {
|
|
|
154
154
|
});
|
|
155
155
|
|
|
156
156
|
expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
"location":
|
|
160
|
-
|
|
157
|
+
[
|
|
158
|
+
{
|
|
159
|
+
"location": [
|
|
160
|
+
{
|
|
161
161
|
"pointer": "#/paths/~1pets~1{a}/post/parameters",
|
|
162
162
|
"reportOnKey": true,
|
|
163
163
|
"source": "foobar.yaml",
|
|
@@ -166,7 +166,7 @@ describe('Oas3 path-params-defined', () => {
|
|
|
166
166
|
"message": "The operation does not define the path parameter \`{a}\` expected by path \`/pets/{a}\`.",
|
|
167
167
|
"ruleId": "path-params-defined",
|
|
168
168
|
"severity": "error",
|
|
169
|
-
"suggest":
|
|
169
|
+
"suggest": [],
|
|
170
170
|
},
|
|
171
171
|
]
|
|
172
172
|
`);
|
|
@@ -197,6 +197,6 @@ describe('Oas3 path-params-defined', () => {
|
|
|
197
197
|
config: await makeConfig({ 'path-params-defined': 'error' }),
|
|
198
198
|
});
|
|
199
199
|
|
|
200
|
-
expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`
|
|
200
|
+
expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`[]`);
|
|
201
201
|
});
|
|
202
202
|
});
|
|
@@ -26,10 +26,10 @@ describe('Oas3 paths-kebab-case', () => {
|
|
|
26
26
|
});
|
|
27
27
|
|
|
28
28
|
expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
"location":
|
|
32
|
-
|
|
29
|
+
[
|
|
30
|
+
{
|
|
31
|
+
"location": [
|
|
32
|
+
{
|
|
33
33
|
"pointer": "#/paths/~1someTest",
|
|
34
34
|
"reportOnKey": true,
|
|
35
35
|
"source": "foobar.yaml",
|
|
@@ -38,7 +38,7 @@ describe('Oas3 paths-kebab-case', () => {
|
|
|
38
38
|
"message": "\`/someTest\` does not use kebab-case.",
|
|
39
39
|
"ruleId": "paths-kebab-case",
|
|
40
40
|
"severity": "error",
|
|
41
|
-
"suggest":
|
|
41
|
+
"suggest": [],
|
|
42
42
|
},
|
|
43
43
|
]
|
|
44
44
|
`);
|
|
@@ -65,10 +65,10 @@ describe('Oas3 paths-kebab-case', () => {
|
|
|
65
65
|
});
|
|
66
66
|
|
|
67
67
|
expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
"location":
|
|
71
|
-
|
|
68
|
+
[
|
|
69
|
+
{
|
|
70
|
+
"location": [
|
|
71
|
+
{
|
|
72
72
|
"pointer": "#/paths/~1some_test",
|
|
73
73
|
"reportOnKey": true,
|
|
74
74
|
"source": "foobar.yaml",
|
|
@@ -77,7 +77,7 @@ describe('Oas3 paths-kebab-case', () => {
|
|
|
77
77
|
"message": "\`/some_test\` does not use kebab-case.",
|
|
78
78
|
"ruleId": "paths-kebab-case",
|
|
79
79
|
"severity": "error",
|
|
80
|
-
"suggest":
|
|
80
|
+
"suggest": [],
|
|
81
81
|
},
|
|
82
82
|
]
|
|
83
83
|
`);
|
|
@@ -103,6 +103,6 @@ describe('Oas3 paths-kebab-case', () => {
|
|
|
103
103
|
'no-path-trailing-slash': 'off',
|
|
104
104
|
}),
|
|
105
105
|
});
|
|
106
|
-
expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`
|
|
106
|
+
expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`[]`);
|
|
107
107
|
});
|
|
108
108
|
});
|
|
@@ -28,19 +28,19 @@ describe('Oas3 scalar-property-missing-example', () => {
|
|
|
28
28
|
});
|
|
29
29
|
|
|
30
30
|
expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
"location":
|
|
34
|
-
|
|
31
|
+
[
|
|
32
|
+
{
|
|
33
|
+
"location": [
|
|
34
|
+
{
|
|
35
35
|
"pointer": "#/components/schemas/User/properties/email",
|
|
36
36
|
"reportOnKey": true,
|
|
37
37
|
"source": "foobar.yaml",
|
|
38
38
|
},
|
|
39
39
|
],
|
|
40
|
-
"message": "Scalar property should have
|
|
40
|
+
"message": "Scalar property should have "example" defined.",
|
|
41
41
|
"ruleId": "scalar-property-missing-example",
|
|
42
42
|
"severity": "error",
|
|
43
|
-
"suggest":
|
|
43
|
+
"suggest": [],
|
|
44
44
|
},
|
|
45
45
|
]
|
|
46
46
|
`);
|
|
@@ -72,19 +72,19 @@ describe('Oas3.1 scalar-property-missing-example', () => {
|
|
|
72
72
|
});
|
|
73
73
|
|
|
74
74
|
expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
"location":
|
|
78
|
-
|
|
75
|
+
[
|
|
76
|
+
{
|
|
77
|
+
"location": [
|
|
78
|
+
{
|
|
79
79
|
"pointer": "#/components/schemas/User/properties/email",
|
|
80
80
|
"reportOnKey": true,
|
|
81
81
|
"source": "foobar.yaml",
|
|
82
82
|
},
|
|
83
83
|
],
|
|
84
|
-
"message": "Scalar property should have
|
|
84
|
+
"message": "Scalar property should have "example" or "examples" defined.",
|
|
85
85
|
"ruleId": "scalar-property-missing-example",
|
|
86
86
|
"severity": "error",
|
|
87
|
-
"suggest":
|
|
87
|
+
"suggest": [],
|
|
88
88
|
},
|
|
89
89
|
]
|
|
90
90
|
`);
|
|
@@ -114,7 +114,7 @@ describe('Oas3.1 scalar-property-missing-example', () => {
|
|
|
114
114
|
config: await makeConfig({ 'scalar-property-missing-example': 'error' }),
|
|
115
115
|
});
|
|
116
116
|
|
|
117
|
-
expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`
|
|
117
|
+
expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`[]`);
|
|
118
118
|
});
|
|
119
119
|
|
|
120
120
|
it('should not report on a scalar property with an examples', async () => {
|
|
@@ -143,7 +143,7 @@ describe('Oas3.1 scalar-property-missing-example', () => {
|
|
|
143
143
|
config: await makeConfig({ 'scalar-property-missing-example': 'error' }),
|
|
144
144
|
});
|
|
145
145
|
|
|
146
|
-
expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`
|
|
146
|
+
expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`[]`);
|
|
147
147
|
});
|
|
148
148
|
|
|
149
149
|
it('should not report on a non-scalar property missing an example', async () => {
|
|
@@ -177,7 +177,7 @@ describe('Oas3.1 scalar-property-missing-example', () => {
|
|
|
177
177
|
config: await makeConfig({ 'scalar-property-missing-example': 'error' }),
|
|
178
178
|
});
|
|
179
179
|
|
|
180
|
-
expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`
|
|
180
|
+
expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`[]`);
|
|
181
181
|
});
|
|
182
182
|
|
|
183
183
|
it('should not report on a scalar property of binary format missing an example', async () => {
|
|
@@ -202,7 +202,7 @@ describe('Oas3.1 scalar-property-missing-example', () => {
|
|
|
202
202
|
config: await makeConfig({ 'scalar-property-missing-example': 'error' }),
|
|
203
203
|
});
|
|
204
204
|
|
|
205
|
-
expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`
|
|
205
|
+
expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`[]`);
|
|
206
206
|
});
|
|
207
207
|
|
|
208
208
|
it('should not report on a scalar property of falsy values', async () => {
|
|
@@ -233,7 +233,7 @@ describe('Oas3.1 scalar-property-missing-example', () => {
|
|
|
233
233
|
config: await makeConfig({ 'scalar-property-missing-example': 'error' }),
|
|
234
234
|
});
|
|
235
235
|
|
|
236
|
-
expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`
|
|
236
|
+
expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`[]`);
|
|
237
237
|
});
|
|
238
238
|
|
|
239
239
|
it('should not report on a nullable scalar property values', async () => {
|
|
@@ -259,6 +259,6 @@ describe('Oas3.1 scalar-property-missing-example', () => {
|
|
|
259
259
|
config: await makeConfig({ 'scalar-property-missing-example': 'error' }),
|
|
260
260
|
});
|
|
261
261
|
|
|
262
|
-
expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`
|
|
262
|
+
expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`[]`);
|
|
263
263
|
});
|
|
264
264
|
});
|