@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.
Files changed (202) hide show
  1. package/CHANGELOG.md +18 -0
  2. package/lib/benchmark/benches/lint-with-many-rules.bench.js +4 -4
  3. package/lib/benchmark/benches/lint-with-nested-rule.bench.js +4 -4
  4. package/lib/benchmark/benches/lint-with-no-rules.bench.js +4 -4
  5. package/lib/benchmark/benches/lint-with-top-level-rule-report.bench.js +4 -4
  6. package/lib/benchmark/benches/lint-with-top-level-rule.bench.js +4 -4
  7. package/lib/benchmark/benches/recommended-oas3.bench.js +4 -4
  8. package/lib/benchmark/benches/resolve-with-no-external.bench.js +3 -3
  9. package/lib/benchmark/utils.js +3 -3
  10. package/lib/bundle.d.ts +4 -4
  11. package/lib/bundle.js +25 -25
  12. package/lib/config/all.d.ts +2 -2
  13. package/lib/config/all.js +44 -8
  14. package/lib/config/builtIn.js +2 -0
  15. package/lib/config/config-resolvers.js +25 -25
  16. package/lib/config/config.js +9 -9
  17. package/lib/config/index.js +5 -1
  18. package/lib/config/load.d.ts +1 -1
  19. package/lib/config/load.js +6 -6
  20. package/lib/config/minimal.d.ts +2 -2
  21. package/lib/config/minimal.js +34 -3
  22. package/lib/config/recommended-strict.d.ts +3 -0
  23. package/lib/config/recommended-strict.js +92 -0
  24. package/lib/config/recommended.d.ts +2 -2
  25. package/lib/config/recommended.js +34 -3
  26. package/lib/config/rules.d.ts +1 -1
  27. package/lib/config/types.d.ts +47 -46
  28. package/lib/config/types.js +2 -2
  29. package/lib/config/utils.js +26 -14
  30. package/lib/decorators/common/filters/filter-helper.js +4 -4
  31. package/lib/decorators/common/filters/filter-in.js +2 -2
  32. package/lib/decorators/common/filters/filter-out.js +2 -2
  33. package/lib/decorators/common/info-description-override.js +1 -1
  34. package/lib/decorators/common/media-type-examples-override.js +3 -3
  35. package/lib/decorators/common/operation-description-override.js +1 -1
  36. package/lib/decorators/common/registry-dependencies.js +1 -1
  37. package/lib/decorators/common/remove-x-internal.js +4 -4
  38. package/lib/decorators/common/tag-description-override.js +1 -1
  39. package/lib/decorators/oas2/remove-unused-components.d.ts +2 -0
  40. package/lib/{rules → decorators}/oas2/remove-unused-components.js +1 -1
  41. package/lib/decorators/oas3/remove-unused-components.d.ts +2 -0
  42. package/lib/{rules → decorators}/oas3/remove-unused-components.js +2 -2
  43. package/lib/env.js +1 -1
  44. package/lib/format/codeframes.d.ts +6 -6
  45. package/lib/format/format.d.ts +2 -2
  46. package/lib/format/format.js +12 -12
  47. package/lib/js-yaml/index.d.ts +2 -2
  48. package/lib/js-yaml/index.js +2 -2
  49. package/lib/lint.js +18 -18
  50. package/lib/oas-types.d.ts +12 -10
  51. package/lib/oas-types.js +2 -2
  52. package/lib/redocly/index.js +10 -10
  53. package/lib/redocly/registry-api.js +2 -2
  54. package/lib/resolve.d.ts +4 -4
  55. package/lib/resolve.js +18 -18
  56. package/lib/rules/ajv.js +1 -1
  57. package/lib/rules/async2/index.d.ts +2 -11
  58. package/lib/rules/common/assertions/asserts.d.ts +3 -3
  59. package/lib/rules/common/assertions/asserts.js +21 -21
  60. package/lib/rules/common/assertions/index.d.ts +4 -4
  61. package/lib/rules/common/assertions/index.js +3 -3
  62. package/lib/rules/common/assertions/utils.d.ts +4 -4
  63. package/lib/rules/common/assertions/utils.js +3 -3
  64. package/lib/rules/common/info-contact.js +1 -1
  65. package/lib/rules/common/info-license-url.js +1 -1
  66. package/lib/rules/common/info-license.js +1 -1
  67. package/lib/rules/common/no-enum-type-mismatch.js +3 -3
  68. package/lib/rules/common/no-http-verbs-in-paths.js +2 -2
  69. package/lib/rules/common/no-invalid-parameter-examples.js +3 -3
  70. package/lib/rules/common/no-invalid-schema-examples.js +3 -3
  71. package/lib/rules/common/operation-2xx-response.js +2 -2
  72. package/lib/rules/common/operation-4xx-response.js +2 -2
  73. package/lib/rules/common/operation-description.js +1 -1
  74. package/lib/rules/common/operation-operationId.js +1 -1
  75. package/lib/rules/common/operation-summary.js +1 -1
  76. package/lib/rules/common/path-segment-plural.js +1 -1
  77. package/lib/rules/common/response-contains-header.js +2 -2
  78. package/lib/rules/common/spec-strict-refs.js +1 -1
  79. package/lib/rules/common/spec.js +11 -11
  80. package/lib/rules/common/tag-description.js +1 -1
  81. package/lib/rules/oas2/boolean-parameter-prefixes.d.ts +1 -1
  82. package/lib/rules/oas2/index.d.ts +2 -46
  83. package/lib/rules/oas2/request-mime-type.js +2 -2
  84. package/lib/rules/oas2/response-contains-property.js +2 -2
  85. package/lib/rules/oas2/response-mime-type.js +2 -2
  86. package/lib/rules/oas3/boolean-parameter-prefixes.d.ts +1 -1
  87. package/lib/rules/oas3/index.d.ts +1 -1
  88. package/lib/rules/oas3/index.js +1 -1
  89. package/lib/rules/oas3/no-invalid-media-type-examples.js +3 -3
  90. package/lib/rules/oas3/operation-4xx-problem-details-rfc7807.js +3 -3
  91. package/lib/rules/oas3/request-mime-type.js +3 -3
  92. package/lib/rules/oas3/response-contains-property.js +2 -2
  93. package/lib/rules/oas3/response-mime-type.js +3 -3
  94. package/lib/rules/utils.js +3 -3
  95. package/lib/types/asyncapi.js +21 -21
  96. package/lib/types/index.d.ts +8 -8
  97. package/lib/types/oas2.js +14 -14
  98. package/lib/types/oas3.js +27 -27
  99. package/lib/types/oas3_1.js +18 -6
  100. package/lib/types/redocly-yaml.d.ts +11 -0
  101. package/lib/types/redocly-yaml.js +71 -53
  102. package/lib/types/theme-config.js +1 -1
  103. package/lib/typings/common.d.ts +2 -2
  104. package/lib/typings/openapi.d.ts +6 -6
  105. package/lib/typings/swagger.d.ts +3 -3
  106. package/lib/utils.d.ts +5 -5
  107. package/lib/utils.js +3 -3
  108. package/lib/visitors.d.ts +38 -40
  109. package/lib/walk.d.ts +14 -15
  110. package/lib/walk.js +11 -11
  111. package/package.json +2 -2
  112. package/src/__tests__/lint.test.ts +40 -40
  113. package/src/__tests__/normalizeVisitors.test.ts +23 -5
  114. package/src/__tests__/ref-utils.test.ts +7 -7
  115. package/src/__tests__/resolve-http.test.ts +10 -10
  116. package/src/__tests__/resolve.test.ts +39 -39
  117. package/src/__tests__/walk.test.ts +48 -48
  118. package/src/bundle.ts +4 -4
  119. package/src/config/__tests__/__snapshots__/config-resolvers.test.ts.snap +95 -32
  120. package/src/config/__tests__/__snapshots__/config.test.ts.snap +81 -81
  121. package/src/config/__tests__/config-resolvers.test.ts +30 -1
  122. package/src/config/__tests__/config.test.ts +88 -88
  123. package/src/config/__tests__/load.test.ts +12 -8
  124. package/src/config/__tests__/utils.test.ts +18 -18
  125. package/src/config/all.ts +46 -9
  126. package/src/config/builtIn.ts +2 -0
  127. package/src/config/minimal.ts +36 -4
  128. package/src/config/recommended-strict.ts +93 -0
  129. package/src/config/recommended.ts +36 -4
  130. package/src/config/types.ts +22 -8
  131. package/src/config/utils.ts +15 -0
  132. package/src/decorators/common/media-type-examples-override.ts +2 -2
  133. package/src/{rules → decorators}/oas2/remove-unused-components.ts +3 -3
  134. package/src/{rules → decorators}/oas3/remove-unused-components.ts +3 -3
  135. package/src/env.ts +1 -1
  136. package/src/lint.ts +3 -3
  137. package/src/oas-types.ts +26 -3
  138. package/src/rules/__tests__/no-unresolved-refs.test.ts +26 -26
  139. package/src/rules/async2/__tests__/channels-kebab-case.test.ts +12 -12
  140. package/src/rules/async2/__tests__/no-channel-trailing-slash.test.ts +7 -7
  141. package/src/rules/async2/index.ts +2 -1
  142. package/src/rules/common/__tests__/info-license.test.ts +6 -6
  143. package/src/rules/common/__tests__/license-url.test.ts +6 -6
  144. package/src/rules/common/__tests__/no-ambiguous-paths.test.ts +13 -13
  145. package/src/rules/common/__tests__/no-enum-type-mismatch.test.ts +18 -18
  146. package/src/rules/common/__tests__/no-identical-paths.test.ts +5 -5
  147. package/src/rules/common/__tests__/no-path-trailing-slash.test.ts +12 -12
  148. package/src/rules/common/__tests__/operation-2xx-response.test.ts +18 -18
  149. package/src/rules/common/__tests__/operation-4xx-response.test.ts +23 -23
  150. package/src/rules/common/__tests__/operation-operationId-unique.test.ts +6 -6
  151. package/src/rules/common/__tests__/operation-operationId-url-safe.test.ts +5 -5
  152. package/src/rules/common/__tests__/operation-parameters-unique.test.ts +16 -16
  153. package/src/rules/common/__tests__/operation-singular-tag.test.ts +6 -6
  154. package/src/rules/common/__tests__/path-http-verbs-order.test.ts +10 -10
  155. package/src/rules/common/__tests__/path-not-include-query.test.ts +6 -6
  156. package/src/rules/common/__tests__/path-params-defined.test.ts +21 -21
  157. package/src/rules/common/__tests__/paths-kebab-case.test.ts +11 -11
  158. package/src/rules/common/__tests__/scalar-property-missing-example.test.ts +18 -18
  159. package/src/rules/common/__tests__/security-defined.test.ts +21 -21
  160. package/src/rules/common/__tests__/spec-strict-refs.test.ts +9 -9
  161. package/src/rules/common/__tests__/spec.test.ts +102 -102
  162. package/src/rules/common/__tests__/tag-description.test.ts +6 -6
  163. package/src/rules/common/__tests__/tags-alphabetical.test.ts +12 -12
  164. package/src/rules/common/assertions/__tests__/index.test.ts +15 -15
  165. package/src/rules/common/assertions/__tests__/utils.test.ts +9 -9
  166. package/src/rules/oas2/__tests__/boolean-parameter-prefixes.test.ts +7 -7
  167. package/src/rules/oas2/__tests__/response-contains-header.test.ts +13 -13
  168. package/src/rules/oas2/__tests__/response-contains-property.test.ts +8 -8
  169. package/src/rules/oas2/__tests__/spec/info.test.ts +21 -21
  170. package/src/rules/oas2/__tests__/spec/operation.test.ts +4 -4
  171. package/src/rules/oas2/__tests__/spec/paths.test.ts +12 -12
  172. package/src/rules/oas2/__tests__/spec/referenceableScalars.test.ts +1 -1
  173. package/src/rules/oas2/index.ts +3 -1
  174. package/src/rules/oas3/__tests__/boolean-parameter-prefixes.test.ts +7 -7
  175. package/src/rules/oas3/__tests__/component-name-unique.test.ts +186 -186
  176. package/src/rules/oas3/__tests__/no-empty-enum-servers.com.test.ts +18 -18
  177. package/src/rules/oas3/__tests__/no-example-value-and-externalValue.test.ts +6 -6
  178. package/src/rules/oas3/__tests__/no-invalid-media-type-examples.test.ts +36 -36
  179. package/src/rules/oas3/__tests__/no-server-example.com.test.ts +11 -11
  180. package/src/rules/oas3/__tests__/no-server-trailing-slash.test.ts +7 -7
  181. package/src/rules/oas3/__tests__/no-unused-components.test.ts +31 -31
  182. package/src/rules/oas3/__tests__/operation-4xx-problem-details-rfc7807.test.ts +15 -15
  183. package/src/rules/oas3/__tests__/response-contains-header.test.ts +26 -26
  184. package/src/rules/oas3/__tests__/response-contains-property.test.ts +27 -27
  185. package/src/rules/oas3/__tests__/spec/callbacks.test.ts +1 -1
  186. package/src/rules/oas3/__tests__/spec/info.test.ts +21 -21
  187. package/src/rules/oas3/__tests__/spec/operation.test.ts +10 -10
  188. package/src/rules/oas3/__tests__/spec/paths.test.ts +13 -13
  189. package/src/rules/oas3/__tests__/spec/referenceableScalars.test.ts +2 -2
  190. package/src/rules/oas3/__tests__/spec/servers.test.ts +25 -25
  191. package/src/rules/oas3/__tests__/spec/spec.test.ts +56 -56
  192. package/src/rules/oas3/__tests__/spec-components-invalid-map-name.test.ts +28 -28
  193. package/src/rules/oas3/index.ts +3 -3
  194. package/src/types/oas3_1.ts +12 -0
  195. package/src/types/redocly-yaml.ts +75 -40
  196. package/src/visitors.ts +10 -21
  197. package/src/walk.ts +23 -10
  198. package/tsconfig.tsbuildinfo +1 -1
  199. package/lib/rules/oas2/remove-unused-components.d.ts +0 -2
  200. package/lib/rules/oas3/remove-unused-components.d.ts +0 -2
  201. /package/src/{rules → decorators}/oas2/__tests__/remove-unused-components.test.ts +0 -0
  202. /package/src/{rules → decorators}/oas3/__tests__/remove-unused-components.test.ts +0 -0
