@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
@@ -56,18 +56,21 @@ function extractFlatConfig<
56
56
  oas3_0Rules,
57
57
  oas3_1Rules,
58
58
  async2Rules,
59
+ arazzoRules,
59
60
 
60
61
  preprocessors,
61
62
  oas2Preprocessors,
62
63
  oas3_0Preprocessors,
63
64
  oas3_1Preprocessors,
64
65
  async2Preprocessors,
66
+ arazzoPreprocessors,
65
67
 
66
68
  decorators,
67
69
  oas2Decorators,
68
70
  oas3_0Decorators,
69
71
  oas3_1Decorators,
70
72
  async2Decorators,
73
+ arazzoDecorators,
71
74
 
72
75
  ...rawConfigRest
73
76
  }: T): {
@@ -83,18 +86,21 @@ function extractFlatConfig<
83
86
  oas3_0Rules,
84
87
  oas3_1Rules,
85
88
  async2Rules,
89
+ arazzoRules,
86
90
 
87
91
  preprocessors,
88
92
  oas2Preprocessors,
89
93
  oas3_0Preprocessors,
90
94
  oas3_1Preprocessors,
91
95
  async2Preprocessors,
96
+ arazzoPreprocessors,
92
97
 
93
98
  decorators,
94
99
  oas2Decorators,
95
100
  oas3_0Decorators,
96
101
  oas3_1Decorators,
97
102
  async2Decorators,
103
+ arazzoDecorators,
98
104
 
99
105
  doNotResolveExamples: rawConfigRest.resolve?.doNotResolveExamples,
100
106
  };
