@redocly/openapi-core 1.17.0 → 1.18.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 (61) hide show
  1. package/CHANGELOG.md +17 -0
  2. package/lib/bundle.d.ts +1 -1
  3. package/lib/bundle.js +15 -0
  4. package/lib/config/all.js +6 -0
  5. package/lib/config/builtIn.js +10 -2
  6. package/lib/config/config-resolvers.js +15 -4
  7. package/lib/config/config.d.ts +2 -2
  8. package/lib/config/config.js +15 -0
  9. package/lib/config/minimal.js +8 -0
  10. package/lib/config/recommended-strict.js +8 -0
  11. package/lib/config/recommended.js +8 -0
  12. package/lib/config/types.d.ts +10 -4
  13. package/lib/config/utils.js +13 -1
  14. package/lib/decorators/arazzo/index.d.ts +1 -0
  15. package/lib/decorators/arazzo/index.js +4 -0
  16. package/lib/decorators/async2/index.d.ts +1 -0
  17. package/lib/decorators/async2/index.js +4 -0
  18. package/lib/index.d.ts +1 -0
  19. package/lib/index.js +4 -2
  20. package/lib/oas-types.d.ts +13 -8
  21. package/lib/oas-types.js +10 -0
  22. package/lib/rules/arazzo/index.d.ts +3 -0
  23. package/lib/rules/arazzo/index.js +10 -0
  24. package/lib/rules/common/spec.d.ts +2 -2
  25. package/lib/types/arazzo.d.ts +1050 -0
  26. package/lib/types/arazzo.js +381 -0
  27. package/lib/types/oas3.js +0 -8
  28. package/lib/types/oas3_1.js +7 -1
  29. package/lib/types/redocly-yaml.d.ts +5 -5
  30. package/lib/types/redocly-yaml.js +16 -5
  31. package/lib/typings/arazzo.d.ts +3 -0
  32. package/lib/typings/arazzo.js +2 -0
  33. package/lib/visitors.d.ts +11 -0
  34. package/package.json +3 -2
  35. package/src/__tests__/lint.test.ts +124 -0
  36. package/src/bundle.ts +13 -0
  37. package/src/config/__tests__/__snapshots__/config-resolvers.test.ts.snap +20 -0
  38. package/src/config/__tests__/__snapshots__/config.test.ts.snap +3 -0
  39. package/src/config/__tests__/config.test.ts +6 -0
  40. package/src/config/all.ts +6 -0
  41. package/src/config/builtIn.ts +10 -2
  42. package/src/config/config-resolvers.ts +17 -3
  43. package/src/config/config.ts +17 -0
  44. package/src/config/minimal.ts +8 -0
  45. package/src/config/recommended-strict.ts +8 -0
  46. package/src/config/recommended.ts +8 -0
  47. package/src/config/types.ts +15 -2
  48. package/src/config/utils.ts +15 -0
  49. package/src/decorators/arazzo/index.ts +1 -0
  50. package/src/decorators/async2/index.ts +1 -0
  51. package/src/index.ts +1 -0
  52. package/src/oas-types.ts +25 -4
  53. package/src/rules/arazzo/index.ts +11 -0
  54. package/src/rules/common/spec.ts +2 -2
  55. package/src/types/arazzo.ts +386 -0
  56. package/src/types/oas3.ts +0 -7
  57. package/src/types/oas3_1.ts +7 -0
  58. package/src/types/redocly-yaml.ts +19 -8
  59. package/src/typings/arazzo.ts +4 -0
  60. package/src/visitors.ts +18 -0
  61. package/tsconfig.tsbuildinfo +1 -1
@@ -1593,4 +1593,128 @@ describe('lint', () => {
1593
1593
  expect(result[0]).toHaveProperty('ignored', true);
1594
1594
  expect(result[0]).toHaveProperty('ruleId', 'operation-operationId');
1595
1595
  });