@@ -27,10 +27,10 @@ describe('oas3 boolean-parameter-prefixes', () => {
27
27
  });
28
28
 
29
29
  expect(replaceSourceWithRef(results, __dirname)).toMatchInlineSnapshot(`
30
- Array [
31
- Object {
32
- "location": Array [
33
- Object {
30
+ [
31
+ {
32
+ "location": [
33
+ {
34
34
  "pointer": "#/paths/~1test/put/requestBody",
35
35
  "reportOnKey": false,
36
36
  "source": "foobar.yaml",
@@ -39,7 +39,7 @@ describe('oas3 boolean-parameter-prefixes', () => {
39
39
  "message": "Can't resolve $ref: ENOENT: no such file or directory 'invalid.yaml'",
40
40
  "ruleId": "no-unresolved-refs",
41
41
  "severity": "error",
42
- "suggest": Array [],
42
+ "suggest": [],
43
43
  },
44
44
  ]
45
45
  `);
@@ -67,36 +67,36 @@ describe('oas3 boolean-parameter-prefixes', () => {
67
67
  });
68
68
 
69
69
  expect(replaceSourceWithRef(results, __dirname)).toMatchInlineSnapshot(`
70
- Array [
71
- Object {
72
- "location": Array [
73
- Object {
70
+ [
71
+ {
72
+ "location": [
73
+ {
74
74
  "pointer": undefined,
75
75
  "reportOnKey": false,
76
76
  "source": "fixtures/invalid-yaml.yaml",
77
- "start": Object {
77
+ "start": {
78
78
  "col": 1,
79
79
  "line": 2,
80
80
  },
81
81
  },
82
82
  ],
83
- "message": "Failed to parse: unexpected end of the stream within a single quoted scalar in \\"fixtures/invalid-yaml.yaml\\" (2:1)",
83
+ "message": "Failed to parse: unexpected end of the stream within a single quoted scalar in "fixtures/invalid-yaml.yaml" (2:1)",
84
84
  "ruleId": "no-unresolved-refs",
85
85
  "severity": "error",
86
- "suggest": Array [],
86
+ "suggest": [],
87
87
  },
88
- Object {
89
- "location": Array [
90
- Object {
88
+ {
89
+ "location": [
90
+ {
91
91
  "pointer": "#/paths/~1test/put/requestBody",
92
92
  "reportOnKey": false,
93
93
  "source": "foobar.yaml",
94
94
  },
95
95
  ],
96
- "message": "Can't resolve $ref: unexpected end of the stream within a single quoted scalar in \\"fixtures/invalid-yaml.yaml\\" (2:1)",
96
+ "message": "Can't resolve $ref: unexpected end of the stream within a single quoted scalar in "fixtures/invalid-yaml.yaml" (2:1)",
97
97
  "ruleId": "no-unresolved-refs",
98
98
  "severity": "error",
99
- "suggest": Array [],
99
+ "suggest": [],
100
100
  },
101
101
  ]
102
102
  `);
