@redocly/openapi-core 1.0.0-beta.104 → 1.0.0-beta.107
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/README.md +4 -4
- package/__tests__/utils.ts +8 -6
- package/lib/benchmark/benches/recommended-oas3.bench.js +1 -1
- package/lib/benchmark/utils.d.ts +2 -2
- package/lib/benchmark/utils.js +2 -2
- package/lib/bundle.d.ts +2 -2
- package/lib/bundle.js +2 -2
- package/lib/config/all.d.ts +2 -2
- package/lib/config/all.js +1 -1
- package/lib/config/builtIn.d.ts +2 -2
- package/lib/config/builtIn.js +2 -2
- package/lib/config/config-resolvers.d.ts +5 -5
- package/lib/config/config-resolvers.js +39 -36
- package/lib/config/config.d.ts +6 -5
- package/lib/config/config.js +27 -20
- package/lib/config/load.js +6 -7
- package/lib/config/minimal.d.ts +2 -2
- package/lib/config/minimal.js +3 -2
- package/lib/config/recommended.d.ts +2 -2
- package/lib/config/recommended.js +3 -2
- package/lib/config/rules.d.ts +2 -2
- package/lib/config/rules.js +1 -1
- package/lib/config/types.d.ts +23 -19
- package/lib/config/utils.d.ts +5 -5
- package/lib/config/utils.js +43 -26
- package/lib/decorators/common/remove-x-internal.js +2 -2
- package/lib/format/format.js +1 -1
- package/lib/index.d.ts +2 -2
- package/lib/index.js +3 -2
- package/lib/js-yaml/index.js +1 -6
- package/lib/lint.d.ts +2 -2
- package/lib/lint.js +16 -6
- package/lib/redocly/registry-api.d.ts +1 -1
- package/lib/redocly/registry-api.js +2 -2
- package/lib/rules/ajv.d.ts +1 -1
- package/lib/rules/ajv.js +6 -6
- package/lib/rules/common/info-license-url.d.ts +1 -1
- package/lib/rules/common/info-license-url.js +5 -10
- package/lib/rules/common/info-license.d.ts +2 -0
- package/lib/rules/common/info-license.js +17 -0
- package/lib/rules/common/no-enum-type-mismatch.js +1 -3
- 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-operationId.js +1 -1
- package/lib/rules/common/path-not-include-query.js +1 -1
- package/lib/rules/common/paths-kebab-case.js +4 -1
- package/lib/rules/common/spec.js +1 -1
- package/lib/rules/oas2/index.js +4 -4
- package/lib/rules/oas2/remove-unused-components.js +3 -3
- package/lib/rules/oas3/index.js +4 -4
- package/lib/rules/oas3/no-empty-servers.js +1 -1
- package/lib/rules/oas3/no-invalid-media-type-examples.js +2 -2
- package/lib/rules/oas3/remove-unused-components.js +2 -2
- package/lib/rules/other/stats.js +43 -14
- package/lib/rules/utils.d.ts +3 -2
- package/lib/rules/utils.js +19 -4
- package/lib/types/index.d.ts +2 -2
- package/lib/types/redocly-yaml.js +8 -7
- package/lib/utils.d.ts +5 -2
- package/lib/utils.js +20 -2
- package/lib/walk.d.ts +2 -1
- package/lib/walk.js +6 -3
- package/package.json +2 -2
- package/src/__tests__/__snapshots__/bundle.test.ts.snap +141 -0
- package/src/__tests__/bundle.test.ts +68 -34
- package/src/__tests__/codeframes.test.ts +13 -14
- package/src/__tests__/fixtures/.redocly.lint-ignore.yaml +5 -0
- package/src/__tests__/js-yaml.test.ts +6 -4
- package/src/__tests__/lint.test.ts +127 -12
- package/src/__tests__/login.test.ts +2 -2
- package/src/__tests__/normalizeVisitors.test.ts +4 -4
- package/src/__tests__/ref-utils.test.ts +13 -13
- package/src/__tests__/resolve-http.test.ts +1 -1
- package/src/__tests__/resolve.test.ts +14 -11
- package/src/__tests__/utils.test.ts +42 -1
- package/src/__tests__/walk.test.ts +48 -56
- package/src/benchmark/benches/lint-with-many-rules.bench.ts +1 -1
- package/src/benchmark/benches/lint-with-nested-rule.bench.ts +1 -1
- package/src/benchmark/benches/lint-with-no-rules.bench.ts +1 -1
- package/src/benchmark/benches/lint-with-top-level-rule-report.bench.ts +1 -1
- package/src/benchmark/benches/lint-with-top-level-rule.bench.ts +1 -1
- package/src/benchmark/benches/recommended-oas3.bench.ts +3 -3
- package/src/benchmark/benches/resolve-with-no-external.bench.ts +1 -1
- package/src/benchmark/benchmark.js +9 -5
- package/src/benchmark/utils.ts +5 -5
- package/src/bundle.ts +18 -17
- package/src/config/__tests__/__snapshots__/config-resolvers.test.ts.snap +3 -1
- package/src/config/__tests__/config-resolvers.test.ts +123 -121
- package/src/config/__tests__/config.test.ts +76 -76
- package/src/config/__tests__/fixtures/resolve-config/api/plugin.js +4 -2
- package/src/config/__tests__/fixtures/resolve-config/plugin.js +4 -1
- package/src/config/__tests__/load.test.ts +2 -2
- package/src/config/__tests__/resolve-plugins.test.ts +3 -3
- package/src/config/__tests__/utils.test.ts +83 -0
- package/src/config/all.ts +3 -4
- package/src/config/builtIn.ts +5 -5
- package/src/config/config-resolvers.ts +122 -83
- package/src/config/config.ts +36 -32
- package/src/config/load.ts +13 -16
- package/src/config/minimal.ts +5 -4
- package/src/config/recommended.ts +5 -4
- package/src/config/rules.ts +6 -6
- package/src/config/types.ts +28 -19
- package/src/config/utils.ts +74 -54
- package/src/decorators/__tests__/filter-out.test.ts +8 -4
- package/src/decorators/__tests__/remove-x-internal.test.ts +5 -5
- package/src/decorators/common/filters/filter-helper.ts +1 -1
- package/src/decorators/common/info-description-override.ts +1 -1
- package/src/decorators/common/operation-description-override.ts +1 -1
- package/src/decorators/common/remove-x-internal.ts +4 -4
- package/src/decorators/common/tag-description-override.ts +1 -1
- package/src/format/codeframes.ts +4 -4
- package/src/format/format.ts +10 -10
- package/src/index.ts +3 -4
- package/src/js-yaml/index.ts +3 -8
- package/src/lint.ts +22 -18
- package/src/oas-types.ts +1 -6
- package/src/redocly/__tests__/redocly-client.test.ts +25 -19
- package/src/redocly/index.ts +6 -4
- package/src/redocly/registry-api.ts +6 -6
- package/src/ref-utils.ts +2 -2
- package/src/resolve.ts +7 -4
- package/src/rules/__tests__/no-unresolved-refs.test.ts +4 -4
- package/src/rules/__tests__/utils.test.ts +160 -0
- package/src/rules/ajv.ts +7 -8
- package/src/rules/common/__tests__/info-description.test.ts +3 -3
- package/src/rules/common/__tests__/info-license.test.ts +2 -2
- package/src/rules/common/__tests__/license-url.test.ts +2 -2
- package/src/rules/common/__tests__/no-ambiguous-paths.test.ts +1 -1
- package/src/rules/common/__tests__/no-enum-type-mismatch.test.ts +8 -8
- package/src/rules/common/__tests__/no-identical-paths.test.ts +1 -1
- package/src/rules/common/__tests__/no-path-trailing-slash.test.ts +3 -3
- package/src/rules/common/__tests__/operation-2xx-response.test.ts +3 -3
- package/src/rules/common/__tests__/operation-4xx-response.test.ts +3 -3
- package/src/rules/common/__tests__/operation-operationId-unique.test.ts +2 -2
- package/src/rules/common/__tests__/operation-operationId-url-safe.test.ts +1 -1
- package/src/rules/common/__tests__/operation-parameters-unique.test.ts +4 -4
- package/src/rules/common/__tests__/operation-security-defined.test.ts +2 -2
- package/src/rules/common/__tests__/operation-singular-tag.test.ts +2 -2
- package/src/rules/common/__tests__/path-http-verbs-order.test.ts +2 -2
- package/src/rules/common/__tests__/path-not-include-query.test.ts +2 -2
- package/src/rules/common/__tests__/path-params-defined.test.ts +3 -3
- package/src/rules/common/__tests__/paths-kebab-case.test.ts +15 -15
- package/src/rules/common/__tests__/scalar-property-missing-example.test.ts +8 -8
- package/src/rules/common/__tests__/spec.test.ts +2 -2
- package/src/rules/common/__tests__/tag-description.test.ts +2 -2
- package/src/rules/common/__tests__/tags-alphabetical.test.ts +2 -2
- package/src/rules/common/assertions/__tests__/asserts.test.ts +513 -130
- package/src/rules/common/assertions/index.ts +6 -6
- package/src/rules/common/info-license-url.ts +4 -9
- package/src/rules/common/info-license.ts +15 -0
- package/src/rules/common/no-ambiguous-paths.ts +1 -1
- package/src/rules/common/no-enum-type-mismatch.ts +12 -9
- package/src/rules/common/no-invalid-parameter-examples.ts +4 -4
- package/src/rules/common/no-invalid-schema-examples.ts +4 -4
- package/src/rules/common/operation-operationId.ts +1 -1
- package/src/rules/common/operation-parameters-unique.ts +2 -2
- package/src/rules/common/path-not-include-query.ts +1 -1
- package/src/rules/common/path-params-defined.ts +1 -1
- package/src/rules/common/paths-kebab-case.ts +4 -1
- package/src/rules/common/scalar-property-missing-example.ts +1 -1
- package/src/rules/common/spec.ts +10 -7
- package/src/rules/no-unresolved-refs.ts +1 -1
- package/src/rules/oas2/__tests__/boolean-parameter-prefixes.test.ts +3 -3
- package/src/rules/oas2/__tests__/spec/info.test.ts +12 -12
- package/src/rules/oas2/__tests__/spec/operation.test.ts +4 -4
- package/src/rules/oas2/__tests__/spec/paths.test.ts +10 -10
- package/src/rules/oas2/__tests__/spec/referenceableScalars.test.ts +6 -2
- package/src/rules/oas2/__tests__/spec/utils.ts +6 -6
- package/src/rules/oas2/index.ts +3 -3
- package/src/rules/oas2/remove-unused-components.ts +13 -8
- package/src/rules/oas3/__tests__/boolean-parameter-prefixes.test.ts +3 -3
- package/src/rules/oas3/__tests__/no-example-value-and-externalValue.test.ts +2 -2
- package/src/rules/oas3/__tests__/no-invalid-media-type-examples.test.ts +13 -13
- package/src/rules/oas3/__tests__/no-server-example.com.test.ts +2 -2
- package/src/rules/oas3/__tests__/no-server-trailing-slash.test.ts +3 -3
- package/src/rules/oas3/__tests__/no-unused-components.test.ts +1 -1
- package/src/rules/oas3/__tests__/spec/callbacks.test.ts +1 -1
- package/src/rules/oas3/__tests__/spec/info.test.ts +12 -12
- package/src/rules/oas3/__tests__/spec/operation.test.ts +8 -8
- package/src/rules/oas3/__tests__/spec/paths.test.ts +10 -10
- package/src/rules/oas3/__tests__/spec/referenceableScalars.test.ts +12 -12
- package/src/rules/oas3/__tests__/spec/servers.test.ts +15 -15
- package/src/rules/oas3/__tests__/spec/spec.test.ts +6 -6
- package/src/rules/oas3/__tests__/spec/utils.ts +6 -6
- package/src/rules/oas3/index.ts +3 -3
- package/src/rules/oas3/no-empty-servers.ts +1 -1
- package/src/rules/oas3/no-invalid-media-type-examples.ts +14 -6
- package/src/rules/oas3/no-servers-empty-enum.ts +9 -10
- package/src/rules/oas3/remove-unused-components.ts +18 -7
- package/src/rules/other/stats.ts +46 -17
- package/src/rules/utils.ts +19 -3
- package/src/types/index.ts +5 -5
- package/src/types/redocly-yaml.ts +8 -7
- package/src/typings/common.ts +9 -1
- package/src/typings/openapi.ts +1 -1
- package/src/utils.ts +31 -8
- package/src/visitors.ts +4 -4
- package/src/walk.ts +15 -11
- package/tsconfig.tsbuildinfo +1 -1
- package/lib/rules/common/license-url.d.ts +0 -2
- package/lib/rules/common/license-url.js +0 -12
- package/src/rules/common/license-url.ts +0 -10
|
@@ -23,7 +23,7 @@ describe('Oas3 typed enum', () => {
|
|
|
23
23
|
- 2
|
|
24
24
|
- 3
|
|
25
25
|
`,
|
|
26
|
-
'foobar.yaml'
|
|
26
|
+
'foobar.yaml'
|
|
27
27
|
);
|
|
28
28
|
|
|
29
29
|
const results = await lintDocument({
|
|
@@ -56,7 +56,7 @@ describe('Oas3 typed enum', () => {
|
|
|
56
56
|
- C
|
|
57
57
|
- null
|
|
58
58
|
`,
|
|
59
|
-
'foobar.yaml'
|
|
59
|
+
'foobar.yaml'
|
|
60
60
|
);
|
|
61
61
|
|
|
62
62
|
const results = await lintDocument({
|
|
@@ -86,7 +86,7 @@ describe('Oas3 typed enum', () => {
|
|
|
86
86
|
- string
|
|
87
87
|
- 3
|
|
88
88
|
`,
|
|
89
|
-
'foobar.yaml'
|
|
89
|
+
'foobar.yaml'
|
|
90
90
|
);
|
|
91
91
|
|
|
92
92
|
const results = await lintDocument({
|
|
@@ -114,7 +114,7 @@ describe('Oas3 typed enum', () => {
|
|
|
114
114
|
`);
|
|
115
115
|
});
|
|
116
116
|
|
|
117
|
-
it(
|
|
117
|
+
it("should report on enum object, 'string' value in enum does not have allowed types", async () => {
|
|
118
118
|
const document = parseYamlToDocument(
|
|
119
119
|
outdent`
|
|
120
120
|
openapi: 3.1.0
|
|
@@ -134,7 +134,7 @@ describe('Oas3 typed enum', () => {
|
|
|
134
134
|
- string
|
|
135
135
|
- 3
|
|
136
136
|
`,
|
|
137
|
-
'foobar.yaml'
|
|
137
|
+
'foobar.yaml'
|
|
138
138
|
);
|
|
139
139
|
|
|
140
140
|
const results = await lintDocument({
|
|
@@ -153,7 +153,7 @@ describe('Oas3 typed enum', () => {
|
|
|
153
153
|
"source": "foobar.yaml",
|
|
154
154
|
},
|
|
155
155
|
],
|
|
156
|
-
"message": "Enum value \`string\` must be of
|
|
156
|
+
"message": "Enum value \`string\` must be of allowed types: \`integer,array\`.",
|
|
157
157
|
"ruleId": "no-enum-type-mismatch",
|
|
158
158
|
"severity": "error",
|
|
159
159
|
"suggest": Array [],
|
|
@@ -179,13 +179,13 @@ describe('Oas3 typed enum', () => {
|
|
|
179
179
|
application/json:
|
|
180
180
|
schema: null
|
|
181
181
|
`,
|
|
182
|
-
'foobar.yaml'
|
|
182
|
+
'foobar.yaml'
|
|
183
183
|
);
|
|
184
184
|
|
|
185
185
|
const results = await lintDocument({
|
|
186
186
|
externalRefResolver: new BaseResolver(),
|
|
187
187
|
document,
|
|
188
|
-
config: await makeConfig({
|
|
188
|
+
config: await makeConfig({ spec: 'error', 'no-enum-type-mismatch': 'error' }),
|
|
189
189
|
});
|
|
190
190
|
|
|
191
191
|
expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`
|
|
@@ -13,7 +13,7 @@ describe('no-path-trailing-slash', () => {
|
|
|
13
13
|
get:
|
|
14
14
|
summary: List all pets
|
|
15
15
|
`,
|
|
16
|
-
'foobar.yaml'
|
|
16
|
+
'foobar.yaml'
|
|
17
17
|
);
|
|
18
18
|
|
|
19
19
|
const results = await lintDocument({
|
|
@@ -50,7 +50,7 @@ describe('no-path-trailing-slash', () => {
|
|
|
50
50
|
get:
|
|
51
51
|
summary: List all pets
|
|
52
52
|
`,
|
|
53
|
-
'foobar.yaml'
|
|
53
|
+
'foobar.yaml'
|
|
54
54
|
);
|
|
55
55
|
|
|
56
56
|
const results = await lintDocument({
|
|
@@ -71,7 +71,7 @@ describe('no-path-trailing-slash', () => {
|
|
|
71
71
|
get:
|
|
72
72
|
summary: List all pets
|
|
73
73
|
`,
|
|
74
|
-
'foobar.yaml'
|
|
74
|
+
'foobar.yaml'
|
|
75
75
|
);
|
|
76
76
|
|
|
77
77
|
const results = await lintDocument({
|
|
@@ -15,7 +15,7 @@ describe('Oas3 operation-2xx-response', () => {
|
|
|
15
15
|
400:
|
|
16
16
|
description: bad response
|
|
17
17
|
`,
|
|
18
|
-
'foobar.yaml'
|
|
18
|
+
'foobar.yaml'
|
|
19
19
|
);
|
|
20
20
|
|
|
21
21
|
const results = await lintDocument({
|
|
@@ -54,7 +54,7 @@ describe('Oas3 operation-2xx-response', () => {
|
|
|
54
54
|
200:
|
|
55
55
|
description: ok
|
|
56
56
|
`,
|
|
57
|
-
'foobar.yaml'
|
|
57
|
+
'foobar.yaml'
|
|
58
58
|
);
|
|
59
59
|
|
|
60
60
|
const results = await lintDocument({
|
|
@@ -77,7 +77,7 @@ describe('Oas3 operation-2xx-response', () => {
|
|
|
77
77
|
default:
|
|
78
78
|
description: ok
|
|
79
79
|
`,
|
|
80
|
-
'foobar.yaml'
|
|
80
|
+
'foobar.yaml'
|
|
81
81
|
);
|
|
82
82
|
|
|
83
83
|
const results = await lintDocument({
|
|
@@ -15,7 +15,7 @@ describe('Oas3 operation-4xx-response', () => {
|
|
|
15
15
|
200:
|
|
16
16
|
description: ok response
|
|
17
17
|
`,
|
|
18
|
-
'foobar.yaml'
|
|
18
|
+
'foobar.yaml'
|
|
19
19
|
);
|
|
20
20
|
|
|
21
21
|
const results = await lintDocument({
|
|
@@ -54,7 +54,7 @@ describe('Oas3 operation-4xx-response', () => {
|
|
|
54
54
|
400:
|
|
55
55
|
description: error response
|
|
56
56
|
`,
|
|
57
|
-
'foobar.yaml'
|
|
57
|
+
'foobar.yaml'
|
|
58
58
|
);
|
|
59
59
|
|
|
60
60
|
const results = await lintDocument({
|
|
@@ -77,7 +77,7 @@ describe('Oas3 operation-4xx-response', () => {
|
|
|
77
77
|
default:
|
|
78
78
|
description: some default response
|
|
79
79
|
`,
|
|
80
|
-
'foobar.yaml'
|
|
80
|
+
'foobar.yaml'
|
|
81
81
|
);
|
|
82
82
|
|
|
83
83
|
const results = await lintDocument({
|
|
@@ -20,7 +20,7 @@ describe('Oas3 operation-operationId-unique', () => {
|
|
|
20
20
|
post:
|
|
21
21
|
operationId: test2
|
|
22
22
|
`,
|
|
23
|
-
'foobar.yaml'
|
|
23
|
+
'foobar.yaml'
|
|
24
24
|
);
|
|
25
25
|
|
|
26
26
|
const results = await lintDocument({
|
|
@@ -62,7 +62,7 @@ describe('Oas3 operation-operationId-unique', () => {
|
|
|
62
62
|
post:
|
|
63
63
|
operationId: test3
|
|
64
64
|
`,
|
|
65
|
-
'foobar.yaml'
|
|
65
|
+
'foobar.yaml'
|
|
66
66
|
);
|
|
67
67
|
|
|
68
68
|
const results = await lintDocument({
|
|
@@ -16,7 +16,7 @@ describe('Oas3 operation-parameters-unique', () => {
|
|
|
16
16
|
- name: a
|
|
17
17
|
in: query
|
|
18
18
|
`,
|
|
19
|
-
'foobar.yaml'
|
|
19
|
+
'foobar.yaml'
|
|
20
20
|
);
|
|
21
21
|
|
|
22
22
|
const results = await lintDocument({
|
|
@@ -59,7 +59,7 @@ describe('Oas3 operation-parameters-unique', () => {
|
|
|
59
59
|
- name: a
|
|
60
60
|
in: query
|
|
61
61
|
`,
|
|
62
|
-
'foobar.yaml'
|
|
62
|
+
'foobar.yaml'
|
|
63
63
|
);
|
|
64
64
|
|
|
65
65
|
const results = await lintDocument({
|
|
@@ -89,7 +89,7 @@ describe('Oas3 operation-parameters-unique', () => {
|
|
|
89
89
|
- name: a
|
|
90
90
|
in: query
|
|
91
91
|
`,
|
|
92
|
-
'foobar.yaml'
|
|
92
|
+
'foobar.yaml'
|
|
93
93
|
);
|
|
94
94
|
|
|
95
95
|
const results = await lintDocument({
|
|
@@ -137,7 +137,7 @@ describe('Oas3 operation-parameters-unique', () => {
|
|
|
137
137
|
in: query
|
|
138
138
|
name: a
|
|
139
139
|
`,
|
|
140
|
-
'foobar.yaml'
|
|
140
|
+
'foobar.yaml'
|
|
141
141
|
);
|
|
142
142
|
|
|
143
143
|
const results = await lintDocument({
|
|
@@ -13,7 +13,7 @@ describe('Oas3 operation-security-defined', () => {
|
|
|
13
13
|
get:
|
|
14
14
|
security:
|
|
15
15
|
- some: []`,
|
|
16
|
-
'foobar.yaml'
|
|
16
|
+
'foobar.yaml'
|
|
17
17
|
);
|
|
18
18
|
|
|
19
19
|
const results = await lintDocument({
|
|
@@ -55,7 +55,7 @@ describe('Oas3 operation-security-defined', () => {
|
|
|
55
55
|
some:
|
|
56
56
|
type: http
|
|
57
57
|
scheme: basic`,
|
|
58
|
-
'foobar.yaml'
|
|
58
|
+
'foobar.yaml'
|
|
59
59
|
);
|
|
60
60
|
|
|
61
61
|
const results = await lintDocument({
|
|
@@ -18,7 +18,7 @@ describe('Oas3 operation-singular-tag', () => {
|
|
|
18
18
|
- a
|
|
19
19
|
- b
|
|
20
20
|
`,
|
|
21
|
-
'foobar.yaml'
|
|
21
|
+
'foobar.yaml'
|
|
22
22
|
);
|
|
23
23
|
|
|
24
24
|
const results = await lintDocument({
|
|
@@ -58,7 +58,7 @@ describe('Oas3 operation-singular-tag', () => {
|
|
|
58
58
|
tags:
|
|
59
59
|
- a
|
|
60
60
|
`,
|
|
61
|
-
'foobar.yaml'
|
|
61
|
+
'foobar.yaml'
|
|
62
62
|
);
|
|
63
63
|
|
|
64
64
|
const results = await lintDocument({
|
|
@@ -17,7 +17,7 @@ describe('Common path-http-verbs-order', () => {
|
|
|
17
17
|
get:
|
|
18
18
|
summary: post
|
|
19
19
|
`,
|
|
20
|
-
'foobar.yaml'
|
|
20
|
+
'foobar.yaml'
|
|
21
21
|
);
|
|
22
22
|
|
|
23
23
|
const results = await lintDocument({
|
|
@@ -81,7 +81,7 @@ describe('Common path-http-verbs-order', () => {
|
|
|
81
81
|
trace:
|
|
82
82
|
summary: trace
|
|
83
83
|
`,
|
|
84
|
-
'foobar.yaml'
|
|
84
|
+
'foobar.yaml'
|
|
85
85
|
);
|
|
86
86
|
|
|
87
87
|
const results = await lintDocument({
|
|
@@ -13,7 +13,7 @@ describe('Oas3 path-not-include-query', () => {
|
|
|
13
13
|
get:
|
|
14
14
|
summary: List all pets
|
|
15
15
|
`,
|
|
16
|
-
'foobar.yaml'
|
|
16
|
+
'foobar.yaml'
|
|
17
17
|
);
|
|
18
18
|
|
|
19
19
|
const results = await lintDocument({
|
|
@@ -50,7 +50,7 @@ describe('Oas3 path-not-include-query', () => {
|
|
|
50
50
|
get:
|
|
51
51
|
summary: List all pets
|
|
52
52
|
`,
|
|
53
|
-
'foobar.yaml'
|
|
53
|
+
'foobar.yaml'
|
|
54
54
|
);
|
|
55
55
|
|
|
56
56
|
const results = await lintDocument({
|
|
@@ -18,7 +18,7 @@ describe('Oas3 path-params-defined', () => {
|
|
|
18
18
|
- name: b
|
|
19
19
|
in: path
|
|
20
20
|
`,
|
|
21
|
-
'foobar.yaml'
|
|
21
|
+
'foobar.yaml'
|
|
22
22
|
);
|
|
23
23
|
|
|
24
24
|
const results = await lintDocument({
|
|
@@ -46,7 +46,7 @@ describe('Oas3 path-params-defined', () => {
|
|
|
46
46
|
- name: b
|
|
47
47
|
in: query
|
|
48
48
|
`,
|
|
49
|
-
'foobar.yaml'
|
|
49
|
+
'foobar.yaml'
|
|
50
50
|
);
|
|
51
51
|
|
|
52
52
|
const results = await lintDocument({
|
|
@@ -90,7 +90,7 @@ describe('Oas3 path-params-defined', () => {
|
|
|
90
90
|
- name: c
|
|
91
91
|
in: path
|
|
92
92
|
`,
|
|
93
|
-
'foobar.yaml'
|
|
93
|
+
'foobar.yaml'
|
|
94
94
|
);
|
|
95
95
|
|
|
96
96
|
const results = await lintDocument({
|
|
@@ -16,7 +16,7 @@ describe('Oas3 paths-kebab-case', () => {
|
|
|
16
16
|
get:
|
|
17
17
|
summary: Test
|
|
18
18
|
`,
|
|
19
|
-
'foobar.yaml'
|
|
19
|
+
'foobar.yaml'
|
|
20
20
|
);
|
|
21
21
|
|
|
22
22
|
const results = await lintDocument({
|
|
@@ -55,7 +55,7 @@ describe('Oas3 paths-kebab-case', () => {
|
|
|
55
55
|
get:
|
|
56
56
|
summary: Test
|
|
57
57
|
`,
|
|
58
|
-
'foobar.yaml'
|
|
58
|
+
'foobar.yaml'
|
|
59
59
|
);
|
|
60
60
|
|
|
61
61
|
const results = await lintDocument({
|
|
@@ -84,25 +84,25 @@ describe('Oas3 paths-kebab-case', () => {
|
|
|
84
84
|
});
|
|
85
85
|
|
|
86
86
|
it('should allow trailing slash in path with "paths-kebab-case" rule', async () => {
|
|
87
|
-
|
|
88
|
-
|
|
87
|
+
const document = parseYamlToDocument(
|
|
88
|
+
outdent`
|
|
89
89
|
openapi: 3.0.0
|
|
90
90
|
paths:
|
|
91
91
|
/some/:
|
|
92
92
|
get:
|
|
93
93
|
summary: List all pets
|
|
94
94
|
`,
|
|
95
|
-
|
|
96
|
-
|
|
95
|
+
'foobar.yaml'
|
|
96
|
+
);
|
|
97
97
|
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
});
|
|
106
|
-
expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`Array []`);
|
|
98
|
+
const results = await lintDocument({
|
|
99
|
+
externalRefResolver: new BaseResolver(),
|
|
100
|
+
document,
|
|
101
|
+
config: await makeConfig({
|
|
102
|
+
'paths-kebab-case': 'error',
|
|
103
|
+
'no-path-trailing-slash': 'off',
|
|
104
|
+
}),
|
|
107
105
|
});
|
|
106
|
+
expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`Array []`);
|
|
107
|
+
});
|
|
108
108
|
});
|
|
@@ -18,7 +18,7 @@ describe('Oas3 scalar-property-missing-example', () => {
|
|
|
18
18
|
type: string
|
|
19
19
|
format: email
|
|
20
20
|
`,
|
|
21
|
-
'foobar.yaml'
|
|
21
|
+
'foobar.yaml'
|
|
22
22
|
);
|
|
23
23
|
|
|
24
24
|
const results = await lintDocument({
|
|
@@ -62,7 +62,7 @@ describe('Oas3.1 scalar-property-missing-example', () => {
|
|
|
62
62
|
type: string
|
|
63
63
|
format: email
|
|
64
64
|
`,
|
|
65
|
-
'foobar.yaml'
|
|
65
|
+
'foobar.yaml'
|
|
66
66
|
);
|
|
67
67
|
|
|
68
68
|
const results = await lintDocument({
|
|
@@ -105,7 +105,7 @@ describe('Oas3.1 scalar-property-missing-example', () => {
|
|
|
105
105
|
format: email
|
|
106
106
|
example: john.smith@example.com
|
|
107
107
|
`,
|
|
108
|
-
'foobar.yaml'
|
|
108
|
+
'foobar.yaml'
|
|
109
109
|
);
|
|
110
110
|
|
|
111
111
|
const results = await lintDocument({
|
|
@@ -134,7 +134,7 @@ describe('Oas3.1 scalar-property-missing-example', () => {
|
|
|
134
134
|
- john.smith@example.com
|
|
135
135
|
- other@example.com
|
|
136
136
|
`,
|
|
137
|
-
'foobar.yaml'
|
|
137
|
+
'foobar.yaml'
|
|
138
138
|
);
|
|
139
139
|
|
|
140
140
|
const results = await lintDocument({
|
|
@@ -168,7 +168,7 @@ describe('Oas3.1 scalar-property-missing-example', () => {
|
|
|
168
168
|
type: string
|
|
169
169
|
format: url
|
|
170
170
|
`,
|
|
171
|
-
'foobar.yaml'
|
|
171
|
+
'foobar.yaml'
|
|
172
172
|
);
|
|
173
173
|
|
|
174
174
|
const results = await lintDocument({
|
|
@@ -193,7 +193,7 @@ describe('Oas3.1 scalar-property-missing-example', () => {
|
|
|
193
193
|
type: string
|
|
194
194
|
format: binary
|
|
195
195
|
`,
|
|
196
|
-
'foobar.yaml'
|
|
196
|
+
'foobar.yaml'
|
|
197
197
|
);
|
|
198
198
|
|
|
199
199
|
const results = await lintDocument({
|
|
@@ -224,7 +224,7 @@ describe('Oas3.1 scalar-property-missing-example', () => {
|
|
|
224
224
|
type: number
|
|
225
225
|
example: 0
|
|
226
226
|
`,
|
|
227
|
-
'foobar.yaml'
|
|
227
|
+
'foobar.yaml'
|
|
228
228
|
);
|
|
229
229
|
|
|
230
230
|
const results = await lintDocument({
|
|
@@ -250,7 +250,7 @@ describe('Oas3.1 scalar-property-missing-example', () => {
|
|
|
250
250
|
nullable: true
|
|
251
251
|
example: null
|
|
252
252
|
`,
|
|
253
|
-
'foobar.yaml'
|
|
253
|
+
'foobar.yaml'
|
|
254
254
|
);
|
|
255
255
|
|
|
256
256
|
const results = await lintDocument({
|
|
@@ -19,13 +19,13 @@ describe('Oas3 spec', () => {
|
|
|
19
19
|
200:
|
|
20
20
|
description: Ok
|
|
21
21
|
`,
|
|
22
|
-
'foobar.yaml'
|
|
22
|
+
'foobar.yaml'
|
|
23
23
|
);
|
|
24
24
|
|
|
25
25
|
const results = await lintDocument({
|
|
26
26
|
externalRefResolver: new BaseResolver(),
|
|
27
27
|
document,
|
|
28
|
-
config: await makeConfig({
|
|
28
|
+
config: await makeConfig({ spec: 'error' }),
|
|
29
29
|
});
|
|
30
30
|
|
|
31
31
|
expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`
|
|
@@ -13,7 +13,7 @@ describe('Oas3 tag-description', () => {
|
|
|
13
13
|
- name: secondTag
|
|
14
14
|
description: some description goes here
|
|
15
15
|
`,
|
|
16
|
-
'foobar.yaml'
|
|
16
|
+
'foobar.yaml'
|
|
17
17
|
);
|
|
18
18
|
|
|
19
19
|
const results = await lintDocument({
|
|
@@ -51,7 +51,7 @@ describe('Oas3 tag-description', () => {
|
|
|
51
51
|
- name: secondTag
|
|
52
52
|
description: some description goes here
|
|
53
53
|
`,
|
|
54
|
-
'foobar.yaml'
|
|
54
|
+
'foobar.yaml'
|
|
55
55
|
);
|
|
56
56
|
|
|
57
57
|
const results = await lintDocument({
|
|
@@ -13,7 +13,7 @@ describe('Oas3 tags-alphabetical', () => {
|
|
|
13
13
|
- name: b
|
|
14
14
|
- name: a
|
|
15
15
|
`,
|
|
16
|
-
'foobar.yaml'
|
|
16
|
+
'foobar.yaml'
|
|
17
17
|
);
|
|
18
18
|
|
|
19
19
|
const results = await lintDocument({
|
|
@@ -50,7 +50,7 @@ describe('Oas3 tags-alphabetical', () => {
|
|
|
50
50
|
- name: a
|
|
51
51
|
- name: b
|
|
52
52
|
`,
|
|
53
|
-
'foobar.yaml'
|
|
53
|
+
'foobar.yaml'
|
|
54
54
|
);
|
|
55
55
|
|
|
56
56
|
const results = await lintDocument({
|