1596
+
1597
+ it('should throw an error for dependentRequired not expected here - OAS 3.0.x', async () => {
1598
+ const document = parseYamlToDocument(
1599
+ outdent`
1600
+ openapi: 3.0.3
1601
+ info:
1602
+ title: test json schema validation keyword - dependentRequired
1603
+ version: 1.0.0
1604
+ paths:
1605
+ '/thing':
1606
+ get:
1607
+ summary: a sample api
1608
+ responses:
1609
+ '200':
1610
+ description: OK
1611
+ content:
1612
+ 'application/json':
1613
+ schema:
1614
+ $ref: '#/components/schemas/test_schema'
1615
+ examples:
1616
+ dependentRequired_passing:
1617
+ summary: an example schema
1618
+ value: { "name": "bobby", "age": 25}
1619
+ dependentRequired_failing:
1620
+ summary: an example schema
1621
+ value: { "name": "jennie"}
1622
+ components:
1623
+ schemas:
1624
+ test_schema:
1625
+ type: object
1626
+ properties:
1627
+ name:
1628
+ type: string
1629
+ age:
1630
+ type: number
1631
+ dependentRequired:
1632
+ name:
1633
+ - age
1634
+ `,
1635
+ ''
1636
+ );
1637
+
1638
+ const configFilePath = path.join(__dirname, '..', '..', '..', 'redocly.yaml');
1639
+
1640
+ const results = await lintDocument({
1641
+ externalRefResolver: new BaseResolver(),
1642
+ document,
1643
+ config: await makeConfig({ spec: 'error' }, undefined, configFilePath),
1644
+ });
1645
+
1646
+ expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`
1647
+ [
1648
+ {
1649
+ "from": {
1650
+ "pointer": "#/paths/~1thing/get/responses/200/content/application~1json/schema",
1651
+ "source": "",
1652
+ },
1653
+ "location": [
1654
+ {
1655
+ "pointer": "#/components/schemas/test_schema/dependentRequired",
1656
+ "reportOnKey": true,
1657
+ "source": "",
1658
+ },
1659
+ ],
1660
+ "message": "Property \`dependentRequired\` is not expected here.",
1661
+ "ruleId": "spec",
1662
+ "severity": "error",
1663
+ "suggest": [],
1664
+ },
1665
+ ]
1666
+ `);
1667
+ });
1668
+
1669
+ it('should not throw an error for dependentRequired not expected here - OAS 3.1.x', async () => {
1670
+ const document = parseYamlToDocument(
1671
+ outdent`
1672
+ openapi: 3.1.0
1673
+ info:
1674
+ title: test json schema validation keyword - dependentRequired
1675
+ version: 1.0.0
1676
+ paths:
1677
+ '/thing':
1678
+ get:
1679
+ summary: a sample api
1680
+ responses:
1681
+ '200':
1682
+ description: OK
1683
+ content:
1684
+ 'application/json':
1685
+ schema:
1686
+ $ref: '#/components/schemas/test_schema'
1687
+ examples:
1688
+ dependentRequired_passing:
1689
+ summary: an example schema
1690
+ value: { "name": "bobby", "age": 25}
1691
+ dependentRequired_failing:
1692
+ summary: an example schema
1693
+ value: { "name": "jennie"}
1694
+ components:
1695
+ schemas:
1696
+ test_schema:
1697
+ type: object
1698
+ properties:
1699
+ name:
1700
+ type: string
1701
+ age:
1702
+ type: number
1703
+ dependentRequired:
1704
+ name:
1705
+ - age
1706
+ `,
1707
+ ''
1708
+ );
1709
+
1710
+ const configFilePath = path.join(__dirname, '..', '..', '..', 'redocly.yaml');
1711
+
1712
+ const results = await lintDocument({
1713
+ externalRefResolver: new BaseResolver(),
1714
+ document,
1715
+ config: await makeConfig({ spec: 'error' }, undefined, configFilePath),
1716
+ });
1717
+
1718
+ expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`[]`);
1719
+ });
1596
1720
  });