@@ -123,7 +123,7 @@ describe('oas3 boolean-parameter-prefixes', () => {
123
123
  }),
124
124
  });
125
125
 
126
- expect(replaceSourceWithRef(results, __dirname)).toMatchInlineSnapshot(`Array []`);
126
+ expect(replaceSourceWithRef(results, __dirname)).toMatchInlineSnapshot(`[]`);
127
127
  });
128
128
 
129
129
  it('should report on unresolved localr ref', async () => {
@@ -148,10 +148,10 @@ describe('oas3 boolean-parameter-prefixes', () => {
148
148
  });
149
149
 
150
150
  expect(replaceSourceWithRef(results, __dirname)).toMatchInlineSnapshot(`
151
- Array [
152
- Object {
153
- "location": Array [
154
- Object {
151
+ [
152
+ {
153
+ "location": [
154
+ {
155
155
  "pointer": "#/paths/~1test/put/requestBody",
156
156
  "reportOnKey": false,
157
157
  "source": "foobar.yaml",
@@ -160,7 +160,7 @@ describe('oas3 boolean-parameter-prefixes', () => {
160
160
  "message": "Can't resolve $ref",
161
161
  "ruleId": "no-unresolved-refs",
162
162
  "severity": "error",
163
- "suggest": Array [],
163
+ "suggest": [],
164
164
  },
165
165
  ]
166
166
  `);
@@ -194,7 +194,7 @@ describe('oas3 boolean-parameter-prefixes', () => {
194
194
  }),
195
195
  });
