@redocly/openapi-core 1.25.15 → 1.26.0

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 (126) hide show
  1. package/CHANGELOG.md +11 -0
  2. package/__tests__/utils.ts +0 -3
  3. package/lib/bundle.js +3 -3
  4. package/lib/config/all.js +130 -48
  5. package/lib/config/builtIn.d.ts +1 -1
  6. package/lib/config/builtIn.js +5 -3
  7. package/lib/config/config-resolvers.js +9 -9
  8. package/lib/config/config.d.ts +2 -2
  9. package/lib/config/config.js +38 -20
  10. package/lib/config/minimal.js +125 -49
  11. package/lib/config/recommended-strict.js +124 -48
  12. package/lib/config/recommended.js +123 -47
  13. package/lib/config/rules.d.ts +2 -2
  14. package/lib/config/spec.d.ts +3 -0
  15. package/lib/config/spec.js +31 -0
  16. package/lib/config/types.d.ts +23 -23
  17. package/lib/config/utils.d.ts +1 -1
  18. package/lib/config/utils.js +33 -23
  19. package/lib/index.d.ts +1 -1
  20. package/lib/index.js +2 -2
  21. package/lib/lint.js +3 -3
  22. package/lib/oas-types.d.ts +11 -11
  23. package/lib/oas-types.js +6 -6
  24. package/lib/rules/arazzo/criteria-unique.d.ts +2 -2
  25. package/lib/rules/arazzo/index.d.ts +2 -2
  26. package/lib/rules/arazzo/index.js +6 -4
  27. package/lib/rules/arazzo/parameters-unique.d.ts +2 -2
  28. package/lib/rules/arazzo/requestBody-replacements-unique.d.ts +2 -2
  29. package/lib/rules/arazzo/sourceDescription-type.d.ts +2 -0
  30. package/lib/rules/arazzo/{source-description-type.js → sourceDescription-type.js} +5 -3
  31. package/lib/rules/arazzo/sourceDescriptions-name-unique.d.ts +2 -2
  32. package/lib/rules/arazzo/sourceDescriptions-not-empty.d.ts +2 -0
  33. package/lib/rules/arazzo/sourceDescriptions-not-empty.js +18 -0
  34. package/lib/rules/arazzo/step-onFailure-unique.d.ts +2 -2
  35. package/lib/rules/arazzo/step-onSuccess-unique.d.ts +2 -2
  36. package/lib/rules/arazzo/stepId-unique.d.ts +2 -2
  37. package/lib/rules/arazzo/workflow-dependsOn.d.ts +2 -2
  38. package/lib/rules/arazzo/workflowId-unique.d.ts +2 -2
  39. package/lib/rules/async2/index.js +5 -2
  40. package/lib/rules/async3/index.js +5 -2
  41. package/lib/rules/common/assertions/index.d.ts +2 -2
  42. package/lib/rules/common/struct.d.ts +2 -0
  43. package/lib/rules/common/{spec.js → struct.js} +3 -3
  44. package/lib/rules/oas2/index.js +5 -2
  45. package/lib/rules/oas3/index.js +5 -2
  46. package/lib/rules/spot/no-actions-type-end.d.ts +2 -2
  47. package/lib/rules/spot/no-criteria-xpath.d.ts +2 -2
  48. package/lib/rules/spot/parameters-not-in-body.d.ts +2 -2
  49. package/lib/rules/spot/version-enum.d.ts +2 -2
  50. package/lib/types/arazzo.d.ts +1 -1
  51. package/lib/types/arazzo.js +3 -16
  52. package/lib/types/redocly-yaml.d.ts +6 -8
  53. package/lib/types/redocly-yaml.js +47 -12
  54. package/lib/typings/arazzo.d.ts +1 -6
  55. package/lib/utils.d.ts +1 -1
  56. package/lib/utils.js +3 -2
  57. package/lib/visitors.d.ts +5 -6
  58. package/package.json +1 -1
  59. package/src/__tests__/lint.test.ts +3 -3
  60. package/src/bundle.ts +3 -3
  61. package/src/config/__tests__/__snapshots__/config-resolvers.test.ts.snap +228 -70
  62. package/src/config/__tests__/__snapshots__/config.test.ts.snap +16 -3
  63. package/src/config/__tests__/config-resolvers.test.ts +14 -2
  64. package/src/config/__tests__/config.test.ts +11 -6
  65. package/src/config/all.ts +130 -48
  66. package/src/config/builtIn.ts +10 -8
  67. package/src/config/config-resolvers.ts +9 -9
  68. package/src/config/config.ts +46 -22
  69. package/src/config/minimal.ts +125 -49
  70. package/src/config/recommended-strict.ts +124 -48
  71. package/src/config/recommended.ts +123 -47
  72. package/src/config/rules.ts +2 -2
  73. package/src/config/spec.ts +32 -0
  74. package/src/config/types.ts +27 -33
  75. package/src/config/utils.ts +38 -26
  76. package/src/index.ts +1 -1
  77. package/src/lint.ts +6 -6
  78. package/src/oas-types.ts +19 -20
  79. package/src/rules/arazzo/__tests__/criteria-unique.test.ts +1 -2
  80. package/src/rules/arazzo/__tests__/no-actions-type-end.test.ts +1 -2
  81. package/src/rules/arazzo/__tests__/no-criteria-xpath.test.ts +1 -2
  82. package/src/rules/arazzo/__tests__/parameters-not-in-body.test.ts +1 -2
  83. package/src/rules/arazzo/__tests__/parameters-unique.test.ts +1 -2
  84. package/src/rules/arazzo/__tests__/requestBody-replacements-unique.test.ts +1 -2
  85. package/src/rules/arazzo/__tests__/source-description-type.test.ts +2 -4
  86. package/src/rules/arazzo/__tests__/sourceDescription-name-unique.test.ts +1 -2
  87. package/src/rules/arazzo/__tests__/sourceDescriptions-not-empty.test.ts +104 -0
  88. package/src/rules/arazzo/__tests__/step-onFailure-unique.test.ts +1 -2
  89. package/src/rules/arazzo/__tests__/step-onSuccess-unique.test.ts +1 -2
  90. package/src/rules/arazzo/__tests__/stepId-unique.test.ts +1 -2
  91. package/src/rules/arazzo/__tests__/version-enum.test.ts +1 -2
  92. package/src/rules/arazzo/__tests__/workflow-dependsOn.test.ts +3 -6
  93. package/src/rules/arazzo/__tests__/workflowId-unique.test.ts +2 -4
  94. package/src/rules/arazzo/criteria-unique.ts +2 -2
  95. package/src/rules/arazzo/index.ts +23 -21
  96. package/src/rules/arazzo/parameters-unique.ts +2 -2
  97. package/src/rules/arazzo/requestBody-replacements-unique.ts +2 -2
  98. package/src/rules/arazzo/{source-description-type.ts → sourceDescription-type.ts} +6 -5
  99. package/src/rules/arazzo/sourceDescriptions-name-unique.ts +2 -2
  100. package/src/rules/arazzo/sourceDescriptions-not-empty.ts +17 -0
  101. package/src/rules/arazzo/step-onFailure-unique.ts +2 -2
  102. package/src/rules/arazzo/step-onSuccess-unique.ts +2 -2
  103. package/src/rules/arazzo/stepId-unique.ts +2 -2
  104. package/src/rules/arazzo/workflow-dependsOn.ts +2 -2
  105. package/src/rules/arazzo/workflowId-unique.ts +2 -2
  106. package/src/rules/async2/index.ts +5 -2
  107. package/src/rules/async3/index.ts +5 -2
  108. package/src/rules/common/__tests__/no-enum-type-mismatch.test.ts +1 -1
  109. package/src/rules/common/__tests__/{spec.test.ts → struct.test.ts} +35 -35
  110. package/src/rules/common/assertions/index.ts +2 -2
  111. package/src/rules/common/{spec.ts → struct.ts} +2 -2
  112. package/src/rules/oas2/index.ts +5 -2
  113. package/src/rules/oas3/__tests__/spec/spec.test.ts +10 -10
  114. package/src/rules/oas3/index.ts +5 -2
  115. package/src/rules/spot/no-actions-type-end.ts +2 -2
  116. package/src/rules/spot/no-criteria-xpath.ts +2 -2
  117. package/src/rules/spot/parameters-not-in-body.ts +2 -2
  118. package/src/rules/spot/version-enum.ts +2 -2
  119. package/src/types/arazzo.ts +2 -14
  120. package/src/types/redocly-yaml.ts +48 -16
  121. package/src/typings/arazzo.ts +1 -10
  122. package/src/utils.ts +4 -2
  123. package/src/visitors.ts +4 -6
  124. package/tsconfig.tsbuildinfo +1 -1
  125. package/lib/rules/arazzo/source-description-type.d.ts +0 -2
  126. package/lib/rules/common/spec.d.ts +0 -2
