@redocly/openapi-core 1.0.0-beta.104 → 1.0.0-beta.107

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (203) hide show
  1. package/README.md +4 -4
  2. package/__tests__/utils.ts +8 -6
  3. package/lib/benchmark/benches/recommended-oas3.bench.js +1 -1
  4. package/lib/benchmark/utils.d.ts +2 -2
  5. package/lib/benchmark/utils.js +2 -2
  6. package/lib/bundle.d.ts +2 -2
  7. package/lib/bundle.js +2 -2
  8. package/lib/config/all.d.ts +2 -2
  9. package/lib/config/all.js +1 -1
  10. package/lib/config/builtIn.d.ts +2 -2
  11. package/lib/config/builtIn.js +2 -2
  12. package/lib/config/config-resolvers.d.ts +5 -5
  13. package/lib/config/config-resolvers.js +39 -36
  14. package/lib/config/config.d.ts +6 -5
  15. package/lib/config/config.js +27 -20
  16. package/lib/config/load.js +6 -7
  17. package/lib/config/minimal.d.ts +2 -2
  18. package/lib/config/minimal.js +3 -2
  19. package/lib/config/recommended.d.ts +2 -2
  20. package/lib/config/recommended.js +3 -2
  21. package/lib/config/rules.d.ts +2 -2
  22. package/lib/config/rules.js +1 -1
  23. package/lib/config/types.d.ts +23 -19
  24. package/lib/config/utils.d.ts +5 -5
  25. package/lib/config/utils.js +43 -26
  26. package/lib/decorators/common/remove-x-internal.js +2 -2
  27. package/lib/format/format.js +1 -1
  28. package/lib/index.d.ts +2 -2
  29. package/lib/index.js +3 -2
  30. package/lib/js-yaml/index.js +1 -6
  31. package/lib/lint.d.ts +2 -2
  32. package/lib/lint.js +16 -6
  33. package/lib/redocly/registry-api.d.ts +1 -1
  34. package/lib/redocly/registry-api.js +2 -2
  35. package/lib/rules/ajv.d.ts +1 -1
  36. package/lib/rules/ajv.js +6 -6
  37. package/lib/rules/common/info-license-url.d.ts +1 -1
  38. package/lib/rules/common/info-license-url.js +5 -10
  39. package/lib/rules/common/info-license.d.ts +2 -0
  40. package/lib/rules/common/info-license.js +17 -0
  41. package/lib/rules/common/no-enum-type-mismatch.js +1 -3
  42. package/lib/rules/common/no-invalid-parameter-examples.js +3 -3
  43. package/lib/rules/common/no-invalid-schema-examples.js +3 -3
  44. package/lib/rules/common/operation-operationId.js +1 -1
  45. package/lib/rules/common/path-not-include-query.js +1 -1
  46. package/lib/rules/common/paths-kebab-case.js +4 -1
  47. package/lib/rules/common/spec.js +1 -1
  48. package/lib/rules/oas2/index.js +4 -4
  49. package/lib/rules/oas2/remove-unused-components.js +3 -3
  50. package/lib/rules/oas3/index.js +4 -4
  51. package/lib/rules/oas3/no-empty-servers.js +1 -1
  52. package/lib/rules/oas3/no-invalid-media-type-examples.js +2 -2
  53. package/lib/rules/oas3/remove-unused-components.js +2 -2
  54. package/lib/rules/other/stats.js +43 -14
  55. package/lib/rules/utils.d.ts +3 -2
  56. package/lib/rules/utils.js +19 -4
  57. package/lib/types/index.d.ts +2 -2
  58. package/lib/types/redocly-yaml.js +8 -7
  59. package/lib/utils.d.ts +5 -2
  60. package/lib/utils.js +20 -2
  61. package/lib/walk.d.ts +2 -1
  62. package/lib/walk.js +6 -3
  63. package/package.json +2 -2
  64. package/src/__tests__/__snapshots__/bundle.test.ts.snap +141 -0
  65. package/src/__tests__/bundle.test.ts +68 -34
  66. package/src/__tests__/codeframes.test.ts +13 -14
  67. package/src/__tests__/fixtures/.redocly.lint-ignore.yaml +5 -0
  68. package/src/__tests__/js-yaml.test.ts +6 -4
  69. package/src/__tests__/lint.test.ts +127 -12
  70. package/src/__tests__/login.test.ts +2 -2
  71. package/src/__tests__/normalizeVisitors.test.ts +4 -4
  72. package/src/__tests__/ref-utils.test.ts +13 -13
  73. package/src/__tests__/resolve-http.test.ts +1 -1
  74. package/src/__tests__/resolve.test.ts +14 -11
  75. package/src/__tests__/utils.test.ts +42 -1
  76. package/src/__tests__/walk.test.ts +48 -56
  77. package/src/benchmark/benches/lint-with-many-rules.bench.ts +1 -1
  78. package/src/benchmark/benches/lint-with-nested-rule.bench.ts +1 -1
  79. package/src/benchmark/benches/lint-with-no-rules.bench.ts +1 -1
  80. package/src/benchmark/benches/lint-with-top-level-rule-report.bench.ts +1 -1
  81. package/src/benchmark/benches/lint-with-top-level-rule.bench.ts +1 -1
  82. package/src/benchmark/benches/recommended-oas3.bench.ts +3 -3
  83. package/src/benchmark/benches/resolve-with-no-external.bench.ts +1 -1
  84. package/src/benchmark/benchmark.js +9 -5
  85. package/src/benchmark/utils.ts +5 -5
  86. package/src/bundle.ts +18 -17
  87. package/src/config/__tests__/__snapshots__/config-resolvers.test.ts.snap +3 -1
  88. package/src/config/__tests__/config-resolvers.test.ts +123 -121
  89. package/src/config/__tests__/config.test.ts +76 -76
  90. package/src/config/__tests__/fixtures/resolve-config/api/plugin.js +4 -2
  91. package/src/config/__tests__/fixtures/resolve-config/plugin.js +4 -1
  92. package/src/config/__tests__/load.test.ts +2 -2
  93. package/src/config/__tests__/resolve-plugins.test.ts +3 -3
  94. package/src/config/__tests__/utils.test.ts +83 -0
  95. package/src/config/all.ts +3 -4
  96. package/src/config/builtIn.ts +5 -5
  97. package/src/config/config-resolvers.ts +122 -83
  98. package/src/config/config.ts +36 -32
  99. package/src/config/load.ts +13 -16
  100. package/src/config/minimal.ts +5 -4
  101. package/src/config/recommended.ts +5 -4
  102. package/src/config/rules.ts +6 -6
  103. package/src/config/types.ts +28 -19
  104. package/src/config/utils.ts +74 -54
  105. package/src/decorators/__tests__/filter-out.test.ts +8 -4
  106. package/src/decorators/__tests__/remove-x-internal.test.ts +5 -5
  107. package/src/decorators/common/filters/filter-helper.ts +1 -1
  108. package/src/decorators/common/info-description-override.ts +1 -1
  109. package/src/decorators/common/operation-description-override.ts +1 -1
  110. package/src/decorators/common/remove-x-internal.ts +4 -4
  111. package/src/decorators/common/tag-description-override.ts +1 -1
  112. package/src/format/codeframes.ts +4 -4
  113. package/src/format/format.ts +10 -10
  114. package/src/index.ts +3 -4
  115. package/src/js-yaml/index.ts +3 -8
  116. package/src/lint.ts +22 -18
  117. package/src/oas-types.ts +1 -6
  118. package/src/redocly/__tests__/redocly-client.test.ts +25 -19
  119. package/src/redocly/index.ts +6 -4
  120. package/src/redocly/registry-api.ts +6 -6
  121. package/src/ref-utils.ts +2 -2
  122. package/src/resolve.ts +7 -4
  123. package/src/rules/__tests__/no-unresolved-refs.test.ts +4 -4
  124. package/src/rules/__tests__/utils.test.ts +160 -0
  125. package/src/rules/ajv.ts +7 -8
  126. package/src/rules/common/__tests__/info-description.test.ts +3 -3
  127. package/src/rules/common/__tests__/info-license.test.ts +2 -2
  128. package/src/rules/common/__tests__/license-url.test.ts +2 -2
  129. package/src/rules/common/__tests__/no-ambiguous-paths.test.ts +1 -1
  130. package/src/rules/common/__tests__/no-enum-type-mismatch.test.ts +8 -8
  131. package/src/rules/common/__tests__/no-identical-paths.test.ts +1 -1
  132. package/src/rules/common/__tests__/no-path-trailing-slash.test.ts +3 -3
  133. package/src/rules/common/__tests__/operation-2xx-response.test.ts +3 -3
  134. package/src/rules/common/__tests__/operation-4xx-response.test.ts +3 -3
  135. package/src/rules/common/__tests__/operation-operationId-unique.test.ts +2 -2
  136. package/src/rules/common/__tests__/operation-operationId-url-safe.test.ts +1 -1
  137. package/src/rules/common/__tests__/operation-parameters-unique.test.ts +4 -4
  138. package/src/rules/common/__tests__/operation-security-defined.test.ts +2 -2
  139. package/src/rules/common/__tests__/operation-singular-tag.test.ts +2 -2
  140. package/src/rules/common/__tests__/path-http-verbs-order.test.ts +2 -2
  141. package/src/rules/common/__tests__/path-not-include-query.test.ts +2 -2
  142. package/src/rules/common/__tests__/path-params-defined.test.ts +3 -3
  143. package/src/rules/common/__tests__/paths-kebab-case.test.ts +15 -15
  144. package/src/rules/common/__tests__/scalar-property-missing-example.test.ts +8 -8
  145. package/src/rules/common/__tests__/spec.test.ts +2 -2
  146. package/src/rules/common/__tests__/tag-description.test.ts +2 -2
  147. package/src/rules/common/__tests__/tags-alphabetical.test.ts +2 -2
  148. package/src/rules/common/assertions/__tests__/asserts.test.ts +513 -130
  149. package/src/rules/common/assertions/index.ts +6 -6
  150. package/src/rules/common/info-license-url.ts +4 -9
  151. package/src/rules/common/info-license.ts +15 -0
  152. package/src/rules/common/no-ambiguous-paths.ts +1 -1
  153. package/src/rules/common/no-enum-type-mismatch.ts +12 -9
  154. package/src/rules/common/no-invalid-parameter-examples.ts +4 -4
  155. package/src/rules/common/no-invalid-schema-examples.ts +4 -4
  156. package/src/rules/common/operation-operationId.ts +1 -1
  157. package/src/rules/common/operation-parameters-unique.ts +2 -2
  158. package/src/rules/common/path-not-include-query.ts +1 -1
  159. package/src/rules/common/path-params-defined.ts +1 -1
  160. package/src/rules/common/paths-kebab-case.ts +4 -1
  161. package/src/rules/common/scalar-property-missing-example.ts +1 -1
  162. package/src/rules/common/spec.ts +10 -7
  163. package/src/rules/no-unresolved-refs.ts +1 -1
  164. package/src/rules/oas2/__tests__/boolean-parameter-prefixes.test.ts +3 -3
  165. package/src/rules/oas2/__tests__/spec/info.test.ts +12 -12
  166. package/src/rules/oas2/__tests__/spec/operation.test.ts +4 -4
  167. package/src/rules/oas2/__tests__/spec/paths.test.ts +10 -10
  168. package/src/rules/oas2/__tests__/spec/referenceableScalars.test.ts +6 -2
  169. package/src/rules/oas2/__tests__/spec/utils.ts +6 -6
  170. package/src/rules/oas2/index.ts +3 -3
  171. package/src/rules/oas2/remove-unused-components.ts +13 -8
  172. package/src/rules/oas3/__tests__/boolean-parameter-prefixes.test.ts +3 -3
  173. package/src/rules/oas3/__tests__/no-example-value-and-externalValue.test.ts +2 -2
  174. package/src/rules/oas3/__tests__/no-invalid-media-type-examples.test.ts +13 -13
  175. package/src/rules/oas3/__tests__/no-server-example.com.test.ts +2 -2
  176. package/src/rules/oas3/__tests__/no-server-trailing-slash.test.ts +3 -3
  177. package/src/rules/oas3/__tests__/no-unused-components.test.ts +1 -1
  178. package/src/rules/oas3/__tests__/spec/callbacks.test.ts +1 -1
  179. package/src/rules/oas3/__tests__/spec/info.test.ts +12 -12
  180. package/src/rules/oas3/__tests__/spec/operation.test.ts +8 -8
  181. package/src/rules/oas3/__tests__/spec/paths.test.ts +10 -10
  182. package/src/rules/oas3/__tests__/spec/referenceableScalars.test.ts +12 -12
  183. package/src/rules/oas3/__tests__/spec/servers.test.ts +15 -15
  184. package/src/rules/oas3/__tests__/spec/spec.test.ts +6 -6
  185. package/src/rules/oas3/__tests__/spec/utils.ts +6 -6
  186. package/src/rules/oas3/index.ts +3 -3
  187. package/src/rules/oas3/no-empty-servers.ts +1 -1
  188. package/src/rules/oas3/no-invalid-media-type-examples.ts +14 -6
  189. package/src/rules/oas3/no-servers-empty-enum.ts +9 -10
  190. package/src/rules/oas3/remove-unused-components.ts +18 -7
  191. package/src/rules/other/stats.ts +46 -17
  192. package/src/rules/utils.ts +19 -3
  193. package/src/types/index.ts +5 -5
  194. package/src/types/redocly-yaml.ts +8 -7
  195. package/src/typings/common.ts +9 -1
  196. package/src/typings/openapi.ts +1 -1
  197. package/src/utils.ts +31 -8
  198. package/src/visitors.ts +4 -4
  199. package/src/walk.ts +15 -11
  200. package/tsconfig.tsbuildinfo +1 -1
  201. package/lib/rules/common/license-url.d.ts +0 -2
  202. package/lib/rules/common/license-url.js +0 -12
  203. package/src/rules/common/license-url.ts +0 -10