@@ -152,18 +158,21 @@ export function mergeExtends(rulesConfList: ResolvedStyleguideConfig[]) {
152
158
  oas3_0Rules: {},
153
159
  oas3_1Rules: {},
154
160
  async2Rules: {},
161
+ arazzoRules: {},
155
162
 
156
163
  preprocessors: {},
157
164
  oas2Preprocessors: {},
158
165
  oas3_0Preprocessors: {},
159
166
  oas3_1Preprocessors: {},
160
167
  async2Preprocessors: {},
168
+ arazzoPreprocessors: {},
161
169
 
162
170
  decorators: {},
163
171
  oas2Decorators: {},
164
172
  oas3_0Decorators: {},
165
173
  oas3_1Decorators: {},
166
174
  async2Decorators: {},
175
+ arazzoDecorators: {},
167
176
 
168
177
  plugins: [],
169
178
  pluginPaths: [],
@@ -186,6 +195,8 @@ export function mergeExtends(rulesConfList: ResolvedStyleguideConfig[]) {
186
195
  assignExisting(result.oas3_1Rules, rulesConf.rules || {});
187
196
  Object.assign(result.async2Rules, rulesConf.async2Rules);
188
197
  assignExisting(result.async2Rules, rulesConf.rules || {});
198
+ Object.assign(result.arazzoRules, rulesConf.arazzoRules);
199
+ assignExisting(result.arazzoRules, rulesConf.rules || {});
189
200
 
190
201
  Object.assign(result.preprocessors, rulesConf.preprocessors);
191
202
  Object.assign(result.oas2Preprocessors, rulesConf.oas2Preprocessors);
@@ -196,6 +207,8 @@ export function mergeExtends(rulesConfList: ResolvedStyleguideConfig[]) {
196
207
  assignExisting(result.oas3_1Preprocessors, rulesConf.preprocessors || {});
197
208
  Object.assign(result.async2Preprocessors, rulesConf.async2Preprocessors);
198
209
  assignExisting(result.async2Preprocessors, rulesConf.preprocessors || {});
210
+ Object.assign(result.arazzoPreprocessors, rulesConf.arazzoPreprocessors);
211
+ assignExisting(result.arazzoPreprocessors, rulesConf.preprocessors || {});
199
212
 
200
213
  Object.assign(result.decorators, rulesConf.decorators);
201
214
  Object.assign(result.oas2Decorators, rulesConf.oas2Decorators);
@@ -206,6 +219,8 @@ export function mergeExtends(rulesConfList: ResolvedStyleguideConfig[]) {
206
219
  assignExisting(result.oas3_1Decorators, rulesConf.decorators || {});
207
220
  Object.assign(result.async2Decorators, rulesConf.async2Decorators);
208
221
  assignExisting(result.async2Decorators, rulesConf.decorators || {});
222
+ Object.assign(result.arazzoDecorators, rulesConf.arazzoDecorators);
223
+ assignExisting(result.arazzoDecorators, rulesConf.decorators || {});
209
224
 
210
225
  result.plugins!.push(...(rulesConf.plugins || []));
211
226
  result.pluginPaths!.push(...(rulesConf.pluginPaths || []));
@@ -0,0 +1 @@
1
+ export const decorators = {};
@@ -0,0 +1 @@
1
+ export const decorators = {};
package/src/index.ts CHANGED
@@ -8,6 +8,7 @@ export {
8
8
  pause,
9
9
  } from './utils';
10
10
  export { Oas3_1Types } from './types/oas3_1';
11
+ export { ArazzoTypes } from './types/arazzo';
11
12
  export { Oas3Types } from './types/oas3';
12
13
  export { Oas2Types } from './types/oas2';
13
14
  export { AsyncApi2Types } from './types/asyncapi';
package/src/oas-types.ts CHANGED
@@ -5,15 +5,18 @@ import {
5
5
  Oas2Preprocessor,
6
6
  Async2Preprocessor,
7
7
  Async2Rule,
8
+ ArazzoPreprocessor,
9
+ ArazzoRule,
8
10
  } from './visitors';
9
11
  import { Oas2Types } from './types/oas2';
10
12
  import { Oas3Types } from './types/oas3';
11
13
  import { Oas3_1Types } from './types/oas3_1';
12
14
  import { AsyncApi2Types } from './types/asyncapi';
15
+ import { ArazzoTypes } from './types/arazzo';
13
16
  import {
14
17
  BuiltInAsync2RuleId,
15
18
  BuiltInCommonOASRuleId,
16
- BuiltInCommonRuleId,
19
+ BuiltInArazzoRuleId,
17
20
  BuiltInOAS2RuleId,
18
21
  BuiltInOAS3RuleId,
19
22
  } from './types/redocly-yaml';
@@ -25,12 +28,14 @@ export enum SpecVersion {
25
28
  OAS3_0 = 'oas3_0',
26
29
  OAS3_1 = 'oas3_1',
27
30
  Async2 = 'async2', // todo split into 2.x maybe?
31
+ Arazzo = 'arazzo',
28
32
  }
29
33
 
30
34
  export enum SpecMajorVersion {
31
35
  OAS2 = 'oas2',
32
36
  OAS3 = 'oas3',
33
37
  Async2 = 'async2',
38
+ Arazzo = 'arazzo',
34
39
  }
35
40
 
36
41
  const typesMap = {
@@ -38,6 +43,7 @@ const typesMap = {
38
43
  [SpecVersion.OAS3_0]: Oas3Types,
39
44
  [SpecVersion.OAS3_1]: Oas3_1Types,
40
45
  [SpecVersion.Async2]: AsyncApi2Types,
46
+ [SpecVersion.Arazzo]: ArazzoTypes,
41
47
  };
42
48
 
43
49
  export type RuleMap<Key extends string, RuleConfig, T> = Record<
@@ -45,26 +51,35 @@ export type RuleMap<Key extends string, RuleConfig, T> = Record<
45
51
  RuleConfig
46
52
  >;
47
53
  export type Oas3RuleSet<T = undefined> = RuleMap<
48
- BuiltInCommonRuleId | BuiltInCommonOASRuleId | BuiltInOAS3RuleId | 'assertions',
54
+ BuiltInCommonOASRuleId | BuiltInOAS3RuleId | 'assertions',
49
55
  Oas3Rule,
50
56
  T
51
57
  >;
52
58
  export type Oas2RuleSet<T = undefined> = RuleMap<
53
- BuiltInCommonRuleId | BuiltInCommonOASRuleId | BuiltInOAS2RuleId | 'assertions',
59
+ BuiltInCommonOASRuleId | BuiltInOAS2RuleId | 'assertions',
54
60
  Oas2Rule,
55
61
  T
56
62
  >;
57
63
  export type Async2RuleSet<T = undefined> = RuleMap<
58
- BuiltInCommonRuleId | BuiltInAsync2RuleId | 'assertions',
64
+ BuiltInAsync2RuleId | 'assertions',
59
65
  Async2Rule,
60
66
  T
61
67
  >;
68
+ export type ArazzoRuleSet<T = undefined> = RuleMap<
69
+ BuiltInArazzoRuleId | 'assertions',
70
+ ArazzoRule,
71
+ T
72
+ >;
73
+
62
74
  export type Oas3PreprocessorsSet = Record<string, Oas3Preprocessor>;
63
75
  export type Oas2PreprocessorsSet = Record<string, Oas2Preprocessor>;
64
76
  export type Async2PreprocessorsSet = Record<string, Async2Preprocessor>;
77
+ export type ArazzoPreprocessorsSet = Record<string, ArazzoPreprocessor>;
78
+
65
79
  export type Oas3DecoratorsSet = Record<string, Oas3Preprocessor>;
66
80
  export type Oas2DecoratorsSet = Record<string, Oas2Preprocessor>;
67
81
  export type Async2DecoratorsSet = Record<string, Async2Preprocessor>;
82
+ export type ArazzoDecoratorsSet = Record<string, ArazzoPreprocessor>;
68
83
 
69
84
  export function detectSpec(root: any): SpecVersion {
70
85
  if (typeof root !== 'object') {
@@ -100,6 +115,10 @@ export function detectSpec(root: any): SpecVersion {
100
115
  throw new Error(`Unsupported AsyncAPI version: ${root.asyncapi}`);
101
116
  }
102
117
 
118
+ if (root.arazzo && root.arazzo.startsWith('1.')) {
119
+ return SpecVersion.Arazzo;
120
+ }
121
+
103
122
  throw new Error(`Unsupported specification`);
104
123
  }
105
124
 
@@ -108,6 +127,8 @@ export function getMajorSpecVersion(version: SpecVersion): SpecMajorVersion {
108
127
  return SpecMajorVersion.OAS2;
109
128
  } else if (version === SpecVersion.Async2) {
110
129
  return SpecMajorVersion.Async2;
130
+ } else if (version === SpecVersion.Arazzo) {
131
+ return SpecMajorVersion.Arazzo;
111
132
  } else {
112
133
  return SpecMajorVersion.OAS3;
113
134
  }
@@ -0,0 +1,11 @@
1
+ import { ArazzoRule } from '../../visitors';
2
+ import { Spec } from '../common/spec';
3
+ import type { ArazzoRuleSet } from '../../oas-types';
4
+ import { Assertions } from '../common/assertions';
5
+
6
+ export const rules: ArazzoRuleSet<'built-in'> = {
7
+ spec: Spec as ArazzoRule,
8
+ assertions: Assertions,
9
+ };
10
+
11
+ export const preprocessors = {};
@@ -1,11 +1,11 @@
1
- import type { Oas3Rule, Oas2Rule, Async2Rule } from '../../visitors';
1
+ import type { Oas3Rule, Oas2Rule, Async2Rule, ArazzoRule } from '../../visitors';
2
2
  import { isNamedType, SpecExtension } from '../../types';
3
3
  import { oasTypeOf, matchesJsonSchemaType, getSuggest, validateSchemaEnumType } from '../utils';
4
4
  import { isRef } from '../../ref-utils';
5
5
  import { isPlainObject } from '../../utils';
6
6
  import { UserContext } from '../../walk';
7
7
 
8
- export const Spec: Oas3Rule | Oas2Rule | Async2Rule = () => {
8
+ export const Spec: Oas3Rule | Oas2Rule | Async2Rule | ArazzoRule = () => {
9
9
  return {
10
10
  any(
11
11
  node: any,
@@ -0,0 +1,386 @@
1
+ import type { NodeType } from '.';
2
+
3
+ import { getNodeTypesFromJSONSchema } from './json-schema-adapter';
4
+
5
+ export const ARAZZO_ROOT_TYPE = 'Root';
6
+
7
+ const operationMethod = {
8
+ type: 'string',
9
+ enum: ['get', 'post', 'put', 'delete', 'patch'],
10
+ } as const;
11
+ const expectSchema = {
12
+ type: 'object',
13
+ properties: {
14
+ statusCode: { type: 'number' },
15
+ mimeType: { type: 'string' },
16
+ body: {},
17
+ schema: {
18
+ type: 'object',
19
+ additionalProperties: true,
20
+ },
21
+ },
22
+ additionalProperties: false,
23
+ oneOf: [
24
+ { required: ['statusCode'] },
25
+ { required: ['mimeType'] },
26
+ { required: ['body'] },
27
+ { required: ['schema'] },
28
+ ],
29
+ } as const;
30
+ const openAPISourceDescriptionSchema = {
31
+ type: 'object',
32
+ properties: {
33
+ name: { type: 'string' },
34
+ type: { type: 'string', enum: ['openapi'] },
35
+ url: { type: 'string' },
36
+ 'x-serverUrl': { type: 'string' },
37
+ },
38
+ additionalProperties: false,
39
+ required: ['name', 'type', 'url'],
40
+ } as const;
41
+ const noneSourceDescriptionSchema = {
42
+ type: 'object',
43
+ properties: {
44
+ name: { type: 'string' },
45
+ type: { type: 'string', enum: ['none'] },
46
+ 'x-serverUrl': { type: 'string' },
47
+ },
48
+ additionalProperties: false,
49
+ required: ['name', 'type', 'x-serverUrl'],
50
+ } as const;
51
+ const arazzoSourceDescriptionSchema = {
52
+ type: 'object',
53
+ properties: {
54
+ name: { type: 'string' },
55
+ type: { type: 'string', enum: ['arazzo'] },
56
+ url: { type: 'string' },
57
+ },
58
+ additionalProperties: false,
59
+ required: ['name', 'type', 'url'],
60
+ } as const;
61
+ const sourceDescriptionSchema = {
62
+ type: 'object',
63
+ oneOf: [
64
+ openAPISourceDescriptionSchema,
65
+ noneSourceDescriptionSchema,
66
+ arazzoSourceDescriptionSchema,
67
+ ],
68
+ } as const;
69
+ const sourceDescriptionsSchema = {
70
+ type: 'array',
71
+ items: sourceDescriptionSchema,
72
+ } as const;
73
+ const extendedOperation = {
74
+ type: 'object',
75
+ properties: {
76
+ path: { type: 'string' },
77
+ method: operationMethod,
78
+ sourceDescriptionName: { type: 'string' },
79
+ serverUrl: { type: 'string' },
80
+ },
81
+ additionalProperties: false,
82
+ required: ['path', 'method'],
83
+ } as const;
84
+ const parameter = {
85
+ type: 'object',
86
+ oneOf: [
87
+ {
88
+ type: 'object',
89
+ properties: {
90
+ in: { type: 'string', enum: ['header', 'query', 'path', 'cookie', 'body'] },
91
+ name: { type: 'string' },
92
+ value: {
93
+ oneOf: [{ type: 'string' }, { type: 'number' }, { type: 'boolean' }],
94
+ },
95
+ },
96
+ required: ['name', 'value'],
97
+ additionalProperties: false,
98
+ },
99
+ {
100
+ type: 'object',
101
+ properties: {
102
+ $ref: { type: 'string' },
103
+ value: {
104
+ oneOf: [{ type: 'string' }, { type: 'number' }, { type: 'boolean' }],
105
+ },
106
+ },
107
+ required: ['$ref'],
108
+ additionalProperties: false,
109
+ },
110
+ {
111
+ type: 'object',
112
+ properties: {
113
+ reference: { type: 'string' },
114
+ value: {
115
+ oneOf: [{ type: 'string' }, { type: 'number' }, { type: 'boolean' }],
116
+ },
117
+ },
118
+ required: ['reference'],
119
+ additionalProperties: false,
120
+ },
121
+ ],
122
+ } as const;
123
+ const parameters = {
124
+ type: 'array',
125
+ items: parameter,
126
+ } as const;
127
+ const infoObject = {
128
+ type: 'object',
129
+ properties: {
130
+ title: { type: 'string' },
131
+ description: { type: 'string' },
132
+ summary: { type: 'string' },
133
+ version: { type: 'string' },
134
+ },
135
+ additionalProperties: false,
136
+ required: ['title', 'version'],
137
+ } as const;
138
+ const replacement = {
139
+ type: 'object',
140
+ properties: {
141
+ target: { type: 'string' },
142
+ value: {
143
+ oneOf: [
144
+ { type: 'string' },
145
+ { type: 'object' },
146
+ { type: 'array' },
147
+ { type: 'number' },
148
+ { type: 'boolean' },
149
+ ],
150
+ },
151
+ },
152
+ } as const;
153
+ const requestBody = {
154
+ type: 'object',
155
+ properties: {
156
+ contentType: { type: 'string' },
157
+ payload: {
158
+ oneOf: [
159
+ { type: 'string' },
160
+ { type: 'object', additionalProperties: true },
161
+ { type: 'array' },
162
+ { type: 'number' },
163
+ { type: 'boolean' },
164
+ ],
165
+ },
166
+ encoding: { type: 'string' },
167
+ replacements: {
168
+ type: 'array',
169
+ items: replacement,
170
+ },
171
+ },
172
+ additionalProperties: false,
173
+ required: ['payload'],
174
+ } as const;
175
+ const criteriaObject = {
176
+ type: 'object',
177
+ properties: {
178
+ condition: { type: 'string' },
179
+ context: { type: 'string' },
180
+ type: {
181
+ oneOf: [
182
+ { type: 'string', enum: ['regex', 'jsonpath', 'simple', 'xpath'] },
183
+ {
184
+ type: 'object',
185
+ properties: {
186
+ type: { type: 'string', enum: ['jsonpath'] },
187
+ version: { type: 'string', enum: ['draft-goessner-dispatch-jsonpath-00'] },
188
+ },
189
+ },
190
+ {
191
+ type: 'object',
192
+ properties: {
193
+ type: { type: 'string', enum: ['xpath'] },
194
+ version: { type: 'string', enum: ['xpath-30', 'xpath-20', 'xpath-10'] },
195
+ },
196
+ },
197
+ ],
198
+ },
199
+ },
200
+ required: ['condition'],
201
+ additionalProperties: false,
202
+ } as const;
203
+ const criteriaObjects = {
204
+ type: 'array',
205
+ items: criteriaObject,
206
+ } as const;
207
+ const inherit = {
208
+ type: 'string',
209
+ enum: ['auto', 'none'],
210
+ } as const;
211
+ const onSuccessObject = {
212
+ type: 'object',
213
+ properties: {
214
+ name: { type: 'string' },
215
+ type: { type: 'string', enum: ['goto', 'end'] },
216
+ stepId: { type: 'string' },
217
+ workflowId: { type: 'string' },
218
+ criteria: criteriaObjects,
219
+ },
220
+ additionalProperties: false,
221
+ required: ['type', 'name'],
222
+ } as const;
223
+ const onSuccessList = {
224
+ type: 'array',
225
+ items: onSuccessObject,
226
+ } as const;
227
+ const onFailureObject = {
228
+ type: 'object',
229
+ properties: {
230
+ name: { type: 'string' },
231
+ type: { type: 'string', enum: ['goto', 'retry', 'end'] },
232
+ workflowId: { type: 'string' },
233
+ stepId: { type: 'string' },
234
+ retryAfter: { type: 'number' },
235
+ retryLimit: { type: 'number' },
236
+ criteria: criteriaObjects,
237
+ },
238
+ additionalProperties: false,
239
+ required: ['type', 'name'],
240
+ } as const;
241
+ const onFailureList = {
242
+ type: 'array',
243
+ items: onFailureObject,
244
+ } as const;
245
+ const step = {
246
+ type: 'object',
247
+ properties: {
248
+ stepId: { type: 'string' },
249
+ description: { type: 'string' },
250
+ operationId: { type: 'string' },
251
+ operationPath: { type: 'string' },
252
+ workflowId: { type: 'string' },
253
+ parameters: parameters,
254
+ successCriteria: criteriaObjects,
255
+ onSuccess: onSuccessList,
256
+ onFailure: onFailureList,
257
+ outputs: {
258
+ type: 'object',
259
+ additionalProperties: {
260
+ type: 'string',
261
+ },
262
+ },
263
+ 'x-inherit': inherit,
264
+ 'x-expect': expectSchema,
265
+ 'x-assert': { type: 'string' },
266
+ 'x-operation': extendedOperation,
267
+ requestBody: requestBody,
268
+ },
269
+ required: ['stepId'],
270
+ oneOf: [
271
+ { required: ['x-operation'] },
272
+ { required: ['operationId'] },
273
+ { required: ['operationPath'] },
274
+ { required: ['workflowId'] },
275
+ ],
276
+ } as const;
277
+ const steps = {
278
+ type: 'array',
279
+ items: step,
280
+ } as const;
281
+ const JSONSchema = {
282
+ type: 'object',
283
+ properties: {
284
+ type: {
285
+ type: 'string',
286
+ enum: ['object', 'array', 'string', 'number', 'integer', 'boolean', 'null'],
287
+ },
288
+ properties: {
289
+ type: 'object',
290
+ additionalProperties: true,
291
+ },
292
+ required: {
293
+ type: 'array',
294
+ items: { type: 'string' },
295
+ },
296
+ items: {
297
+ type: 'object',
298
+ additionalProperties: true,
299
+ },
300
+ },
301
+ required: ['type'],
302
+ additionalProperties: true,
303
+ } as const;
304
+ const workflow = {
305
+ type: 'object',
306
+ properties: {
307
+ workflowId: { type: 'string' },
308
+ summary: { type: 'string' },
309
+ description: { type: 'string' },
310
+ parameters: parameters,
311
+ dependsOn: { type: 'array', items: { type: 'string' } },
312
+ inputs: JSONSchema,
313
+ outputs: {
314
+ type: 'object',
315
+ additionalProperties: {
316
+ type: 'string',
317
+ },
318
+ },
319
+ steps: steps,
320
+ successActions: {
321
+ type: 'array',
322
+ items: onSuccessObject,
323
+ },
324
+ failureActions: {
325
+ type: 'array',
326
+ items: onFailureObject,
327
+ },
328
+ },
329
+ additionalProperties: false,
330
+ required: ['workflowId', 'steps'],
331
+ } as const;
332
+ const workflows = {
333
+ type: 'array',
334
+ items: workflow,
335
+ } as const;
336
+ export const arazzoSchema = {
337
+ type: 'object',
338
+ properties: {
339
+ arazzo: { type: 'string', enum: ['1.0.0'] },
340
+ info: infoObject,
341
+ sourceDescriptions: sourceDescriptionsSchema,
342
+ 'x-parameters': parameters,
343
+ workflows: workflows,
344
+ components: {
345
+ type: 'object',
346
+ properties: {
347
+ inputs: {
348
+ type: 'object',
349
+ additionalProperties: {
350
+ type: 'object',
351
+ additionalProperties: true,
352
+ properties: {
353
+ type: {
354
+ type: 'string',
355
+ },
356
+ properties: {
357
+ type: 'object',
358
+ additionalProperties: true,
359
+ },
360
+ },
361
+ required: ['type'],
362
+ },
363
+ },
364
+ parameters: {
365
+ type: 'object',
366
+ additionalProperties: parameter,
367
+ },
368
+ successActions: {
369
+ type: 'object',
370
+ additionalProperties: onSuccessObject,
371
+ },
372
+ failureActions: {
373
+ type: 'object',
374
+ additionalProperties: onFailureObject,
375
+ },
376
+ },
377
+ },
378
+ },
379
+ additionalProperties: false,
380
+ required: ['arazzo', 'info', 'sourceDescriptions', 'workflows'],
381
+ } as const;
382
+
383
+ export const ArazzoTypes: Record<string, NodeType> = getNodeTypesFromJSONSchema(
384
+ ARAZZO_ROOT_TYPE,
385
+ arazzoSchema
386
+ );
package/src/types/oas3.ts CHANGED
@@ -346,13 +346,6 @@ const Schema: NodeType = {
346
346
  return 'Schema';
347
347
  }
348
348
  },
349
- additionalItems: (value: any) => {
350
- if (typeof value === 'boolean') {
351
- return { type: 'boolean' };
352
- } else {
353
- return 'Schema';
354
- }
355
- },
356
349
  additionalProperties: (value: any) => {
357
350
  if (typeof value === 'boolean') {
358
351
  return { type: 'boolean' };
@@ -134,6 +134,7 @@ const Schema: NodeType = {
134
134
  then: 'Schema',
135
135
  else: 'Schema',
136
136
  dependentSchemas: listOf('Schema'),
137
+ dependentRequired: 'DependentRequired',
137
138
  prefixItems: listOf('Schema'),
138
139
  contains: 'Schema',
139
140
  minContains: { type: 'integer', minimum: 0 },
@@ -266,6 +267,11 @@ const SecurityScheme: NodeType = {
266
267
  extensionsPrefix: 'x-',
267
268
  };
268
269
 
270
+ const DependentRequired: NodeType = {
271
+ properties: {},
272
+ additionalProperties: { type: 'array', items: { type: 'string' } },
273
+ };
274
+
269
275
  export const Oas3_1Types: Record<Oas3_1NodeType, NodeType> = {
270
276
  ...Oas3Types,
271
277
  Info,
@@ -277,4 +283,5 @@ export const Oas3_1Types: Record<Oas3_1NodeType, NodeType> = {
277
283
  NamedPathItems: mapOf('PathItem'),
278
284
  SecurityScheme,
279
285
  Operation,
286
+ DependentRequired,
280
287
  };