@@ -1,5 +1,5 @@
1
1
  import { Assertions } from '../common/assertions';
2
- import { Spec } from '../common/spec';
2
+ import { Struct } from '../common/struct';
3
3
  import { InfoContact } from '../common/info-contact';
4
4
  import { InfoLicenseStrict } from '../common/info-license-strict';
5
5
  import { OperationOperationId } from '../common/operation-operationId';
@@ -12,7 +12,10 @@ import type { Async3Rule } from '../../visitors';
12
12
  import type { Async3RuleSet } from '../../oas-types';
13
13
 
14
14
  export const rules: Async3RuleSet<'built-in'> = {
15
- spec: Spec as Async3Rule,
15
+ // eslint-disable-next-line @typescript-eslint/ban-ts-comment
16
+ //@ts-ignore TODO: This is depricated property `spec` and should be removed in the future
17
+ spec: Struct as Async3Rule,
18
+ struct: Struct as Async3Rule,
16
19
  assertions: Assertions as Async3Rule,
17
20
  'info-contact': InfoContact as Async3Rule,
18
21
  'info-license-strict': InfoLicenseStrict as Async3Rule,
@@ -200,7 +200,7 @@ describe('Oas3 typed enum', () => {
200
200
  },
201
201
  ],
202
202
  "message": "Expected type \`Schema\` (object) but got \`null\`",
203
- "ruleId": "spec",
203
+ "ruleId": "struct",
204
204
  "severity": "error",
205
205
  "suggest": [],
206
206
  },