package/src/bundle.ts CHANGED
@@ -293,6 +293,15 @@ export function mapTypeToComponent(typeName: string, version: SpecMajorVersion)
293
293
  default:
294
294
  return null;
295
295
  }
296
+ case SpecMajorVersion.Arazzo:
297
+ switch (typeName) {
298
+ case 'Root.x-parameters_items':
299
+ case 'Root.workflows_items.parameters_items':
300
+ case 'Root.workflows_items.steps_items.parameters_items':
301
+ return 'parameters';
302
+ default:
303
+ return null;
304
+ }
296
305
  }
297
306
  }
298
307
 
@@ -367,6 +376,10 @@ function makeBundleVisitor(
367
376
  components = root.components = root.components || {};
368
377
  } else if (version === SpecMajorVersion.OAS2) {
369
378
  components = root;
379
+ } else if (version === SpecMajorVersion.Async2) {
380
+ components = root.components = root.components || {};
381
+ } else if (version === SpecMajorVersion.Arazzo) {
382
+ components = root.components = root.components || {};
370
383
  }
371
384
  },
372
385
  },
@@ -2,11 +2,21 @@
2
2
 
3
3
  exports[`resolveConfig should ignore minimal from the root and read local file 1`] = `
4
4
  {
5
+ "arazzoDecorators": {},
6
+ "arazzoPreprocessors": {},
7
+ "arazzoRules": {
8
+ "spec": "error",
9
+ },
5
10
  "async2Decorators": {},
6
11
  "async2Preprocessors": {},
7
12
  "async2Rules": {
8
13
  "channels-kebab-case": "off",
14
+ "info-contact": "off",
9
15
  "no-channel-trailing-slash": "off",
16
+ "operation-operationId": "warn",
17
+ "spec": "error",
18
+ "tag-description": "warn",
19
+ "tags-alphabetical": "off",
10
20
  },
11
21
  "decorators": {},
12
22
  "doNotResolveExamples": undefined,
@@ -109,11 +119,21 @@ exports[`resolveConfig should ignore minimal from the root and read local file 1
109
119
 