196
196
 
197
- expect(replaceSourceWithRef(results, __dirname)).toMatchInlineSnapshot(`Array []`);
197
+ expect(replaceSourceWithRef(results, __dirname)).toMatchInlineSnapshot(`[]`);
198
198
  });
199
199
 
200
200
  it('should not report on nested refs inside specification extensions', async () => {
@@ -223,7 +223,7 @@ describe('oas3 boolean-parameter-prefixes', () => {
223
223
  }),
224
224
  });
225
225
 
226
- expect(replaceSourceWithRef(results, __dirname)).toMatchInlineSnapshot(`Array []`);
226
+ expect(replaceSourceWithRef(results, __dirname)).toMatchInlineSnapshot(`[]`);
227
227
  });
228
228
 
229
229
  it('should not report on nested refs inside specification extensions for 3.1', async () => {
@@ -252,6 +252,6 @@ describe('oas3 boolean-parameter-prefixes', () => {
252
252
  }),
253
253
  });
254
254
 
255
- expect(replaceSourceWithRef(results, __dirname)).toMatchInlineSnapshot(`Array []`);
255
+ expect(replaceSourceWithRef(results, __dirname)).toMatchInlineSnapshot(`[]`);
256
256
  });
257
257
  });
@@ -27,10 +27,10 @@ describe('Async2 channels-kebab-case', () => {
27
27
  });
