@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
@@ -23,10 +23,10 @@ describe('Oas3 tags-alphabetical', () => {
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": "#/tags/0",
31
31
  "reportOnKey": false,
32
32
  "source": "foobar.yaml",
@@ -35,7 +35,7 @@ describe('Oas3 tags-alphabetical', () => {
35
35
  "message": "The \`tags\` array should be in alphabetical order.",
36
36
  "ruleId": "tags-alphabetical",
37
37
  "severity": "error",
38
- "suggest": Array [],
38
+ "suggest": [],
39
39
  },
40
40
  ]
41
41
  `);
@@ -59,7 +59,7 @@ describe('Oas3 tags-alphabetical', () => {
59
59
  config: await makeConfig({ 'tags-alphabetical': 'error' }),
60
60
  });
61
61
 
62
- expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`Array []`);
62
+ expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`[]`);
63
63
  });
64
64
 
65
65
  it('should report on tags object if not sorted alphabetically not ignoring case', async () => {
@@ -81,10 +81,10 @@ describe('Oas3 tags-alphabetical', () => {
81
81
  });
82
82
 
83
83
  expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`
84
- Array [
85
- Object {
86
- "location": Array [
87
- Object {
84
+ [
85
+ {
86
+ "location": [
87
+ {
88
88
  "pointer": "#/tags/0",
89
89
  "reportOnKey": false,
90
90
  "source": "foobar.yaml",
@@ -93,7 +93,7 @@ describe('Oas3 tags-alphabetical', () => {
93
93
  "message": "The \`tags\` array should be in alphabetical order.",
94
94
  "ruleId": "tags-alphabetical",
95
95
  "severity": "error",
96
- "suggest": Array [],
96
+ "suggest": [],
97
97
  },
98
98
  ]
99
99
  `);
@@ -117,6 +117,6 @@ describe('Oas3 tags-alphabetical', () => {
117
117
  config: await makeConfig({ 'tags-alphabetical': { severity: 'error', ignoreCase: true } }),
118
118
  });
119
119
 
120
- expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`Array []`);
120
+ expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`[]`);
121
121
  });
122
122
  });
@@ -58,39 +58,39 @@ describe('Oas3 assertions', () => {
58
58
  it('should return the right visitor structure', () => {
59
59
  const visitors = Assertions(opts as any);
60
60
  expect(visitors).toMatchInlineSnapshot(`
61
- Array [
62
- Object {
63
- "Operation": Object {
61
+ [
62
+ {
63
+ "Operation": {
64
64
  "enter": [Function],
65
65
  },
66
66
  },
67
- Object {
68
- "Operation": Object {
69
- "PathItem": Object {
67
+ {
68
+ "Operation": {
69
+ "PathItem": {
70
70
  "enter": [Function],
71
71
  },
72
72
  "skip": [Function],
73
73
  },
74
74
  },
75
- Object {
76
- "Operation": Object {
77
- "PathItem": Object {
75
+ {
76
+ "Operation": {
77
+ "PathItem": {
78
78
  "enter": [Function],
79
79
  },
80
80
  "skip": [Function],
81
81
  },
82
82
  },
83
- Object {
84
- "Bar": Object {
85
- "Baz": Object {
86
- "Foo": Object {
83
+ {
84
+ "Bar": {
85
+ "Baz": {
86
+ "Foo": {
87
87
  "enter": [Function],
88
88
  },
89
89
  },
90
90
  },
91
91
  },
92
- Object {
93
- "any": Object {
92
+ {
93
+ "any": {
94
94
  "enter": [Function],
95
95
  },
96
96
  },
@@ -59,11 +59,11 @@ describe('Oas3 assertions', () => {
59
59
  );
60
60
 
61
61
  expect(visitors).toMatchInlineSnapshot(`
62
- Object {
63
- "Foo": Object {
64
- "Bar": Object {
65
- "Roof": Object {
66
- "Bar": Object {
62
+ {
63
+ "Foo": {
64
+ "Bar": {
65
+ "Roof": {
66
+ "Bar": {
67
67
  "enter": [Function],
68
68
  },
69
69
  "skip": [Function],
@@ -100,10 +100,10 @@ describe('Oas3 assertions', () => {
100
100
  );
101
101
 
102
102
  expect(visitors).toMatchInlineSnapshot(`
103
- Object {
104
- "Operation": Object {
105
- "Responses": Object {
106
- "MediaTypesMap": Object {
103
+ {
104
+ "Operation": {
105
+ "Responses": {
106
+ "MediaTypesMap": {
107
107
  "enter": [Function],
108
108
  },
109
109
  "skip": [Function],
@@ -25,10 +25,10 @@ describe('oas2 boolean-parameter-prefixes', () => {
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/parameters/0/name",
33
33
  "reportOnKey": false,
34
34
  "source": "foobar.yaml",
@@ -37,7 +37,7 @@ describe('oas2 boolean-parameter-prefixes', () => {
37
37
  "message": "Boolean parameter \`a\` should have \`is\` or \`has\` prefix.",
38
38
  "ruleId": "boolean-parameter-prefixes",
39
39
  "severity": "error",
40
- "suggest": Array [],
40
+ "suggest": [],
41
41
  },
42
42
  ]
43
43
  `);
@@ -76,7 +76,7 @@ describe('oas2 boolean-parameter-prefixes', () => {
76
76
  config: await makeConfig({ 'boolean-parameter-prefixes': 'error' }),
77
77
  });
78
78
 
79
- expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`Array []`);
79
+ expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`[]`);
80
80
  });
81
81
 
82
82
  it('should not report on boolean param with custom prefix', async () => {
@@ -105,6 +105,6 @@ describe('oas2 boolean-parameter-prefixes', () => {
105
105
  }),
106
106
  });
107
107
 
108
- expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`Array []`);
108
+ expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`[]`);
109
109
  });
110
110
  });
@@ -36,10 +36,10 @@ describe('Oas2 response-contains-header', () => {
36
36
  }),
37
37
  });
38
38
  expect(results).toMatchInlineSnapshot(`
39
- Array [
40
- Object {
41
- "location": Array [
42
- Object {
39
+ [
40
+ {
41
+ "location": [
42
+ {
43
43
  "pointer": "#/paths/~1accounts~1{accountId}/get/responses/201/headers",
44
44
  "reportOnKey": true,
45
45
  "source": Source {
@@ -66,14 +66,14 @@ describe('Oas2 response-contains-header', () => {
66
66
  },
67
67
  },
68
68
  ],
69
- "message": "Response object must contain a \\"Content-Length\\" header.",
69
+ "message": "Response object must contain a "Content-Length" header.",
70
70
  "ruleId": "response-contains-header",
71
71
  "severity": "error",
72
- "suggest": Array [],
72
+ "suggest": [],
73
73
  },
74
- Object {
75
- "location": Array [
76
- Object {
74
+ {
75
+ "location": [
76
+ {
77
77
  "pointer": "#/paths/~1accounts~1{accountId}/get/responses/404/headers",
78
78
  "reportOnKey": true,
79
79
  "source": Source {
@@ -100,10 +100,10 @@ describe('Oas2 response-contains-header', () => {
100
100
  },
101
101
  },
102
102
  ],
103
- "message": "Response object must contain a \\"Content-Length\\" header.",
103
+ "message": "Response object must contain a "Content-Length" header.",
104
104
  "ruleId": "response-contains-header",
105
105
  "severity": "error",
106
- "suggest": Array [],
106
+ "suggest": [],
107
107
  },
108
108
  ]
109
109
  `);
@@ -142,7 +142,7 @@ describe('Oas2 response-contains-header', () => {
142
142
  },
143
143
  }),
144
144
  });
145
- expect(results).toMatchInlineSnapshot(`Array []`);
145
+ expect(results).toMatchInlineSnapshot(`[]`);
146
146
  });
147
147
 
148
148
  it('should not report a response object when there is no `names` section defined', async () => {
@@ -169,6 +169,6 @@ describe('Oas2 response-contains-header', () => {
169
169
  },
170
170
  }),
171
171
  });
172
- expect(results).toMatchInlineSnapshot(`Array []`);
172
+ expect(results).toMatchInlineSnapshot(`[]`);
173
173
  });
174
174
  });
@@ -42,10 +42,10 @@ describe('Oas2 response-contains-property', () => {
42
42
  }),
43
43
  });
44
44
  expect(results).toMatchInlineSnapshot(`
45
- Array [
46
- Object {
47
- "location": Array [
48
- Object {
45
+ [
46
+ {
47
+ "location": [
48
+ {
49
49
  "pointer": "#/paths/~1accounts~1{accountId}/get/responses/200/schema/properties",
50
50
  "reportOnKey": true,
51
51
  "source": Source {
@@ -78,10 +78,10 @@ describe('Oas2 response-contains-property', () => {
78
78
  },
79
79
  },
80
80
  ],
81
- "message": "Response object must contain a top-level \\"id\\" property.",
81
+ "message": "Response object must contain a top-level "id" property.",
82
82
  "ruleId": "response-contains-property",
83
83
  "severity": "error",
84
- "suggest": Array [],
84
+ "suggest": [],
85
85
  },
86
86
  ]
87
87
  `);
@@ -123,7 +123,7 @@ describe('Oas2 response-contains-property', () => {
123
123
  },
124
124
  }),
125
125
  });
126
- expect(results).toMatchInlineSnapshot(`Array []`);
126
+ expect(results).toMatchInlineSnapshot(`[]`);
127
127
  });
128
128
 
129
129
  it('should not report a response object when there is no `names` section defined', async () => {
@@ -150,6 +150,6 @@ describe('Oas2 response-contains-property', () => {
150
150
  },
151
151
  }),
152
152
  });
153
- expect(results).toMatchInlineSnapshot(`Array []`);
153
+ expect(results).toMatchInlineSnapshot(`[]`);
154
154
  });
155
155
  });
@@ -22,8 +22,8 @@ describe('OpenAPI Schema 2.0', () => {
22
22
  spec: 'error',
23
23
  })
24
24
  ).toMatchInlineSnapshot(`
25
- Array [
26
- Object {
25
+ [
26
+ {
27
27
  "location": "#/info/title",
28
28
  "message": "Expected type \`string\` but got \`null\`.",
29
29
  },
@@ -52,8 +52,8 @@ describe('OpenAPI Schema 2.0', () => {
52
52
  spec: 'error',
53
53
  })
54
54
  ).toMatchInlineSnapshot(`
55
- Array [
56
- Object {
55
+ [
56
+ {
57
57
  "location": "#/info/description",
58
58
  "message": "Expected type \`string\` but got \`null\`.",
59
59
  },
@@ -82,8 +82,8 @@ describe('OpenAPI Schema 2.0', () => {
82
82
  spec: 'error',
83
83
  })
84
84
  ).toMatchInlineSnapshot(`
85
- Array [
86
- Object {
85
+ [
86
+ {
87
87
  "location": "#/info/termsOfService",
88
88
  "message": "Expected type \`string\` but got \`null\`.",
89
89
  },
@@ -115,7 +115,7 @@ describe('OpenAPI Schema 2.0', () => {
115
115
  await lintDoc(source, {
116
116
  spec: 'error',
117
117
  })
118
- ).toMatchInlineSnapshot(`Array []`);
118
+ ).toMatchInlineSnapshot(`[]`);
119
119
  });
120
120
 
121
121
  it('should report if in the Contact Object in URL field is not string', async () => {
@@ -142,8 +142,8 @@ describe('OpenAPI Schema 2.0', () => {
142
142
  spec: 'error',
143
143
  })
144
144
  ).toMatchInlineSnapshot(`
145
- Array [
146
- Object {
145
+ [
146
+ {
147
147
  "location": "#/info/contact/url",
148
148
  "message": "Expected type \`string\` but got \`null\`.",
149
149
  },
@@ -175,8 +175,8 @@ describe('OpenAPI Schema 2.0', () => {
175
175
  spec: 'error',
176
176
  })
177
177
  ).toMatchInlineSnapshot(`
178
- Array [
179
- Object {
178
+ [
179
+ {
180
180
  "location": "#/info/contact/email",
181
181
  "message": "Expected type \`string\` but got \`null\`.",
182
182
  },
@@ -206,7 +206,7 @@ describe('OpenAPI Schema 2.0', () => {
206
206
  await lintDoc(source, {
207
207
  spec: 'error',
208
208
  })
209
- ).toMatchInlineSnapshot(`Array []`);
209
+ ).toMatchInlineSnapshot(`[]`);
210
210
  });
211
211
 
212
212
  it('should report if the License Object missing field Name', async () => {
@@ -231,8 +231,8 @@ describe('OpenAPI Schema 2.0', () => {
231
231
  spec: 'error',
232
232
  })
233
233
  ).toMatchInlineSnapshot(`
234
- Array [
235
- Object {
234
+ [
235
+ {
236
236
  "location": "#/info/license",
237
237
  "message": "The field \`name\` must be present on this level.",
238
238
  },
@@ -263,8 +263,8 @@ describe('OpenAPI Schema 2.0', () => {
263
263
  spec: 'error',
264
264
  })
265
265
  ).toMatchInlineSnapshot(`
266
- Array [
267
- Object {
266
+ [
267
+ {
268
268
  "location": "#/info/license/url",
269
269
  "message": "Expected type \`string\` but got \`null\`.",
270
270
  },
@@ -293,7 +293,7 @@ describe('OpenAPI Schema 2.0', () => {
293
293
  await lintDoc(source, {
294
294
  spec: 'error',
295
295
  })
296
- ).toMatchInlineSnapshot(`Array []`);
296
+ ).toMatchInlineSnapshot(`[]`);
297
297
  });
298
298
 
299
299
  it('should report if the Version field is not provided', async () => {
@@ -315,8 +315,8 @@ describe('OpenAPI Schema 2.0', () => {
315
315
  spec: 'error',
316
316
  })
317
317
  ).toMatchInlineSnapshot(`
318
- Array [
319
- Object {
318
+ [
319
+ {
320
320
  "location": "#/info",
321
321
  "message": "The field \`version\` must be present on this level.",
322
322
  },
@@ -344,8 +344,8 @@ describe('OpenAPI Schema 2.0', () => {
344
344
  spec: 'error',
345
345
  })
346
346
  ).toMatchInlineSnapshot(`
347
- Array [
348
- Object {
347
+ [
348
+ {
349
349
  "location": "#/info/version",
350
350
  "message": "Expected type \`string\` but got \`null\`.",
351
351
  },
@@ -21,7 +21,7 @@ describe('OpenAPI Schema 2.0', () => {
21
21
  await lintDoc(source, {
22
22
  spec: 'error',
23
23
  })
24
- ).toMatchInlineSnapshot(`Array []`);
24
+ ).toMatchInlineSnapshot(`[]`);
25
25
  });
26
26
 
27
27
  it('should not report of a valid PUT operation object', async () => {
@@ -48,7 +48,7 @@ describe('OpenAPI Schema 2.0', () => {
48
48
  await lintDoc(source, {
49
49
  spec: 'error',
50
50
  })
51
- ).toMatchInlineSnapshot(`Array []`);
51
+ ).toMatchInlineSnapshot(`[]`);
52
52
  });
53
53
 
54
54
  it('should not report of a valid Post operation object', async () => {
@@ -82,7 +82,7 @@ describe('OpenAPI Schema 2.0', () => {
82
82
  await lintDoc(source, {
83
83
  spec: 'error',
84
84
  })
85
- ).toMatchInlineSnapshot(`Array []`);
85
+ ).toMatchInlineSnapshot(`[]`);
86
86
  });
87
87
 
88
88
  it('should not report of a valid delete operation object', async () => {
@@ -118,6 +118,6 @@ describe('OpenAPI Schema 2.0', () => {
118
118
  await lintDoc(source, {
119
119
  spec: 'error',
120
120
  })
121
- ).toMatchInlineSnapshot(`Array []`);
121
+ ).toMatchInlineSnapshot(`[]`);
122
122
  });
123
123
  });
@@ -21,7 +21,7 @@ describe('OpenAPI Schema', () => {
21
21
  await lintDoc(source, {
22
22
  spec: 'error',
23
23
  })
24
- ).toMatchInlineSnapshot(`Array []`);
24
+ ).toMatchInlineSnapshot(`[]`);
25
25
  });
26
26
 
27
27
  it('should not report if Path object is empty ', async () => {
@@ -38,7 +38,7 @@ describe('OpenAPI Schema', () => {
38
38
  await lintDoc(source, {
39
39
  spec: 'error',
40
40
  })
41
- ).toMatchInlineSnapshot(`Array []`);
41
+ ).toMatchInlineSnapshot(`[]`);
42
42
  });
43
43
 
44
44
  it('should report if Path object is not present ', async () => {
@@ -54,8 +54,8 @@ describe('OpenAPI Schema', () => {
54
54
  spec: 'error',
55
55
  })
56
56
  ).toMatchInlineSnapshot(`
57
- Array [
58
- Object {
57
+ [
58
+ {
59
59
  "location": "#/",
60
60
  "message": "The field \`paths\` must be present on this level.",
61
61
  },
@@ -77,7 +77,7 @@ describe('OpenAPI Schema', () => {
77
77
  await lintDoc(source, {
78
78
  spec: 'error',
79
79
  })
80
- ).toMatchInlineSnapshot(`Array []`);
80
+ ).toMatchInlineSnapshot(`[]`);
81
81
  });
82
82
 
83
83
  //Check: no error
@@ -101,8 +101,8 @@ describe('OpenAPI Schema', () => {
101
101
  spec: 'error',
102
102
  })
103
103
  ).toMatchInlineSnapshot(`
104
- Array [
105
- Object {
104
+ [
105
+ {
106
106
  "location": "#/paths/ping",
107
107
  "message": "Property \`ping\` is not expected here.",
108
108
  },
@@ -134,7 +134,7 @@ describe('OpenAPI Schema', () => {
134
134
  await lintDoc(source, {
135
135
  'paths-identical': 'error',
136
136
  })
137
- ).toMatchInlineSnapshot(`Array []`);
137
+ ).toMatchInlineSnapshot(`[]`);
138
138
  });
139
139
 
140
140
  it('should not report valid matching URLs', async () => {
@@ -161,7 +161,7 @@ describe('OpenAPI Schema', () => {
161
161
  await lintDoc(source, {
162
162
  spec: 'error',
163
163
  })
164
- ).toMatchInlineSnapshot(`Array []`);
164
+ ).toMatchInlineSnapshot(`[]`);
165
165
  });
166
166
 
167
167
  it('should not report in case of ambiguous matching ', async () => {
@@ -188,7 +188,7 @@ describe('OpenAPI Schema', () => {
188
188
  await lintDoc(source, {
189
189
  spec: 'error',
190
190
  })
191
- ).toMatchInlineSnapshot(`Array []`);
191
+ ).toMatchInlineSnapshot(`[]`);
192
192
  });
193
193
 
194
194
  it('should not report if Path Item is empty ', async () => {
@@ -206,7 +206,7 @@ describe('OpenAPI Schema', () => {
206
206
  await lintDoc(source, {
207
207
  spec: 'error',
208
208
  })
209
- ).toMatchInlineSnapshot(`Array []`);
209
+ ).toMatchInlineSnapshot(`[]`);
210
210
  });
211
211
 
212
212
  it('should not report of a valid Parameter Object', async () => {
@@ -240,6 +240,6 @@ describe('OpenAPI Schema', () => {
240
240
  await lintDoc(source, {
241
241
  spec: 'error',
242
242
  })
243
- ).toMatchInlineSnapshot(`Array []`);
243
+ ).toMatchInlineSnapshot(`[]`);
244
244
  });
245
245
  });
@@ -30,6 +30,6 @@ describe('Referenceable scalars', () => {
30
30
  }),
31
31
  });
32
32
 
33
- expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`Array []`);
33
+ expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`[]`);
34
34
  });
35
35
  });
@@ -42,7 +42,9 @@ import { ScalarPropertyMissingExample } from '../common/scalar-property-missing-
42
42
  import { RequiredStringPropertyMissingMinLength } from '../common/required-string-property-missing-min-length';
43
43
  import { SpecStrictRefs } from '../common/spec-strict-refs';
44
44
 
45
- export const rules = {
45
+ import type { Oas2RuleSet } from 'core/src/oas-types';
46
+
47
+ export const rules: Oas2RuleSet<'built-in'> = {
46
48
  spec: Spec as Oas2Rule,
47
49
  'no-invalid-schema-examples': NoInvalidSchemaExamples,
48
50
  'no-invalid-parameter-examples': NoInvalidParameterExamples,
@@ -26,10 +26,10 @@ describe('oas3 boolean-parameter-prefixes', () => {
26
26
  });
27
27
 
28
28
  expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`
29
- Array [
30
- Object {
31
- "location": Array [
32
- Object {
29
+ [
30
+ {
31
+ "location": [
32
+ {
33
33
  "pointer": "#/paths/~1test/parameters/0/name",
34
34
  "reportOnKey": false,
35
35
  "source": "foobar.yaml",
@@ -38,7 +38,7 @@ describe('oas3 boolean-parameter-prefixes', () => {
38
38
  "message": "Boolean parameter \`a\` should have \`is\` or \`has\` prefix.",
39
39
  "ruleId": "boolean-parameter-prefixes",
40
40
  "severity": "error",
41
- "suggest": Array [],
41
+ "suggest": [],
42
42
  },
43
43
  ]
44
44
  `);
@@ -77,7 +77,7 @@ describe('oas3 boolean-parameter-prefixes', () => {
77
77
  config: await makeConfig({ 'boolean-parameter-prefixes': 'error' }),
78
78
  });
79
79
 
80
- expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`Array []`);
80
+ expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`[]`);
81
81
  });
82
82
 
83
83
  it('should not report on boolean param with custom prefix', async () => {
@@ -106,6 +106,6 @@ describe('oas3 boolean-parameter-prefixes', () => {
106
106
  }),
107
107
  });
108
108
 
109
- expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`Array []`);
109
+ expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`[]`);
110
110
  });
111
111
  });