@@ -4,9 +4,16 @@ import { Oas2Components } from '../../typings/swagger';
4
4
  import { isEmptyObject } from '../../utils';
5
5
 
6
6
  export const RemoveUnusedComponents: Oas2Rule = () => {
7
- let components = new Map<string, { used: boolean; componentType?: keyof Oas2Components; name: string }>();
7
+ let components = new Map<
8
+ string,
9
+ { used: boolean; componentType?: keyof Oas2Components; name: string }
10
+ >();
8
11
 
9
- function registerComponent(location: Location, componentType: keyof Oas2Components, name: string): void {
12
+ function registerComponent(
13
+ location: Location,
14
+ componentType: keyof Oas2Components,
15
+ name: string
16
+ ): void {
10
17
  components.set(location.absolutePointer, {
11
18
  used: components.get(location.absolutePointer)?.used || false,
12
19
  componentType,
@@ -17,9 +24,7 @@ export const RemoveUnusedComponents: Oas2Rule = () => {
17
24
  return {
18
25
  ref: {
19
26
  leave(ref, { type, resolve, key }) {
20
- if (
21
- ['Schema', 'Parameter', 'Response', 'SecurityScheme'].includes(type.name)
22
- ) {
27
+ if (['Schema', 'Parameter', 'Response', 'SecurityScheme'].includes(type.name)) {
23
28
  const resolvedRef = resolve(ref);
24
29
  if (!resolvedRef.location) return;
25
30
  components.set(resolvedRef.location.absolutePointer, {
@@ -27,7 +32,7 @@ export const RemoveUnusedComponents: Oas2Rule = () => {
27
32
  name: key.toString(),
28
33
  });
29
34
  }
30
- }
35
+ },
31
36
  },
32
37
  DefinitionRoot: {
33
38
  leave(root, ctx) {
@@ -35,7 +40,7 @@ export const RemoveUnusedComponents: Oas2Rule = () => {
35
40
  data.removedCount = 0;
36
41
 
37
42
  let rootComponents = new Set<keyof Oas2Components>();
38
- components.forEach(usageInfo => {
43
+ components.forEach((usageInfo) => {
39
44
  const { used, name, componentType } = usageInfo;
40
45
  if (!used && componentType) {
41
46
  rootComponents.add(componentType);
@@ -71,6 +76,6 @@ export const RemoveUnusedComponents: Oas2Rule = () => {
71
76
  SecurityScheme(_securityScheme, { location, key }) {
72
77
  registerComponent(location, 'securityDefinitions', key.toString());
73
78
  },
74
- }
79
+ },
75
80
  };
76
81
  };
@@ -16,7 +16,7 @@ describe('oas3 boolean-parameter-prefixes', () => {
16
16
  schema:
17
17
  type: boolean
18
18
  `,
19
- 'foobar.yaml',
19
+ 'foobar.yaml'
20
20
  );
21
21
 
22
22
  const results = await lintDocument({
@@ -68,7 +68,7 @@ describe('oas3 boolean-parameter-prefixes', () => {
68
68
  schema:
69
69
  type: boolean
70
70
  `,
71
- 'foobar.yaml',
71
+ 'foobar.yaml'
72
72
  );
73
73
 
74
74
  const results = await lintDocument({
@@ -92,7 +92,7 @@ describe('oas3 boolean-parameter-prefixes', () => {
92
92
  schema:
93
93
  type: boolean
94
94
  `,
95
- 'foobar.yaml',
95
+ 'foobar.yaml'
96
96
  );
97
97
 
98
98
  const results = await lintDocument({
@@ -14,7 +14,7 @@ describe('Oas3 oas3-no-example-value-and-externalValue', () => {
14
14
  value: 12
15
15
  externalValue: https://1.1.1.1
16
16
  `,
17
- 'foobar.yaml',
17
+ 'foobar.yaml'
18
18
  );
19
19
 
20
20
  const results = await lintDocument({
@@ -51,7 +51,7 @@ describe('Oas3 oas3-no-example-value-and-externalValue', () => {
51
51
  some:
52
52
  value: 12
53
53
  `,
54
- 'foobar.yaml',
54
+ 'foobar.yaml'
55
55
  );
56
56
 
57
57
  const results = await lintDocument({
@@ -27,7 +27,7 @@ describe('no-invalid-media-type-examples', () => {
27
27
  type: number
28
28
 
29
29
  `,
30
- 'foobar.yaml',
30
+ 'foobar.yaml'
31
31
  );
32
32
 
33
33
  const results = await lintDocument({
@@ -76,7 +76,7 @@ describe('no-invalid-media-type-examples', () => {
76
76
  `);
77
77
  });
78
78
 
79
- it('should report on invalid example with disallowAdditionalProperties', async () => {
79
+ it('should report on invalid example with allowAdditionalProperties', async () => {
80
80
  const document = parseYamlToDocument(
81
81
  outdent`
82
82
  openapi: 3.0.0
@@ -100,7 +100,7 @@ describe('no-invalid-media-type-examples', () => {
100
100
  type: number
101
101
 
102
102
  `,
103
- 'foobar.yaml',
103
+ 'foobar.yaml'
104
104
  );
105
105
 
106
106
  const results = await lintDocument({
@@ -109,7 +109,7 @@ describe('no-invalid-media-type-examples', () => {
109
109
  config: await makeConfig({
110
110
  'no-invalid-media-type-examples': {
111
111
  severity: 'error',
112
- disallowAdditionalProperties: true,
112
+ allowAdditionalProperties: false,
113
113
  },
114
114
  }),
115
115
  });
@@ -137,7 +137,7 @@ describe('no-invalid-media-type-examples', () => {
137
137
  `);
138
138
  });
139
139
 
140
- it('should not on invalid example with disallowAdditionalProperties', async () => {
140
+ it('should not on invalid example with allowAdditionalProperties', async () => {
141
141
  const document = parseYamlToDocument(
142
142
  outdent`
143
143
  openapi: 3.0.0
@@ -160,7 +160,7 @@ describe('no-invalid-media-type-examples', () => {
160
160
  type: number
161
161
 
162
162
  `,
163
- 'foobar.yaml',
163
+ 'foobar.yaml'
164
164
  );
165
165
 
166
166
  const results = await lintDocument({
@@ -169,7 +169,7 @@ describe('no-invalid-media-type-examples', () => {
169
169
  config: await makeConfig({
170
170
  'no-invalid-media-type-examples': {
171
171
  severity: 'error',
172
- disallowAdditionalProperties: true,
172
+ allowAdditionalProperties: false,
173
173
  },
174
174
  }),
175
175
  });
@@ -210,7 +210,7 @@ describe('no-invalid-media-type-examples', () => {
210
210
  type: number
211
211
 
212
212
  `,
213
- 'foobar.yaml',
213
+ 'foobar.yaml'
214
214
  );
215
215
 
216
216
  const results = await lintDocument({
@@ -219,7 +219,7 @@ describe('no-invalid-media-type-examples', () => {
219
219
  config: await makeConfig({
220
220
  'no-invalid-media-type-examples': {
221
221
  severity: 'error',
222
- disallowAdditionalProperties: true,
222
+ allowAdditionalProperties: false,
223
223
  },
224
224
  }),
225
225
  });
@@ -263,7 +263,7 @@ describe('no-invalid-media-type-examples', () => {
263
263
  b: 35
264
264
 
265
265
  `,
266
- 'foobar.yaml',
266
+ 'foobar.yaml'
267
267
  );
268
268
 
269
269
  const results = await lintDocument({
@@ -295,7 +295,7 @@ describe('no-invalid-media-type-examples', () => {
295
295
  type: number
296
296
 
297
297
  `,
298
- 'foobar.yaml',
298
+ 'foobar.yaml'
299
299
  );
300
300
 
301
301
  const results = await lintDocument({
@@ -330,7 +330,7 @@ describe('no-invalid-media-type-examples', () => {
330
330
  $ref: '#/components/schemas/C'
331
331
 
332
332
  `,
333
- __dirname + '/foobar.yaml',
333
+ __dirname + '/foobar.yaml'
334
334
  );
335
335
 
336
336
  const results = await lintDocument({
@@ -358,7 +358,7 @@ describe('no-invalid-media-type-examples', () => {
358
358
  nullable: true
359
359
 
360
360
  `,
361
- 'foobar.yaml',
361
+ 'foobar.yaml'
362
362
  );
363
363
 
364
364
  const results = await lintDocument({
@@ -11,7 +11,7 @@ describe('Oas3 oas3-no-server-example.com', () => {
11
11
  servers:
12
12
  - url: example.com
13
13
  `,
14
- 'foobar.yaml',
14
+ 'foobar.yaml'
15
15
  );
16
16
 
17
17
  const results = await lintDocument({
@@ -46,7 +46,7 @@ describe('Oas3 oas3-no-server-example.com', () => {
46
46
  servers:
47
47
  - url: not-example.com
48
48
  `,
49
- 'foobar.yaml',
49
+ 'foobar.yaml'
50
50
  );
51
51
 
52
52
  const results = await lintDocument({
@@ -11,7 +11,7 @@ describe('Oas3 oas3-no-server-trailing-slash', () => {
11
11
  servers:
12
12
  - url: https://somedomain.com/
13
13
  `,
14
- 'foobar.yaml',
14
+ 'foobar.yaml'
15
15
  );
16
16
 
17
17
  const results = await lintDocument({
@@ -46,7 +46,7 @@ describe('Oas3 oas3-no-server-trailing-slash', () => {
46
46
  servers:
47
47
  - url: https://somedomain.com
48
48
  `,
49
- 'foobar.yaml',
49
+ 'foobar.yaml'
50
50
  );
51
51
 
52
52
  const results = await lintDocument({
@@ -65,7 +65,7 @@ describe('Oas3 oas3-no-server-trailing-slash', () => {
65
65
  servers:
66
66
  - url: /
67
67
  `,
68
- 'foobar.yaml',
68
+ 'foobar.yaml'
69
69
  );
70
70
 
71
71
  const results = await lintDocument({
@@ -36,7 +36,7 @@ describe('Oas3 no-unused-components', () => {
36
36
  - 1
37
37
  - 2
38
38
  `,
39
- 'foobar.yaml',
39
+ 'foobar.yaml'
40
40
  );
41
41
 
42
42
  const results = await lintDocument({
@@ -36,6 +36,6 @@ it('should not fail on valid callbacks object', async () => {
36
36
  expect(
37
37
  await validateDoc(source, {
38
38
  spec: 'error',
39
- }),
39
+ })
40
40
  ).toMatchInlineSnapshot(`Array []`);
41
41
  });
@@ -23,7 +23,7 @@ describe('OpenAPI Schema', () => {
23
23
  expect(
24
24
  await validateDoc(source, {
25
25
  spec: 'error',
26
- }),
26
+ })
27
27
  ).toMatchInlineSnapshot(`
28
28
  Array [
29
29
  Object {
@@ -56,7 +56,7 @@ describe('OpenAPI Schema', () => {
56
56
  expect(
57
57
  await validateDoc(source, {
58
58
  spec: 'error',
59
- }),
59
+ })
60
60
  ).toMatchInlineSnapshot(`
61
61
  Array [
62
62
  Object {
@@ -89,7 +89,7 @@ describe('OpenAPI Schema', () => {
89
89
  expect(
90
90
  await validateDoc(source, {
91
91
  spec: 'error',
92
- }),
92
+ })
93
93
  ).toMatchInlineSnapshot(`
94
94
  Array [
95
95
  Object {
@@ -126,7 +126,7 @@ describe('OpenAPI Schema', () => {
126
126
  expect(
127
127
  await validateDoc(source, {
128
128
  spec: 'error',
129
- }),
129
+ })
130
130
  ).toMatchInlineSnapshot(`Array []`);
131
131
  });
132
132
 
@@ -155,7 +155,7 @@ describe('OpenAPI Schema', () => {
155
155
  expect(
156
156
  await validateDoc(source, {
157
157
  spec: 'error',
158
- }),
158
+ })
159
159
  ).toMatchInlineSnapshot(`
160
160
  Array [
161
161
  Object {
@@ -191,7 +191,7 @@ describe('OpenAPI Schema', () => {
191
191
  expect(
192
192
  await validateDoc(source, {
193
193
  spec: 'error',
194
- }),
194
+ })
195
195
  ).toMatchInlineSnapshot(`
196
196
  Array [
197
197
  Object {
@@ -226,7 +226,7 @@ describe('OpenAPI Schema', () => {
226
226
  expect(
227
227
  await validateDoc(source, {
228
228
  spec: 'error',
229
- }),
229
+ })
230
230
  ).toMatchInlineSnapshot(`Array []`);
231
231
  });
232
232
 
@@ -253,7 +253,7 @@ describe('OpenAPI Schema', () => {
253
253
  expect(
254
254
  await validateDoc(source, {
255
255
  spec: 'error',
256
- }),
256
+ })
257
257
  ).toMatchInlineSnapshot(`
258
258
  Array [
259
259
  Object {
@@ -288,7 +288,7 @@ describe('OpenAPI Schema', () => {
288
288
  expect(
289
289
  await validateDoc(source, {
290
290
  spec: 'error',
291
- }),
291
+ })
292
292
  ).toMatchInlineSnapshot(`
293
293
  Array [
294
294
  Object {
@@ -322,7 +322,7 @@ describe('OpenAPI Schema', () => {
322
322
  expect(
323
323
  await validateDoc(source, {
324
324
  spec: 'error',
325
- }),
325
+ })
326
326
  ).toMatchInlineSnapshot(`Array []`);
327
327
  });
328
328
 
@@ -346,7 +346,7 @@ describe('OpenAPI Schema', () => {
346
346
  expect(
347
347
  await validateDoc(source, {
348
348
  spec: 'error',
349
- }),
349
+ })
350
350
  ).toMatchInlineSnapshot(`
351
351
  Array [
352
352
  Object {
@@ -378,7 +378,7 @@ describe('OpenAPI Schema', () => {
378
378
  expect(
379
379
  await validateDoc(source, {
380
380
  spec: 'error',
381
- }),
381
+ })
382
382
  ).toMatchInlineSnapshot(`
383
383
  Array [
384
384
  Object {
@@ -23,7 +23,7 @@ it('should not report if summary field is valid', async () => {
23
23
  expect(
24
24
  await validateDoc(source, {
25
25
  spec: 'error',
26
- }),
26
+ })
27
27
  ).toMatchInlineSnapshot(`Array []`);
28
28
  });
29
29
 
@@ -49,7 +49,7 @@ it('should report if summary field is not string ', async () => {
49
49
  expect(
50
50
  await validateDoc(source, {
51
51
  spec: 'error',
52
- }),
52
+ })
53
53
  ).toMatchInlineSnapshot(`
54
54
  Array [
55
55
  Object {
@@ -82,7 +82,7 @@ it('should not report if description field is valid', async () => {
82
82
  expect(
83
83
  await validateDoc(source, {
84
84
  spec: 'error',
85
- }),
85
+ })
86
86
  ).toMatchInlineSnapshot(`Array []`);
87
87
  });
88
88
 
@@ -108,7 +108,7 @@ it('should report if description field is not string', async () => {
108
108
  expect(
109
109
  await validateDoc(source, {
110
110
  spec: 'error',
111
- }),
111
+ })
112
112
  ).toMatchInlineSnapshot(`
113
113
  Array [
114
114
  Object {
@@ -140,7 +140,7 @@ it('should not report of a valid GET operation object', async () => {
140
140
  expect(
141
141
  await validateDoc(source, {
142
142
  spec: 'error',
143
- }),
143
+ })
144
144
  ).toMatchInlineSnapshot(`Array []`);
145
145
  });
146
146
 
@@ -170,7 +170,7 @@ it('should not report of a valid PUT operation object', async () => {
170
170
  expect(
171
171
  await validateDoc(source, {
172
172
  spec: 'error',
173
- }),
173
+ })
174
174
  ).toMatchInlineSnapshot(`Array []`);
175
175
  });
176
176
 
@@ -208,7 +208,7 @@ it('should not report of a valid Post operation object', async () => {
208
208
  expect(
209
209
  await validateDoc(source, {
210
210
  spec: 'error',
211
- }),
211
+ })
212
212
  ).toMatchInlineSnapshot(`Array []`);
213
213
  });
214
214
 
@@ -248,6 +248,6 @@ it('should not report of a valid delete operation object', async () => {
248
248
  expect(
249
249
  await validateDoc(source, {
250
250
  spec: 'error',
251
- }),
251
+ })
252
252
  ).toMatchInlineSnapshot(`Array []`);
253
253
  });
@@ -23,7 +23,7 @@ describe('OpenAPI Schema', () => {
23
23
  expect(
24
24
  await validateDoc(source, {
25
25
  spec: 'error',
26
- }),
26
+ })
27
27
  ).toMatchInlineSnapshot(`Array []`);
28
28
  });
29
29
 
@@ -43,7 +43,7 @@ describe('OpenAPI Schema', () => {
43
43
  expect(
44
44
  await validateDoc(source, {
45
45
  spec: 'error',
46
- }),
46
+ })
47
47
  ).toMatchInlineSnapshot(`Array []`);
48
48
  });
49
49
 
@@ -61,7 +61,7 @@ describe('OpenAPI Schema', () => {
61
61
  expect(
62
62
  await validateDoc(source, {
63
63
  spec: 'error',
64
- }),
64
+ })
65
65
  ).toMatchInlineSnapshot(`
66
66
  Array [
67
67
  Object {
@@ -88,7 +88,7 @@ describe('OpenAPI Schema', () => {
88
88
  expect(
89
89
  await validateDoc(source, {
90
90
  spec: 'error',
91
- }),
91
+ })
92
92
  ).toMatchInlineSnapshot(`Array []`);
93
93
  });
94
94
 
@@ -114,7 +114,7 @@ describe('OpenAPI Schema', () => {
114
114
  expect(
115
115
  await validateDoc(source, {
116
116
  spec: 'error',
117
- }),
117
+ })
118
118
  ).toMatchInlineSnapshot(`
119
119
  Array [
120
120
  Object {
@@ -151,7 +151,7 @@ describe('OpenAPI Schema', () => {
151
151
  expect(
152
152
  await validateDoc(source, {
153
153
  'no-identical-paths': 'error',
154
- }),
154
+ })
155
155
  ).toMatchInlineSnapshot(`
156
156
  Array [
157
157
  Object {
@@ -188,7 +188,7 @@ describe('OpenAPI Schema', () => {
188
188
  expect(
189
189
  await validateDoc(source, {
190
190
  spec: 'error',
191
- }),
191
+ })
192
192
  ).toMatchInlineSnapshot(`Array []`);
193
193
  });
194
194
 
@@ -218,7 +218,7 @@ describe('OpenAPI Schema', () => {
218
218
  expect(
219
219
  await validateDoc(source, {
220
220
  spec: 'error',
221
- }),
221
+ })
222
222
  ).toMatchInlineSnapshot(`Array []`);
223
223
  });
224
224
 
@@ -239,7 +239,7 @@ describe('OpenAPI Schema', () => {
239
239
  expect(
240
240
  await validateDoc(source, {
241
241
  spec: 'error',
242
- }),
242
+ })
243
243
  ).toMatchInlineSnapshot(`Array []`);
244
244
  });
245
245
 
@@ -278,7 +278,7 @@ describe('OpenAPI Schema', () => {
278
278
  expect(
279
279
  await validateDoc(source, {
280
280
  spec: 'error',
281
- }),
281
+ })
282
282
  ).toMatchInlineSnapshot(`Array []`);
283
283
  });
284
284
  });
@@ -1,9 +1,9 @@
1
1
  import { outdent } from 'outdent';
2
2
  import { parseYamlToDocument, replaceSourceWithRef } from '../../../../../__tests__/utils';
3
3
  import { lintDocument } from '../../../../lint';
4
- import { LintConfig } from '../../../..';
4
+ import { StyleguideConfig } from '../../../..';
5
5
  import { BaseResolver } from '../../../../resolve';
6
- import { resolveLint } from '../../../../config';
6
+ import { resolveStyleguideConfig } from '../../../../config';
7
7
 
8
8
  describe('Referenceable scalars', () => {
9
9
  it('should not report $ref description', async () => {
@@ -17,22 +17,22 @@ describe('Referenceable scalars', () => {
17
17
  $ref: fixtures/description.md
18
18
  paths: {}
19
19
  `,
20
- __dirname + '/foobar.yaml',
20
+ __dirname + '/foobar.yaml'
21
21
  );
22
22
 
23
23
  const results = await lintDocument({
24
24
  externalRefResolver: new BaseResolver(),
25
25
  document,
26
- config: new LintConfig(
27
- await resolveLint({
28
- lintConfig: {
26
+ config: new StyleguideConfig(
27
+ await resolveStyleguideConfig({
28
+ styleguideConfig: {
29
29
  extends: [],
30
30
  rules: {
31
31
  spec: 'error',
32
32
  'no-unresolved-refs': 'error',
33
33
  },
34
34
  },
35
- }),
35
+ })
36
36
  ),
37
37
  });
38
38
  expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`Array []`);
@@ -54,22 +54,22 @@ describe('Referenceable scalars', () => {
54
54
  example:
55
55
  $ref: not $ref, example
56
56
  `,
57
- __dirname + '/foobar.yaml',
57
+ __dirname + '/foobar.yaml'
58
58
  );
59
59
 
60
60
  const results = await lintDocument({
61
61
  externalRefResolver: new BaseResolver(),
62
62
  document,
63
- config: new LintConfig(
64
- await resolveLint({
65
- lintConfig: {
63
+ config: new StyleguideConfig(
64
+ await resolveStyleguideConfig({
65
+ styleguideConfig: {
66
66
  extends: [],
67
67
  rules: {
68
68
  'no-unresolved-refs': 'error',
69
69
  },
70
70
  doNotResolveExamples: true,
71
71
  },
72
- }),
72
+ })
73
73
  ),
74
74
  });
75
75
  expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`Array []`);