28
28
 
29
29
  expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`
30
- Array [
31
- Object {
32
- "location": Array [
33
- Object {
30
+ [
31
+ {
32
+ "location": [
33
+ {
34
34
  "pointer": "#/channels/NOT_A_KEBAB",
35
35
  "reportOnKey": true,
36
36
  "source": "asyncapi.yaml",
@@ -39,7 +39,7 @@ describe('Async2 channels-kebab-case', () => {
39
39
  "message": "\`NOT_A_KEBAB\` does not use kebab-case.",
40
40
  "ruleId": "channels-kebab-case",
41
41
  "severity": "error",
42
- "suggest": Array [],
42
+ "suggest": [],
43
43
  },
44
44
  ]
45
45
  `);
@@ -68,10 +68,10 @@ describe('Async2 channels-kebab-case', () => {
68
68
  });
69
69
 
70
70
  expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`
71
- Array [
72
- Object {
73
- "location": Array [
74
- Object {
71
+ [
72
+ {
73
+ "location": [
74
+ {
75
75
  "pointer": "#/channels/snake_kebab",
76
76
  "reportOnKey": true,
77
77
  "source": "asyncapi.yaml",
@@ -80,7 +80,7 @@ describe('Async2 channels-kebab-case', () => {
80
80
  "message": "\`snake_kebab\` does not use kebab-case.",
81
81
  "ruleId": "channels-kebab-case",
82
82
  "severity": "error",
83
- "suggest": Array [],
83
+ "suggest": [],
84
84
  },
85
85
  ]
86
86
  `);
@@ -110,7 +110,7 @@ describe('Async2 channels-kebab-case', () => {
110
110
  'no-path-trailing-slash': 'off',
111
111
  }),
112
112
  });
113
- expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`Array []`);
113
+ expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`[]`);
114
114
  });
115
115
 
116
116
  it('words with hyphens are allowed with "channels-kebab-case" rule', async () => {
@@ -136,6 +136,6 @@ describe('Async2 channels-kebab-case', () => {
136
136
  'paths-kebab-case': 'error',
137
137
  }),
138
138
  });
139
- expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`Array []`);
139
+ expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`[]`);
140
140
  });
141
141
  });
@@ -27,10 +27,10 @@ describe('no-channel-trailing-slash', () => {
27
27
  });
28
28
 
29
29
  expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`
30
- Array [
31
- Object {
32
- "location": Array [
33
- Object {
30
+ [
31
+ {
32
+ "location": [
33
+ {
34
34
  "pointer": "#/channels/~1trailing~1",
35
35
  "reportOnKey": true,
36
36
  "source": "asyncapi.yaml",
@@ -39,7 +39,7 @@ describe('no-channel-trailing-slash', () => {
39
39
  "message": "\`/trailing/\` should not have a trailing slash.",
40
40
  "ruleId": "no-channel-trailing-slash",
41
41
  "severity": "error",
42
- "suggest": Array [],
42
+ "suggest": [],
43
43
  },
44
44
  ]
45
45
  `);
@@ -67,7 +67,7 @@ describe('no-channel-trailing-slash', () => {
67
67
  config: await makeConfig({ 'no-channel-trailing-slash': 'error' }),
68
68
  });
69
69
 
70
- expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`Array []`);
70
+ expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`[]`);
71
71
  });
72
72
 
73
73
  it('should not report on trailing slash in path if the path is root', async () => {
@@ -92,6 +92,6 @@ describe('no-channel-trailing-slash', () => {
92
92
  config: await makeConfig({ 'no-channel-trailing-slash': 'error' }),
93
93
  });
94
94
 
95
- expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`Array []`);
95
+ expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`[]`);
96
96
  });
97
97
  });
@@ -7,8 +7,9 @@ import { TagDescription } from '../common/tag-description';
7
7
  import { TagsAlphabetical } from '../common/tags-alphabetical';