110
120
  exports[`resolveStyleguideConfig should resolve extends with local file config which contains path to nested config 1`] = `
111
121
  {
122
+ "arazzoDecorators": {},
123
+ "arazzoPreprocessors": {},
124
+ "arazzoRules": {
125
+ "spec": "error",
126
+ },
112
127
  "async2Decorators": {},
113
128
  "async2Preprocessors": {},
114
129
  "async2Rules": {
115
130
  "channels-kebab-case": "off",
131
+ "info-contact": "off",
116
132
  "no-channel-trailing-slash": "off",
133
+ "operation-operationId": "warn",
134
+ "spec": "error",
135
+ "tag-description": "warn",
136
+ "tags-alphabetical": "off",
117
137
  },
118
138
  "decorators": {},
119
139
  "doNotResolveExamples": undefined,
@@ -6,6 +6,7 @@ StyleguideConfig {
6
6
  "_usedVersions": Set {},
7
7
  "configFile": undefined,
8
8
  "decorators": {
9
+ "arazzo": {},
9
10
  "async2": {
10
11
  "oas2": {},
11
12
  "oas3_0": {},
@@ -44,6 +45,7 @@ StyleguideConfig {
44
45
  "pluginPaths": [],
45
46
  "plugins": [],
46
47
  "preprocessors": {
48
+ "arazzo": {},
47
49
  "async2": {
48
50
  "oas2": {},
49
51
  "oas3_0": {},
@@ -107,6 +109,7 @@ StyleguideConfig {
107
109
  },
108
110
  "recommendedFallback": false,
109
111
  "rules": {
112
+ "arazzo": {},
110
113
  "async2": {
111
114
  "oas2": {
112
115
  "no-empty-servers": "error",
@@ -117,6 +117,7 @@ describe('getMergedConfig', () => {
117
117
  "_usedVersions": Set {},
118
118
  "configFile": "redocly.yaml",
119
119
  "decorators": {
120
+ "arazzo": {},
120
121
  "async2": {},
121
122
  "oas2": {},
122
123
  "oas3_0": {},
@@ -128,6 +129,7 @@ describe('getMergedConfig', () => {
128
129
  "pluginPaths": [],
129
130
  "plugins": [],
130
131
  "preprocessors": {
132
+ "arazzo": {},
131
133
  "async2": {},
132
134
  "oas2": {},
133
135
  "oas3_0": {},
@@ -142,6 +144,7 @@ describe('getMergedConfig', () => {
142
144
  },
143
145
  "recommendedFallback": false,
144
146
  "rules": {
147
+ "arazzo": {},
145
148
  "async2": {
146
149
  "operation-summary": "warn",
147
150
  },
@@ -222,6 +225,7 @@ describe('getMergedConfig', () => {
222
225
  "_usedVersions": Set {},
223
226
  "configFile": "redocly.yaml",
224
227
  "decorators": {
228
+ "arazzo": {},
225
229
  "async2": {},
226
230
  "oas2": {},
227
231
  "oas3_0": {},
@@ -233,6 +237,7 @@ describe('getMergedConfig', () => {
233
237
  "pluginPaths": [],
234
238
  "plugins": [],
235
239
  "preprocessors": {
240
+ "arazzo": {},
236
241
  "async2": {},
237
242
  "oas2": {},
238
243
  "oas3_0": {},
@@ -249,6 +254,7 @@ describe('getMergedConfig', () => {
249
254
  },
250
255
  "recommendedFallback": false,
251
256
  "rules": {
257
+ "arazzo": {},
252
258
  "async2": {
253
259
  "no-empty-servers": "error",
254
260
  "operation-summary": "error",
package/src/config/all.ts CHANGED
@@ -106,9 +106,15 @@ const all: PluginStyleguideConfig<'built-in'> = {
106
106
  'array-parameter-serialization': 'error',
107
107
  },
108
108
  async2Rules: {
109
+ spec: 'error',
110
+ 'info-contact': 'error',
111
+ 'operation-operationId': 'error',
112
+ 'tag-description': 'error',
113
+ 'tags-alphabetical': 'error',
109
114
  'channels-kebab-case': 'error',
110
115
  'no-channel-trailing-slash': 'error',
111
116
  },
117
+ arazzoRules: { spec: 'error' },
112
118
  };
113
119
 
114
120
  export default all;
@@ -5,10 +5,15 @@ import minimal from './minimal';
5
5
  import { rules as oas3Rules } from '../rules/oas3';
6
6
  import { rules as oas2Rules } from '../rules/oas2';
7
7
  import { rules as async2Rules } from '../rules/async2';
8
+ import { rules as arazzoRules } from '../rules/arazzo';
8
9
  import { preprocessors as oas3Preprocessors } from '../rules/oas3';
9
10
  import { preprocessors as oas2Preprocessors } from '../rules/oas2';
11
+ import { preprocessors as async2Preprocessors } from '../rules/async2';
12
+ import { preprocessors as arazzoPreprocessors } from '../rules/arazzo';
10
13
  import { decorators as oas3Decorators } from '../decorators/oas3';
11
14
  import { decorators as oas2Decorators } from '../decorators/oas2';
15
+ import { decorators as async2Decorators } from '../decorators/async2';
16
+ import { decorators as arazzoDecorators } from '../decorators/arazzo';
12
17
 
13
18
  import type { CustomRulesConfig, StyleguideRawConfig, Plugin } from './types';
14
19
 
@@ -28,16 +33,19 @@ export const defaultPlugin: Plugin = {
28
33
  oas3: oas3Rules,
29
34
  oas2: oas2Rules,
30
35
  async2: async2Rules,
36
+ arazzo: arazzoRules,
31
37
  } as CustomRulesConfig,
32
38
  preprocessors: {
33
39
  oas3: oas3Preprocessors,
34
40
  oas2: oas2Preprocessors,
35
- async2: {},
41
+ async2: async2Preprocessors,
42
+ arazzo: arazzoPreprocessors,
36
43
  },
37
44
  decorators: {
38
45
  oas3: oas3Decorators,
39
46
  oas2: oas2Decorators,
40
- async2: {},
47
+ async2: async2Decorators,
48
+ arazzo: arazzoDecorators,
41
49
  },
42
50
  configs: builtInConfigs,
43
51
  };
@@ -180,7 +180,9 @@ export function resolvePlugins(
180
180
 
181
181
  if (pluginModule.rules) {
182
182
  if (!pluginModule.rules.oas3 && !pluginModule.rules.oas2 && !pluginModule.rules.async2) {
183
- throw new Error(`Plugin rules must have \`oas3\`, \`oas2\` or \`async2\` rules "${p}.`);
183
+ throw new Error(
184
+ `Plugin rules must have \`oas3\`, \`oas2\`, \`async2\`, or \`arazzo\` rules "${p}.`
185
+ );
184
186
  }
