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