8
8
  import { ChannelsKebabCase } from './channels-kebab-case';
9
9
  import { NoChannelTrailingSlash } from './no-channel-trailing-slash';
10
+ import type { Async2RuleSet } from '../../oas-types';
10
11
 
11
- export const rules = {
12
+ export const rules: Async2RuleSet<'built-in'> = {
12
13
  spec: Spec as Async2Rule,
13
14
  assertions: Assertions,
14
15
  'info-contact': InfoContact,
@@ -21,10 +21,10 @@ describe('Oas3 info-license', () => {
21
21
  });
22
22
 
23
23
  expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`
24
- Array [
25
- Object {
26
- "location": Array [
27
- Object {
24
+ [
25
+ {
26
+ "location": [
27
+ {
28
28
  "pointer": "#/info",
29
29
  "reportOnKey": true,
30
30
  "source": "foobar.yaml",
@@ -33,7 +33,7 @@ describe('Oas3 info-license', () => {
33
33
  "message": "Info object should contain \`license\` field.",
34
34
  "ruleId": "info-license",
35
35
  "severity": "error",
36
- "suggest": Array [],
36
+ "suggest": [],
37
37
  },
38
38
  ]
39
39
  `);
@@ -57,6 +57,6 @@ describe('Oas3 info-license', () => {
57
57
  config: await makeConfig({ 'info-license': 'error' }),
58
58
  });
59
59
 
60
- expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`Array []`);
60
+ expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`[]`);
61
61
  });
62
62
  });
@@ -22,10 +22,10 @@ describe('Oas3 license-url', () => {
22
22
  });
23
23
 
24
24
  expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`
25
- Array [
26
- Object {
27
- "location": Array [
28
- Object {
25
+ [
26
+ {
27
+ "location": [
28
+ {
29
29
  "pointer": "#/info/license/url",
30
30
  "reportOnKey": true,
31
31
  "source": "foobar.yaml",
@@ -34,7 +34,7 @@ describe('Oas3 license-url', () => {
34
34
  "message": "License object should contain \`url\` field.",
35
35
  "ruleId": "info-license-url",
36
36
  "severity": "error",
37
- "suggest": Array [],
37
+ "suggest": [],
38
38
  },
39
39
  ]
40
40
  `);
@@ -58,6 +58,6 @@ describe('Oas3 license-url', () => {
58
58
  config: await makeConfig({ 'info-license-url': 'error' }),
59
59
  });
60
60
 
61
- expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`Array []`);
61
+ expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`[]`);
62
62
  });
63
63
  });
@@ -50,10 +50,10 @@ describe('no-ambiguous-paths', () => {
50
50
  });
51
51
 
52
52
  expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`
53
- Array [
54
- Object {
55
- "location": Array [
56
- Object {
53
+ [
54
+ {
55
+ "location": [
56
+ {
57
57
  "pointer": "#/paths/~1{id}~1ambiguous",
58
58
  "reportOnKey": true,
59
59
  "source": "foobar.yaml",
@@ -62,11 +62,11 @@ describe('no-ambiguous-paths', () => {
62
62
  "message": "Paths should resolve unambiguously. Found two ambiguous paths: \`/good/{id}\` and \`/{id}/ambiguous\`.",
63
63
  "ruleId": "no-ambiguous-paths",
64
64
  "severity": "error",
65
- "suggest": Array [],
65
+ "suggest": [],
66
66
  },
67
- Object {
68
- "location": Array [
69
- Object {
67
+ {
68
+ "location": [
69
+ {
70
70
  "pointer": "#/paths/~1ambiguous~1{id}",
71
71
  "reportOnKey": true,
72
72
  "source": "foobar.yaml",
@@ -75,11 +75,11 @@ describe('no-ambiguous-paths', () => {
75
75
  "message": "Paths should resolve unambiguously. Found two ambiguous paths: \`/{id}/ambiguous\` and \`/ambiguous/{id}\`.",
76
76
  "ruleId": "no-ambiguous-paths",
77
77
  "severity": "error",
78
- "suggest": Array [],
78
+ "suggest": [],
79
79
  },
80
- Object {
81
- "location": Array [
82
- Object {
80
+ {
81
+ "location": [
82
+ {
83
83
  "pointer": "#/paths/~1{entity}~1{id}~1last",
84
84
  "reportOnKey": true,
85
85
  "source": "foobar.yaml",
@@ -88,7 +88,7 @@ describe('no-ambiguous-paths', () => {
88
88
  "message": "Paths should resolve unambiguously. Found two ambiguous paths: \`/good/{id}/{pet}\` and \`/{entity}/{id}/last\`.",
89
89
  "ruleId": "no-ambiguous-paths",
90
90
  "severity": "error",
91
- "suggest": Array [],
91
+ "suggest": [],
92
92
  },
93
93
  ]
94
94
  `);