185
187
  plugin.rules = {};
186
188
  if (pluginModule.rules.oas3) {
@@ -192,12 +194,16 @@ export function resolvePlugins(
192
194
  if (pluginModule.rules.async2) {
193
195
  plugin.rules.async2 = prefixRules(pluginModule.rules.async2, id);
194
196
  }
197
+ if (pluginModule.rules.arazzo) {
198
+ plugin.rules.arazzo = prefixRules(pluginModule.rules.arazzo, id);
199
+ }
195
200
  }
196
201
  if (pluginModule.preprocessors) {
197
202
  if (
198
203
  !pluginModule.preprocessors.oas3 &&
199
204
  !pluginModule.preprocessors.oas2 &&
200
- !pluginModule.preprocessors.async2
205
+ !pluginModule.preprocessors.async2 &&
206
+ !pluginModule.preprocessors.arazzo
201
207
  ) {
202
208
  throw new Error(
203
209
  `Plugin \`preprocessors\` must have \`oas3\`, \`oas2\` or \`async2\` preprocessors "${p}.`
@@ -213,13 +219,17 @@ export function resolvePlugins(
213
219
  if (pluginModule.preprocessors.async2) {
214
220
  plugin.preprocessors.async2 = prefixRules(pluginModule.preprocessors.async2, id);
215
221
  }
222
+ if (pluginModule.preprocessors.arazzo) {
223
+ plugin.preprocessors.arazzo = prefixRules(pluginModule.preprocessors.arazzo, id);
224
+ }
216
225
  }
217
226
 
218
227
  if (pluginModule.decorators) {
219
228
  if (
220
229
  !pluginModule.decorators.oas3 &&
221
230
  !pluginModule.decorators.oas2 &&
222
- !pluginModule.decorators.async2
231
+ !pluginModule.decorators.async2 &&
232
+ !pluginModule.decorators.arazzo
223
233
  ) {
224
234
  throw new Error(
225
235
  `Plugin \`decorators\` must have \`oas3\`, \`oas2\` or \`async2\` decorators "${p}.`
@@ -235,6 +245,9 @@ export function resolvePlugins(
235
245
  if (pluginModule.decorators.async2) {
236
246
  plugin.decorators.async2 = prefixRules(pluginModule.decorators.async2, id);
237
247
  }
248
+ if (pluginModule.decorators.arazzo) {
249
+ plugin.decorators.arazzo = prefixRules(pluginModule.decorators.arazzo, id);
250
+ }
238
251
  }
239
252
 
240
253
  if (pluginModule.assertions) {
@@ -419,6 +432,7 @@ function getMergedRawStyleguideConfig(
419
432
  oas2Rules: { ...rootStyleguideConfig?.oas2Rules, ...apiStyleguideConfig?.oas2Rules },
420
433
  oas3_0Rules: { ...rootStyleguideConfig?.oas3_0Rules, ...apiStyleguideConfig?.oas3_0Rules },
421
434
  oas3_1Rules: { ...rootStyleguideConfig?.oas3_1Rules, ...apiStyleguideConfig?.oas3_1Rules },
435
+ arazzoRules: { ...rootStyleguideConfig?.arazzoRules, ...apiStyleguideConfig?.arazzoRules },
422
436
  preprocessors: {
423
437
  ...rootStyleguideConfig?.preprocessors,
424
438
  ...apiStyleguideConfig?.preprocessors,
@@ -9,6 +9,7 @@ import {
9
9
  Oas2RuleSet,
10
10
  Oas3RuleSet,
11
11
  Async2RuleSet,
12
+ ArazzoRuleSet,
12
13
  } from '../oas-types';
13
14
  import { isBrowser } from '../env';
14
15
 
@@ -71,6 +72,7 @@ export class StyleguideConfig {
71
72
  [SpecVersion.OAS3_0]: { ...rawConfig.rules, ...rawConfig.oas3_0Rules },
72
73
  [SpecVersion.OAS3_1]: { ...rawConfig.rules, ...rawConfig.oas3_1Rules },
73
74
  [SpecVersion.Async2]: { ...rawConfig.rules, ...rawConfig.async2Rules },
75
+ [SpecVersion.Arazzo]: { ...rawConfig.arazzoRules },
74
76
  };
75
77
 
76
78
  this.preprocessors = {
@@ -78,6 +80,7 @@ export class StyleguideConfig {
78
80
  [SpecVersion.OAS3_0]: { ...rawConfig.preprocessors, ...rawConfig.oas3_0Preprocessors },
79
81
  [SpecVersion.OAS3_1]: { ...rawConfig.preprocessors, ...rawConfig.oas3_1Preprocessors },
80
82
  [SpecVersion.Async2]: { ...rawConfig.preprocessors, ...rawConfig.async2Preprocessors },
83
+ [SpecVersion.Arazzo]: { ...rawConfig.arazzoPreprocessors },
81
84
  };
82
85
 
83
86
  this.decorators = {
@@ -85,6 +88,7 @@ export class StyleguideConfig {
85
88
  [SpecVersion.OAS3_0]: { ...rawConfig.decorators, ...rawConfig.oas3_0Decorators },
86
89
  [SpecVersion.OAS3_1]: { ...rawConfig.decorators, ...rawConfig.oas3_1Decorators },
87
90
  [SpecVersion.Async2]: { ...rawConfig.decorators, ...rawConfig.async2Decorators },
91
+ [SpecVersion.Arazzo]: { ...rawConfig.arazzoDecorators },
88
92
  };
89
93
 
90
94
  this.extendPaths = rawConfig.extendPaths || [];
@@ -178,6 +182,10 @@ export class StyleguideConfig {
178
182
  if (!plugin.typeExtension.async2) continue;
179
183
  extendedTypes = plugin.typeExtension.async2(extendedTypes, version);
180
184
  break;
185
+ case SpecVersion.Arazzo:
186
+ if (!plugin.typeExtension.arazzo) continue;
187
+ extendedTypes = plugin.typeExtension.arazzo(extendedTypes, version);
188
+ break;
181
189
  default:
182
190
  throw new Error('Not implemented');
183
191
  }
@@ -277,6 +285,15 @@ export class StyleguideConfig {
277
285
  (p) => p.decorators?.async2 && asyncApiRules.push(p.decorators.async2)
278
286
  );
279
287
  return asyncApiRules;
288
+ case SpecMajorVersion.Arazzo:
289
+ // eslint-disable-next-line no-case-declarations
290
+ const arazzoRules: ArazzoRuleSet[] = []; // default ruleset
291
+ this.plugins.forEach(
292
+ (p) => p.preprocessors?.arazzo && arazzoRules.push(p.preprocessors.arazzo)
293
+ );
294
+ this.plugins.forEach((p) => p.rules?.arazzo && arazzoRules.push(p.rules.arazzo));
295
+ this.plugins.forEach((p) => p.decorators?.arazzo && arazzoRules.push(p.decorators.arazzo));
296
+ return arazzoRules;
280
297
  }
281
298
  }
282
299
 
@@ -88,9 +88,17 @@ const minimal: PluginStyleguideConfig<'built-in'> = {
88
88
  'array-parameter-serialization': 'off',
89
89
  },
90
90
  async2Rules: {
91
+ spec: 'error',
92
+ 'info-contact': 'off',
93
+ 'operation-operationId': 'warn',
94
+ 'tag-description': 'warn',
95
+ 'tags-alphabetical': 'off',
91
96
  'channels-kebab-case': 'off',
92
97
  'no-channel-trailing-slash': 'off',
93
98
  },
99
+ arazzoRules: {
100
+ spec: 'error',
101
+ },
94
102
  };
95
103
 
96
104
  export default minimal;
@@ -88,9 +88,17 @@ const recommendedStrict: PluginStyleguideConfig<'built-in'> = {
88
88
  'array-parameter-serialization': 'off',
89
89
  },
90
90
  async2Rules: {
91
+ spec: 'error',
92
+ 'info-contact': 'off',
93
+ 'operation-operationId': 'error',
94
+ 'tag-description': 'error',
95
+ 'tags-alphabetical': 'off',
91
96
  'channels-kebab-case': 'off',
92
97
  'no-channel-trailing-slash': 'off',
93
98
  },
99
+ arazzoRules: {
100
+ spec: 'error',
101
+ },
94
102
  };
95
103
 
96
104
  export default recommendedStrict;
@@ -88,9 +88,17 @@ const recommended: PluginStyleguideConfig<'built-in'> = {
88
88
  'array-parameter-serialization': 'off',
89
89
  },
90
90
  async2Rules: {
91
+ spec: 'error',
92
+ 'info-contact': 'off',
93
+ 'operation-operationId': 'warn',
94
+ 'tag-description': 'warn',
95
+ 'tags-alphabetical': 'off',
91
96
  'channels-kebab-case': 'off',
92
97
  'no-channel-trailing-slash': 'off',
93
98
  },
99
+ arazzoRules: {
100
+ spec: 'error',
101
+ },
94
102
  };
95
103
 
96
104
  export default recommended;
@@ -11,6 +11,9 @@ import type {
11
11
  Async2PreprocessorsSet,
12
12
  Async2DecoratorsSet,
13
13
  Async2RuleSet,
14
+ ArazzoRuleSet,
15
+ ArazzoPreprocessorsSet,
16
+ ArazzoDecoratorsSet,
14
17
  RuleMap,
15
18
  } from '../oas-types';
16
19
 
@@ -20,9 +23,9 @@ import type { SkipFunctionContext } from '../visitors';
20
23
  import {
21
24
  BuiltInAsync2RuleId,
22
25
  BuiltInCommonOASRuleId,
23
- BuiltInCommonRuleId,
24
26
  BuiltInOAS2RuleId,
25
27
  BuiltInOAS3RuleId,
28
+ BuiltInArazzoRuleId,
26
29
  } from '../types/redocly-yaml';
27
30
 
28
31
  export type RuleSeverity = ProblemSeverity | 'off';
@@ -51,23 +54,26 @@ export type StyleguideRawConfig<T = undefined> = {
51
54
  doNotResolveExamples?: boolean;
52
55
  recommendedFallback?: boolean;
53
56
 
54
- rules?: RuleMap<BuiltInCommonRuleId | BuiltInCommonOASRuleId, RuleConfig, T>;
57
+ rules?: RuleMap<BuiltInCommonOASRuleId, RuleConfig, T>;
55
58
  oas2Rules?: RuleMap<BuiltInOAS2RuleId, RuleConfig, T>;
56
59
  oas3_0Rules?: RuleMap<BuiltInOAS3RuleId, RuleConfig, T>;
57
60
  oas3_1Rules?: RuleMap<BuiltInOAS3RuleId, RuleConfig, T>;
58
61
  async2Rules?: RuleMap<BuiltInAsync2RuleId, RuleConfig, T>;
62
+ arazzoRules?: RuleMap<BuiltInArazzoRuleId, RuleConfig, T>;
59
63
 
60
64
  preprocessors?: Record<string, PreprocessorConfig>;
61
65
  oas2Preprocessors?: Record<string, PreprocessorConfig>;
62
66
  oas3_0Preprocessors?: Record<string, PreprocessorConfig>;
63
67
  oas3_1Preprocessors?: Record<string, PreprocessorConfig>;
64
68
  async2Preprocessors?: Record<string, PreprocessorConfig>;
69
+ arazzoPreprocessors?: Record<string, PreprocessorConfig>;
65
70
 
66
71
  decorators?: Record<string, DecoratorConfig>;
67
72
  oas2Decorators?: Record<string, DecoratorConfig>;
68
73
  oas3_0Decorators?: Record<string, DecoratorConfig>;
69
74
  oas3_1Decorators?: Record<string, DecoratorConfig>;
70
75
  async2Decorators?: Record<string, DecoratorConfig>;
76
+ arazzoDecorators?: Record<string, DecoratorConfig>;
71
77
  };
72
78
 
73
79
  export type ApiStyleguideRawConfig = Omit<StyleguideRawConfig, 'plugins'>;
@@ -84,12 +90,14 @@ export type PreprocessorsConfig = {
84
90
  oas3?: Oas3PreprocessorsSet;
85
91
  oas2?: Oas2PreprocessorsSet;
86
92
  async2?: Async2PreprocessorsSet;
93
+ arazzo?: ArazzoPreprocessorsSet;
87
94
  };
88
95
 
89
96
  export type DecoratorsConfig = {
90
97
  oas3?: Oas3DecoratorsSet;
91
98
  oas2?: Oas2DecoratorsSet;
92
99
  async2?: Async2DecoratorsSet;
100
+ arazzo?: ArazzoDecoratorsSet;
93
101
  };
94
102
 
95
103
  export type TypesExtensionFn = (
@@ -103,6 +111,7 @@ export type CustomRulesConfig = {
103
111
  oas3?: Oas3RuleSet;
104
112
  oas2?: Oas2RuleSet;
105
113
  async2?: Async2RuleSet;
114
+ arazzo?: ArazzoRuleSet;
106
115
  };
107
116
 
108
117
  export type AssertionContext = Partial<UserContext> & SkipFunctionContext & { node: any };
@@ -227,19 +236,23 @@ export type ThemeRawConfig = {
227
236
  mockServer?: Record<string, any>;
228
237
  };
229
238
 
239
+ // TODO: sync types
230
240
  export type RulesFields =
231
241
  | 'rules'
232
242
  | 'oas2Rules'
233
243
  | 'oas3_0Rules'
234
244
  | 'oas3_1Rules'
235
245
  | 'async2Rules'
246
+ | 'arazzoRules'
236
247
  | 'preprocessors'
237
248
  | 'oas2Preprocessors'
238
249
  | 'oas3_0Preprocessors'
239
250
  | 'oas3_1Preprocessors'
240
251
  | 'async2Preprocessors'
252
+ | 'arazzoPreprocessors'
241
253
  | 'decorators'
242
254
  | 'oas2Decorators'
243
255
  | 'oas3_0Decorators'
244
256
  | 'oas3_1Decorators'
257
+ | 'arazzoDecorators'
245
258
  | 'async2Decorators';