@@ -3,7 +3,7 @@ import { lintDocument } from '../../../lint';
3
3
  import { parseYamlToDocument, replaceSourceWithRef, makeConfig } from '../../../../__tests__/utils';
4
4
  import { BaseResolver } from '../../../resolve';
5
5
 
6
- describe('Oas3 spec', () => {
6
+ describe('Oas3 struct', () => {
7
7
  it('should report missing schema property', async () => {
8
8
  const document = parseYamlToDocument(
9
9
  outdent`
@@ -25,7 +25,7 @@ describe('Oas3 spec', () => {
25
25
  const results = await lintDocument({
26
26
  externalRefResolver: new BaseResolver(),
27
27
  document,
28
- config: await makeConfig({ rules: { spec: 'error' } }),
28
+ config: await makeConfig({ rules: { struct: 'error' } }),
29
29
  });
30
30
 
31
31
  expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`
@@ -40,7 +40,7 @@ describe('Oas3 spec', () => {
40
40
  },
41
41
  ],
42
42
  "message": "The field \`info\` must be present on this level.",
43
- "ruleId": "spec",
43
+ "ruleId": "struct",
44
44
  "severity": "error",
45
45
  "suggest": [],
46
46
  },
@@ -54,7 +54,7 @@ describe('Oas3 spec', () => {
54
54
  },
55
55
  ],
56
56
  "message": "Must contain at least one of the following fields: schema, content.",
57
- "ruleId": "spec",
57
+ "ruleId": "struct",
58
58
  "severity": "error",
59
59
  "suggest": [],
60
60
  },
@@ -85,7 +85,7 @@ describe('Oas3 spec', () => {
85
85
  const results = await lintDocument({
86
86
  externalRefResolver: new BaseResolver(),
87
87
  document,
88
- config: await makeConfig({ rules: { spec: 'error' } }),
88
+ config: await makeConfig({ rules: { struct: 'error' } }),
89
89
  });
90
90
 
91
91
  expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`
@@ -100,7 +100,7 @@ describe('Oas3 spec', () => {
100
100
  },
101
101
  ],
102
102
  "message": "The field \`paths\` must be present on this level.",
103
- "ruleId": "spec",
103
+ "ruleId": "struct",
104
104
  "severity": "error",
105
105
  "suggest": [],
106
106
  },
@@ -114,7 +114,7 @@ describe('Oas3 spec', () => {
114
114
  },
115
115
  ],
116
116
  "message": "The field \`info\` must be present on this level.",
117
- "ruleId": "spec",
117
+ "ruleId": "struct",
118
118
  "severity": "error",
119
119
  "suggest": [],
120
120
  },
@@ -131,7 +131,7 @@ describe('Oas3 spec', () => {
131
131
  },
132
132
  ],
133
133
  "message": "Property \`content\` is not expected here.",
134
- "ruleId": "spec",
134
+ "ruleId": "struct",
135
135
  "severity": "error",
136
136
  "suggest": [],
137
137
  },
@@ -157,7 +157,7 @@ describe('Oas3 spec', () => {
157
157
  const results = await lintDocument({
158
158
  externalRefResolver: new BaseResolver(),
159
159
  document,
160
- config: await makeConfig({ rules: { spec: 'error' } }),
160
+ config: await makeConfig({ rules: { struct: 'error' } }),
161
161
  });
162
162
 
163
163
  expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`
@@ -172,7 +172,7 @@ describe('Oas3 spec', () => {
172
172
  },
173
173
  ],
174
174
  "message": "The field \`paths\` must be present on this level.",
175
- "ruleId": "spec",
175
+ "ruleId": "struct",
176
176
  "severity": "error",
177
177
  "suggest": [],
178
178
  },
@@ -186,7 +186,7 @@ describe('Oas3 spec', () => {
186
186
  },
187
187
  ],
188
188
  "message": "The field \`info\` must be present on this level.",
189
- "ruleId": "spec",
189
+ "ruleId": "struct",
190
190
  "severity": "error",
191
191
  "suggest": [],
192
192
  },
@@ -199,7 +199,7 @@ describe('Oas3 spec', () => {
199
199
  },
200
200
  ],
201
201
  "message": "The \`type\` field must be defined when the \`nullable\` field is used.",
202
- "ruleId": "spec",
202
+ "ruleId": "struct",
203
203
  "severity": "error",
204
204
  "suggest": [],
205
205
  },
@@ -231,7 +231,7 @@ describe('Oas3 spec', () => {
231
231
  const results = await lintDocument({
232
232
  externalRefResolver: new BaseResolver(),
233
233
  document,
234
- config: await makeConfig({ rules: { spec: 'error' } }),
234
+ config: await makeConfig({ rules: { struct: 'error' } }),
235
235
  });
236
236
 
237
237
  expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`
@@ -246,7 +246,7 @@ describe('Oas3 spec', () => {
246
246
  },
247
247
  ],
248
248
  "message": "The field \`paths\` must be present on this level.",
249
- "ruleId": "spec",
249
+ "ruleId": "struct",
250
250
  "severity": "error",
251
251
  "suggest": [],
252
252
  },
@@ -260,7 +260,7 @@ describe('Oas3 spec', () => {
260
260
  },
261
261
  ],
262
262
  "message": "The field \`info\` must be present on this level.",
263
- "ruleId": "spec",
263
+ "ruleId": "struct",
264
264
  "severity": "error",
265
265
  "suggest": [],
266
266
  },
@@ -273,7 +273,7 @@ describe('Oas3 spec', () => {
273
273
  },
274
274
  ],
275
275
  "message": "The \`type\` field must be defined when the \`nullable\` field is used.",
276
- "ruleId": "spec",
276
+ "ruleId": "struct",
277
277
  "severity": "error",
278
278
  "suggest": [],
279
279
  },
@@ -287,7 +287,7 @@ describe('Oas3 spec', () => {
287
287
  },
288
288
  ],
289
289
  "message": "The field \`content\` must be present on this level.",
290
- "ruleId": "spec",
290
+ "ruleId": "struct",
291
291
  "severity": "error",
292
292
  "suggest": [],
293
293
  },
@@ -301,7 +301,7 @@ describe('Oas3 spec', () => {
301
301
  },
302
302
  ],
303
303
  "message": "Property \`TestSchema\` is not expected here.",
304
- "ruleId": "spec",
304
+ "ruleId": "struct",
305
305
  "severity": "error",
306
306
  "suggest": [],
307
307
  },
@@ -322,7 +322,7 @@ describe('Oas3 spec', () => {
322
322
  const results = await lintDocument({
323
323
  externalRefResolver: new BaseResolver(),
324
324
  document,
325
- config: await makeConfig({ rules: { spec: 'error' } }),
325
+ config: await makeConfig({ rules: { struct: 'error' } }),
326
326
  });
327
327
 
328
328
  expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`
@@ -337,7 +337,7 @@ describe('Oas3 spec', () => {
337
337
  },
338
338
  ],
339
339
  "message": "The field \`paths\` must be present on this level.",
340
- "ruleId": "spec",
340
+ "ruleId": "struct",
341
341
  "severity": "error",
342
342
  "suggest": [],
343
343
  },
@@ -351,7 +351,7 @@ describe('Oas3 spec', () => {
351
351
  },
352
352
  ],
353
353
  "message": "The field \`info\` must be present on this level.",
354
- "ruleId": "spec",
354
+ "ruleId": "struct",
355
355
  "severity": "error",
356
356
  "suggest": [],
357
357
  },
@@ -360,7 +360,7 @@ describe('Oas3 spec', () => {
360
360
  });
361
361
  });
362
362
 
363
- describe('Oas3.1 spec', () => {
363
+ describe('Oas3.1 struct', () => {
364
364
  it('should report with "type can be one of the following only"', async () => {
365
365
  const document = parseYamlToDocument(
366
366
  outdent`
@@ -384,7 +384,7 @@ describe('Oas3.1 spec', () => {
384
384
  const results = await lintDocument({
385
385
  externalRefResolver: new BaseResolver(),
386
386
  document,
387
- config: await makeConfig({ rules: { spec: 'error' } }),
387
+ config: await makeConfig({ rules: { struct: 'error' } }),
388
388
  });
389
389
 
390
390
  expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`
@@ -399,7 +399,7 @@ describe('Oas3.1 spec', () => {
399
399
  },
400
400
  ],
401
401
  "message": "\`type\` can be one of the following only: "object", "array", "string", "number", "integer", "boolean", "null".",
402
- "ruleId": "spec",
402
+ "ruleId": "struct",
403
403
  "severity": "error",
404
404
  "suggest": [],
405
405
  },
@@ -432,7 +432,7 @@ describe('Oas3.1 spec', () => {
432
432
  const results = await lintDocument({
433
433
  externalRefResolver: new BaseResolver(),
434
434
  document,
435
- config: await makeConfig({ rules: { spec: 'error' } }),
435
+ config: await makeConfig({ rules: { struct: 'error' } }),
436
436
  });
437
437
 
438
438
  expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`
@@ -447,7 +447,7 @@ describe('Oas3.1 spec', () => {
447
447
  },
448
448
  ],
449
449
  "message": "\`type\` can be one of the following only: "object", "array", "string", "number", "integer", "boolean", "null".",
450
- "ruleId": "spec",
450
+ "ruleId": "struct",
451
451
  "severity": "error",
452
452
  "suggest": [],
453
453
  },
@@ -486,7 +486,7 @@ describe('Oas3.1 spec', () => {
486
486
  const results = await lintDocument({
487
487
  externalRefResolver: new BaseResolver(),
488
488
  document,
489
- config: await makeConfig({ rules: { spec: 'error' } }),
489
+ config: await makeConfig({ rules: { struct: 'error' } }),
490
490
  });
491
491
 
492
492
  expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`
@@ -501,7 +501,7 @@ describe('Oas3.1 spec', () => {
501
501
  },
502
502
  ],
503
503
  "message": "\`type\` can be one of the following only: "object", "array", "string", "number", "integer", "boolean", "null".",
504
- "ruleId": "spec",
504
+ "ruleId": "struct",
505
505
  "severity": "error",
506
506
  "suggest": [
507
507
  "object",
@@ -523,7 +523,7 @@ describe('Oas3.1 spec', () => {
523
523
  },
524
524
  ],
525
525
  "message": "\`type\` can be one of the following only: "object", "array", "string", "number", "integer", "boolean", "null".",
526
- "ruleId": "spec",
526
+ "ruleId": "struct",
527
527
  "severity": "error",
528
528
  "suggest": [
529
529
  "object",
@@ -557,7 +557,7 @@ describe('Oas3.1 spec', () => {
557
557
  const results = await lintDocument({
558
558
  externalRefResolver: new BaseResolver(),
559
559
  document,
560
- config: await makeConfig({ rules: { spec: 'error' } }),
560
+ config: await makeConfig({ rules: { struct: 'error' } }),
561
561
  });
562
562
 
563
563
  expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`
@@ -572,7 +572,7 @@ describe('Oas3.1 spec', () => {
572
572
  },
573
573
  ],
574
574
  "message": "Must contain at least one of the following fields: paths, components, webhooks.",
575
- "ruleId": "spec",
575
+ "ruleId": "struct",
576
576
  "severity": "error",
577
577
  "suggest": [],
578
578
  },
@@ -586,7 +586,7 @@ describe('Oas3.1 spec', () => {
586
586
  },
587
587
  ],
588
588
  "message": "The field \`title\` must be present on this level.",
589
- "ruleId": "spec",
589
+ "ruleId": "struct",
590
590
  "severity": "error",
591
591
  "suggest": [],
592
592
  },
@@ -600,7 +600,7 @@ describe('Oas3.1 spec', () => {
600
600
  },
601
601
  ],
602
602
  "message": "The field \`version\` must be present on this level.",
603
- "ruleId": "spec",
603
+ "ruleId": "struct",
604
604
  "severity": "error",
605
605
  "suggest": [],
606
606
  },
@@ -632,7 +632,7 @@ describe('Oas3.1 spec', () => {
632
632
  const results = await lintDocument({
633
633
  externalRefResolver: new BaseResolver(),
634
634
  document,
635
- config: await makeConfig({ rules: { spec: 'error' } }),
635
+ config: await makeConfig({ rules: { struct: 'error' } }),
636
636
  });
637
637
 
638
638
  expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`
@@ -647,7 +647,7 @@ describe('Oas3.1 spec', () => {
647
647
  },
648
648
  ],
649
649
  "message": "Expected type \`SchemaMap\` (object) but got \`array\`",
650
- "ruleId": "spec",
650
+ "ruleId": "struct",
651
651
  "severity": "error",
652
652
  "suggest": [],
653
653
  },
@@ -3,7 +3,7 @@ import { isString } from '../../../utils';
3
3
 
4
4
  import type { asserts, AssertionFn } from './asserts';
5
5
  import type {
6
- ArazzoVisitor,
6
+ Arazzo1Visitor,
7
7
  Async2Visitor,
8
8
  Async3Visitor,
9
9
  Oas2Visitor,
@@ -35,7 +35,7 @@ export type RawAssertion = AssertionDefinition & {
35
35
  export type Assertion = RawAssertion & { assertionId: string };
36
36
 
37
37
  export const Assertions = (opts: Record<string, Assertion>) => {
38
- const visitors: (Oas2Visitor | Oas3Visitor | Async2Visitor | Async3Visitor | ArazzoVisitor)[] =
38
+ const visitors: (Oas2Visitor | Oas3Visitor | Async2Visitor | Async3Visitor | Arazzo1Visitor)[] =
39
39
  [];
40
40
 
41
41
  // As 'Assertions' has an array of asserts,
@@ -4,9 +4,9 @@ import { isRef } from '../../ref-utils';
4
4
  import { isPlainObject } from '../../utils';
5
5
 
6
6
  import type { UserContext } from '../../walk';
7
- import type { Oas3Rule, Oas2Rule, Async2Rule, Async3Rule, ArazzoRule } from '../../visitors';
7
+ import type { Oas3Rule, Oas2Rule, Async2Rule, Async3Rule, Arazzo1Rule } from '../../visitors';
8
8
 
9
- export const Spec: Oas3Rule | Oas2Rule | Async2Rule | Async3Rule | ArazzoRule = () => {
9
+ export const Struct: Oas3Rule | Oas2Rule | Async2Rule | Async3Rule | Arazzo1Rule = () => {
10
10
  return {
11
11
  any(
12
12
  node: any,
@@ -1,4 +1,4 @@
1
- import { Spec } from '../common/spec';
1
+ import { Struct } from '../common/struct';
2
2
  import { NoInvalidSchemaExamples } from '../common/no-invalid-schema-examples';
3
3
  import { NoInvalidParameterExamples } from '../common/no-invalid-parameter-examples';
4
4
  import { InfoContact } from '../common/info-contact';
@@ -47,7 +47,10 @@ import type { Oas2Rule } from '../../visitors';
47
47
  import type { Oas2RuleSet } from '../../oas-types';
48
48
 
49
49
  export const rules: Oas2RuleSet<'built-in'> = {
50
- spec: Spec as Oas2Rule,
50
+ // eslint-disable-next-line @typescript-eslint/ban-ts-comment
51
+ //@ts-ignore TODO: This is depricated property `spec` and should be removed in the future
52
+ spec: Struct as Oas2Rule,
53
+ struct: Struct as Oas2Rule,
51
54
  'no-invalid-schema-examples': NoInvalidSchemaExamples,
52
55
  'no-invalid-parameter-examples': NoInvalidParameterExamples,
53
56
  'info-contact': InfoContact as Oas2Rule,
@@ -65,7 +65,7 @@ describe('Oas3 Structural visitor basic', () => {
65
65
  },
66
66
  ],
67
67
  "message": "Expected type \`string\` but got \`array\`.",
68
- "ruleId": "spec",
68
+ "ruleId": "struct",
69
69
  "severity": "error",
70
70
  "suggest": [],
71
71
  },
@@ -79,7 +79,7 @@ describe('Oas3 Structural visitor basic', () => {
79
79
  },
80
80
  ],
81
81
  "message": "Expected type \`string\` but got \`boolean\`.",
82
- "ruleId": "spec",
82
+ "ruleId": "struct",
83
83
  "severity": "error",
84
84
  "suggest": [],
85
85
  },
@@ -93,7 +93,7 @@ describe('Oas3 Structural visitor basic', () => {
93
93
  },
94
94
  ],
95
95
  "message": "Expected type \`License\` (object) but got \`string\`",
96
- "ruleId": "spec",
96
+ "ruleId": "struct",
97
97
  "severity": "error",
98
98
  "suggest": [],
99
99
  },
@@ -124,7 +124,7 @@ describe('Oas3 Structural visitor basic', () => {
124
124
  },
125
125
  ],
126
126
  "message": "Expected type \`string\` but got \`integer\`.",
127
- "ruleId": "spec",
127
+ "ruleId": "struct",
128
128
  "severity": "error",
129
129
  "suggest": [],
130
130
  },
@@ -138,7 +138,7 @@ describe('Oas3 Structural visitor basic', () => {
138
138
  },
139
139
  ],
140
140
  "message": "Expected type \`Tag\` (object) but got \`number\`",
141
- "ruleId": "spec",
141
+ "ruleId": "struct",
142
142
  "severity": "error",
143
143
  "suggest": [],
144
144
  },
@@ -152,7 +152,7 @@ describe('Oas3 Structural visitor basic', () => {
152
152
  },
153
153
  ],
154
154
  "message": "Expected type \`Tag\` (object) but got \`string\`",
155
- "ruleId": "spec",
155
+ "ruleId": "struct",
156
156
  "severity": "error",
157
157
  "suggest": [],
158
158
  },
@@ -199,7 +199,7 @@ describe('Oas3 Structural visitor basic', () => {
199
199
  },
200
200
  ],
201
201
  "message": "Property \`components1\` is not expected here.",
202
- "ruleId": "spec",
202
+ "ruleId": "struct",
203
203
  "severity": "error",
204
204
  "suggest": [
205
205
  "components",
@@ -228,7 +228,7 @@ describe('Oas3 Structural visitor basic', () => {
228
228
  },
229
229
  ],
230
230
  "message": "Property \`test\` is not expected here.",
231
- "ruleId": "spec",
231
+ "ruleId": "struct",
232
232
  "severity": "error",
233
233
  "suggest": [],
234
234
  },
@@ -270,7 +270,7 @@ describe('Oas3 Structural visitor basic', () => {
270
270
  },
271
271
  ],
272
272
  "message": "The field \`paths\` must be present on this level.",
273
- "ruleId": "spec",
273
+ "ruleId": "struct",
274
274
  "severity": "error",
275
275
  "suggest": [],
276
276
  },
@@ -297,7 +297,7 @@ describe('Oas3 Structural visitor basic', () => {
297
297
  },
298
298
  ],
299
299
  "message": "The field \`title\` must be present on this level.",
300
- "ruleId": "spec",
300
+ "ruleId": "struct",
301
301
  "severity": "error",
302
302
  "suggest": [],
303
303
  },
@@ -1,4 +1,4 @@
1
- import { Spec } from '../common/spec';
1
+ import { Struct } from '../common/struct';
2
2
  import { Operation2xxResponse } from '../common/operation-2xx-response';
3
3
  import { Operation4xxResponse } from '../common/operation-4xx-response';
4
4
  import { Assertions } from '../common/assertions';
@@ -59,7 +59,10 @@ import type { Oas3RuleSet } from '../../oas-types';
59
59
  import type { Oas3Rule } from '../../visitors';
60
60
 
61
61
  export const rules: Oas3RuleSet<'built-in'> = {
62
- spec: Spec as Oas3Rule,
62
+ // eslint-disable-next-line @typescript-eslint/ban-ts-comment
63
+ //@ts-ignore TODO: This is depricated property `spec` and should be removed in the future
64
+ spec: Struct as Oas3Rule,
65
+ struct: Struct as Oas3Rule,
63
66
  'info-contact': InfoContact as Oas3Rule,
64
67
  'info-license': InfoLicense as Oas3Rule,
65
68
  'info-license-url': InfoLicenseUrl as Oas3Rule,
@@ -1,7 +1,7 @@
1
- import type { ArazzoRule } from '../../visitors';
1
+ import type { Arazzo1Rule } from '../../visitors';
2
2
  import type { UserContext } from '../../walk';
3
3
 
4
- export const NoActionsTypeEnd: ArazzoRule = () => {
4
+ export const NoActionsTypeEnd: Arazzo1Rule = () => {
5
5
  return {
6
6
  FailureActionObject: {
7
7
  enter(action, { report, location }: UserContext) {
@@ -1,7 +1,7 @@
1
- import type { ArazzoRule } from '../../visitors';
1
+ import type { Arazzo1Rule } from '../../visitors';
2
2
  import type { UserContext } from '../../walk';
3
3
 
4
- export const NoCriteriaXpath: ArazzoRule = () => {
4
+ export const NoCriteriaXpath: Arazzo1Rule = () => {
5
5
  return {
6
6
  CriterionObject: {
7
7
  enter(criteria, { report, location }: UserContext) {
@@ -1,7 +1,7 @@
1
- import type { ArazzoRule } from '../../visitors';
1
+ import type { Arazzo1Rule } from '../../visitors';
2
2
  import type { UserContext } from '../../walk';
3
3
 
4
- export const ParametersNotInBody: ArazzoRule = () => {
4
+ export const ParametersNotInBody: Arazzo1Rule = () => {
5
5
  return {
6
6
  Parameter: {
7
7
  enter(parameter, { report, location }: UserContext) {
@@ -1,10 +1,10 @@
1
1
  import { ARAZZO_VERSIONS_SUPPORTED_BY_SPOT } from '../../typings/arazzo';
2
2
  import { pluralize } from '../../utils';
3
3
 
4
- import type { ArazzoRule } from '../../visitors';
4
+ import type { Arazzo1Rule } from '../../visitors';
5
5
  import type { UserContext } from '../../walk';
6
6
 
7
- export const VersionEnum: ArazzoRule = () => {
7
+ export const VersionEnum: Arazzo1Rule = () => {
8
8
  const supportedVersions = ARAZZO_VERSIONS_SUPPORTED_BY_SPOT.join(', ');
9
9
  return {
10
10
  Root: {
@@ -50,10 +50,8 @@ const SourceDescriptions: NodeType = {
50
50
  items: (value: any) => {
51
51
  if (value?.type === 'openapi') {
52
52
  return 'OpenAPISourceDescription';
53
- } else if (value?.type === 'arazzo') {
54
- return 'ArazzoSourceDescription';
55
53
  } else {
56
- return 'NoneSourceDescription';
54
+ return 'ArazzoSourceDescription';
57
55
  }
58
56
  },
59
57
  };
@@ -67,15 +65,6 @@ const OpenAPISourceDescription: NodeType = {
67
65
  required: ['name', 'type', 'url'],
68
66
  extensionsPrefix: 'x-',
69
67
  };
70
- const NoneSourceDescription: NodeType = {
71
- properties: {
72
- name: { type: 'string' },
73
- type: { type: 'string', enum: ['none'] },
74
- 'x-serverUrl': { type: 'string' },
75
- },
76
- required: ['name', 'type', 'x-serverUrl'],
77
- extensionsPrefix: 'x-',
78
- };
79
68
  const ArazzoSourceDescription: NodeType = {
80
69
  properties: {
81
70
  name: { type: 'string' },
@@ -273,12 +262,11 @@ const OnFailureActionList: NodeType = {
273
262
  },
274
263
  };
275
264
 
276
- export const ArazzoTypes: Record<string, NodeType> = {
265
+ export const Arazzo1Types: Record<string, NodeType> = {
277
266
  Root,
278
267
  Info,
279
268
  SourceDescriptions,
280
269
  OpenAPISourceDescription,
281
- NoneSourceDescription,
282
270
  ArazzoSourceDescription,
283
271
  Parameters,
284
272
  Parameter,