@@ -32,7 +32,7 @@ describe('Oas3 typed enum', () => {
32
32
  config: await makeConfig({ 'no-enum-type-mismatch': 'error' }),
33
33
  });
34
34
 
35
- expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`Array []`);
35
+ expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`[]`);
36
36
  });
37
37
 
38
38
  it('should not report on enum object if all items match type and enum is nullable', async () => {
@@ -65,7 +65,7 @@ describe('Oas3 typed enum', () => {
65
65
  config: await makeConfig({ 'no-enum-type-mismatch': 'error' }),
66
66
  });
67
67
 
68
- expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`Array []`);
68
+ expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`[]`);
69
69
  });
70
70
 
71
71
  it('should report on enum object if not all items match type', async () => {
@@ -96,19 +96,19 @@ describe('Oas3 typed enum', () => {
96
96
  });
97
97
 
98
98
  expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`
99
- Array [
100
- Object {
101
- "location": Array [
102
- Object {
99
+ [
100
+ {
101
+ "location": [
102
+ {
103
103
  "pointer": "#/paths/~1some/get/responses/200/content/application~1json/schema/enum/1",
104
104
  "reportOnKey": false,
105
105
  "source": "foobar.yaml",
106
106
  },
107
107
  ],
108
- "message": "All values of \`enum\` field must be of the same type as the \`type\` field: expected \\"integer\\" but received \\"string\\".",
108
+ "message": "All values of \`enum\` field must be of the same type as the \`type\` field: expected "integer" but received "string".",
109
109
  "ruleId": "no-enum-type-mismatch",
110
110
  "severity": "error",
111
- "suggest": Array [],
111
+ "suggest": [],
112
112
  },
113
113
  ]
114
114
  `);
@@ -144,10 +144,10 @@ describe('Oas3 typed enum', () => {
144
144
  });
145
145
 
146
146
  expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`
147
- Array [
148
- Object {
149
- "location": Array [
150
- Object {
147
+ [
148
+ {
149
+ "location": [
150
+ {
151
151
  "pointer": "#/paths/~1some/get/responses/200/content/application~1json/schema/enum/1",
152
152
  "reportOnKey": false,
153
153
  "source": "foobar.yaml",
@@ -156,7 +156,7 @@ describe('Oas3 typed enum', () => {
156
156
  "message": "Enum value \`string\` must be of allowed types: \`integer,array\`.",
157
157
  "ruleId": "no-enum-type-mismatch",
158
158
  "severity": "error",
159
- "suggest": Array [],
159
+ "suggest": [],
160
160
  },
161
161
  ]
162
162
  `);
@@ -189,11 +189,11 @@ describe('Oas3 typed enum', () => {
189
189
  });
190
190
 
191
191
  expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`
192
- Array [
193
- Object {
192
+ [
193
+ {
194
194
  "from": undefined,
195
- "location": Array [
196
- Object {
195
+ "location": [
196
+ {
197
197
  "pointer": "#/paths/~1some/get/responses/200/content/application~1json/schema",
198
198
  "reportOnKey": false,
199
199
  "source": "foobar.yaml",
@@ -202,7 +202,7 @@ describe('Oas3 typed enum', () => {
202
202
  "message": "Expected type \`Schema\` (object) but got \`null\`",
203
203
  "ruleId": "spec",
204
204
  "severity": "error",
205
- "suggest": Array [],
205
+ "suggest": [],
206
206
  },
207
207
  ]
208
208
  `);
@@ -38,10 +38,10 @@ describe('no-identical-paths', () => {
38
38
  });
39
39
 
40
40
  expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`
41
- Array [
42
- Object {
43
- "location": Array [
44
- Object {
41
+ [
42
+ {
43
+ "location": [
44
+ {
45
45
  "pointer": "#/paths/~1good~1{hash}",
46
46
  "reportOnKey": true,
47
47
  "source": "foobar.yaml",
@@ -50,7 +50,7 @@ describe('no-identical-paths', () => {
50
50
  "message": "The path already exists which differs only by path parameter name(s): \`/good/{id}\` and \`/good/{hash}\`.",
51
51
  "ruleId": "no-identical-paths",
52
52
  "severity": "error",
53
- "suggest": Array [],
53
+ "suggest": [],
54
54
  },
55
55
  ]
56
56
  `);
@@ -23,10 +23,10 @@ describe('no-path-trailing-slash', () => {
23
23
  });
24
24
 
25
25
  expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`
26
- Array [
27
- Object {
28
- "location": Array [
29
- Object {
26
+ [
27
+ {
28
+ "location": [
29
+ {
30
30
  "pointer": "#/paths/~1bad~1",
31
31
  "reportOnKey": true,
32
32
  "source": "foobar.yaml",
@@ -35,7 +35,7 @@ describe('no-path-trailing-slash', () => {
35
35
  "message": "\`/bad/\` should not have a trailing slash.",
36
36
  "ruleId": "no-path-trailing-slash",
37
37
  "severity": "error",
38
- "suggest": Array [],
38
+ "suggest": [],
39
39
  },
40
40
  ]
41
41
  `);
@@ -64,10 +64,10 @@ describe('no-path-trailing-slash', () => {
64
64
  });
65
65
 
66
66
  expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`
67
- Array [
68
- Object {
69
- "location": Array [
70
- Object {
67
+ [
68
+ {
69
+ "location": [
70
+ {
71
71
  "pointer": "#/paths/~1bad~1",
72
72
  "reportOnKey": true,
73
73
  "source": "foobar.yaml",
@@ -76,7 +76,7 @@ describe('no-path-trailing-slash', () => {
76
76
  "message": "\`/bad/\` should not have a trailing slash.",
77
77
  "ruleId": "no-path-trailing-slash",
78
78
  "severity": "error",
79
- "suggest": Array [],
79
+ "suggest": [],
80
80
  },
81
81
  ]
82
82
  `);
@@ -100,7 +100,7 @@ describe('no-path-trailing-slash', () => {
100
100
  config: await makeConfig({ 'no-path-trailing-slash': 'error' }),
101
101
  });
102
102
 
103
- expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`Array []`);
103
+ expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`[]`);
104
104
  });
105
105
 
106
106
  it('should not report on trailing slash in path if the path is root', async () => {
@@ -121,6 +121,6 @@ describe('no-path-trailing-slash', () => {
121
121
  config: await makeConfig({ 'no-path-trailing-slash': 'error' }),
122
122
  });
123
123
 
124
- expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`Array []`);
124
+ expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`[]`);
125
125
  });
126
126
  });
@@ -25,10 +25,10 @@ describe('Oas3 operation-2xx-response', () => {
25
25
  });
26
26
 
27
27
  expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`
28
- Array [
29
- Object {
30
- "location": Array [
31
- Object {
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-2xx-response', () => {
37
37
  "message": "Operation must have at least one \`2XX\` response.",
38
38
  "ruleId": "operation-2xx-response",
39
39
  "severity": "error",
40
- "suggest": Array [],
40
+ "suggest": [],
41
41
  },
42
42
  ]
43
43
  `);
@@ -63,7 +63,7 @@ describe('Oas3 operation-2xx-response', () => {
63
63
  config: await makeConfig({ 'operation-2xx-response': 'error' }),
64
64
  });
65
65
 
66
- expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`Array []`);
66
+ expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`[]`);
67
67
  });
68
68
 
69
69
  it('should not report for present default', async () => {
@@ -86,7 +86,7 @@ describe('Oas3 operation-2xx-response', () => {
86
86
  config: await makeConfig({ 'operation-2xx-response': 'error' }),
87
87
  });
88
88
 
89
- expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`Array []`);
89
+ expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`[]`);
90
90
  });
91
91
 
92
92
  it('should report even if the responses are null', async () => {
@@ -108,10 +108,10 @@ describe('Oas3 operation-2xx-response', () => {
108
108
  });
109
109
 
110
110
  expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`
111
- Array [
112
- Object {
113
- "location": Array [
114
- Object {
111
+ [
112
+ {
113
+ "location": [
114
+ {
115
115
  "pointer": "#/paths/~1test~1/put/responses",
116
116
  "reportOnKey": true,
117
117
  "source": "foobar.yaml",
@@ -120,7 +120,7 @@ describe('Oas3 operation-2xx-response', () => {
120
120
  "message": "Operation must have at least one \`2XX\` response.",
121
121
  "ruleId": "operation-2xx-response",
122
122
  "severity": "error",
123
- "suggest": Array [],
123
+ "suggest": [],
124
124
  },
125
125
  ]
126
126
  `);
@@ -149,10 +149,10 @@ describe('Oas3 operation-2xx-response', () => {
149
149
  });
150
150
 
151
151
  expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`
152
- Array [
153
- Object {
154
- "location": Array [
155
- Object {
152
+ [
153
+ {
154
+ "location": [
155
+ {
156
156
  "pointer": "#/webhooks/~1test~1/put/responses",
157
157
  "reportOnKey": true,
158
158
  "source": "foobar.yaml",
@@ -161,7 +161,7 @@ describe('Oas3 operation-2xx-response', () => {
161
161
  "message": "Operation must have at least one \`2XX\` response.",
162
162
  "ruleId": "operation-2xx-response",
163
163
  "severity": "error",
164
- "suggest": Array [],
164
+ "suggest": [],
165
165
  },
166
166
  ]
167
167
  `);
@@ -187,6 +187,6 @@ describe('Oas3 operation-2xx-response', () => {
187
187
  config: await makeConfig({ 'operation-2xx-response': 'error' }),
188
188
  });
189
189
 
190
- expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`Array []`);
190
+ expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`[]`);
191
191
  });
192
192
  });