@redocly/openapi-core 1.0.2 → 1.2.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 (80) hide show
  1. package/CHANGELOG.md +22 -0
  2. package/lib/bundle.d.ts +2 -2
  3. package/lib/bundle.js +24 -22
  4. package/lib/config/builtIn.js +4 -0
  5. package/lib/config/config-resolvers.js +19 -6
  6. package/lib/config/config.d.ts +9 -9
  7. package/lib/config/config.js +32 -17
  8. package/lib/config/rules.d.ts +2 -2
  9. package/lib/config/types.d.ts +9 -3
  10. package/lib/format/codeframes.d.ts +1 -1
  11. package/lib/index.d.ts +1 -1
  12. package/lib/index.js +7 -6
  13. package/lib/lint.js +10 -16
  14. package/lib/oas-types.d.ts +16 -10
  15. package/lib/oas-types.js +52 -26
  16. package/lib/rules/async2/channels-kebab-case.d.ts +2 -0
  17. package/lib/rules/async2/channels-kebab-case.js +19 -0
  18. package/lib/rules/async2/index.d.ts +12 -0
  19. package/lib/rules/async2/index.js +22 -0
  20. package/lib/rules/async2/no-channel-trailing-slash.d.ts +2 -0
  21. package/lib/rules/async2/no-channel-trailing-slash.js +16 -0
  22. package/lib/rules/common/no-path-trailing-slash.js +2 -2
  23. package/lib/rules/common/scalar-property-missing-example.js +1 -1
  24. package/lib/rules/common/spec.d.ts +2 -2
  25. package/lib/rules/common/spec.js +3 -3
  26. package/lib/rules/common/tags-alphabetical.js +5 -2
  27. package/lib/rules/oas2/index.js +1 -1
  28. package/lib/rules/oas2/remove-unused-components.js +4 -1
  29. package/lib/rules/oas3/index.js +1 -1
  30. package/lib/rules/oas3/remove-unused-components.js +4 -1
  31. package/lib/rules/utils.d.ts +1 -1
  32. package/lib/types/asyncapi.d.ts +2 -0
  33. package/lib/types/asyncapi.js +1027 -0
  34. package/lib/types/portal-config-schema.d.ts +2533 -0
  35. package/lib/types/portal-config-schema.js +304 -0
  36. package/lib/types/redocly-yaml.js +26 -20
  37. package/lib/types/{config-external-schemas.d.ts → theme-config.d.ts} +140 -575
  38. package/lib/types/{config-external-schemas.js → theme-config.js} +55 -261
  39. package/lib/typings/asyncapi.d.ts +21 -0
  40. package/lib/typings/asyncapi.js +2 -0
  41. package/lib/visitors.d.ts +12 -0
  42. package/lib/walk.d.ts +3 -3
  43. package/package.json +3 -2
  44. package/src/__tests__/lint.test.ts +38 -6
  45. package/src/bundle.ts +27 -28
  46. package/src/config/__tests__/__snapshots__/config.test.ts.snap +24 -0
  47. package/src/config/__tests__/config.test.ts +15 -4
  48. package/src/config/builtIn.ts +4 -0
  49. package/src/config/config-resolvers.ts +25 -6
  50. package/src/config/config.ts +51 -27
  51. package/src/config/rules.ts +2 -2
  52. package/src/config/types.ts +14 -4
  53. package/src/index.ts +7 -1
  54. package/src/lint.ts +13 -22
  55. package/src/oas-types.ts +59 -21
  56. package/src/rules/async2/__tests__/channels-kebab-case.test.ts +141 -0
  57. package/src/rules/async2/__tests__/no-channel-trailing-slash.test.ts +97 -0
  58. package/src/rules/async2/channels-kebab-case.ts +18 -0
  59. package/src/rules/async2/index.ts +22 -0
  60. package/src/rules/async2/no-channel-trailing-slash.ts +15 -0
  61. package/src/rules/common/__tests__/no-path-trailing-slash.test.ts +41 -0
  62. package/src/rules/common/__tests__/tags-alphabetical.test.ts +58 -0
  63. package/src/rules/common/no-path-trailing-slash.ts +2 -2
  64. package/src/rules/common/scalar-property-missing-example.ts +2 -2
  65. package/src/rules/common/spec.ts +2 -2
  66. package/src/rules/common/tags-alphabetical.ts +8 -4
  67. package/src/rules/oas2/__tests__/remove-unused-components.test.ts +155 -0
  68. package/src/rules/oas2/index.ts +2 -2
  69. package/src/rules/oas2/remove-unused-components.ts +6 -1
  70. package/src/rules/oas3/__tests__/remove-unused-components.test.ts +171 -0
  71. package/src/rules/oas3/index.ts +2 -2
  72. package/src/rules/oas3/remove-unused-components.ts +6 -1
  73. package/src/types/asyncapi.ts +1136 -0
  74. package/src/types/portal-config-schema.ts +343 -0
  75. package/src/types/redocly-yaml.ts +23 -34
  76. package/src/types/{config-external-schemas.ts → theme-config.ts} +60 -294
  77. package/src/typings/asyncapi.ts +26 -0
  78. package/src/visitors.ts +22 -0
  79. package/src/walk.ts +3 -3
  80. package/tsconfig.tsbuildinfo +1 -1
@@ -1,271 +1,8 @@
1
- import {
2
- ApigeeDevOnboardingIntegrationAuthType,
3
- AuthProviderType,
4
- DEFAULT_TEAM_CLAIM_NAME,
5
- } from '../config';
6
-
7
- const oidcIssuerMetadataSchema = {
8
- type: 'object',
9
- properties: {
10
- end_session_endpoint: { type: 'string' },
11
- token_endpoint: { type: 'string' },
12
- authorization_endpoint: { type: 'string' },
13
- },
14
- required: ['token_endpoint', 'authorization_endpoint'],
15
- additionalProperties: true,
16
- } as const;
17
-
18
- const oidcProviderConfigSchema = {
19
- type: 'object',
20
- properties: {
21
- type: { type: 'string', const: AuthProviderType.OIDC },
22
- title: { type: 'string' },
23
- configurationUrl: { type: 'string', minLength: 1 },
24
- configuration: oidcIssuerMetadataSchema,
25
- clientId: { type: 'string', minLength: 1 },
26
- clientSecret: { type: 'string', minLength: 1 },
27
- teamsClaimName: { type: 'string' },
28
- defaultTeams: { type: 'array', items: { type: 'string' } },
29
- scopes: { type: 'array', items: { type: 'string' } },
30
- tokenExpirationTime: { type: 'number' },
31
- authorizationRequestCustomParams: { type: 'object', additionalProperties: { type: 'string' } },
32
- tokenRequestCustomParams: { type: 'object', additionalProperties: { type: 'string' } },
33
- },
34
- required: ['type', 'clientId', 'clientSecret'],
35
- oneOf: [{ required: ['configurationUrl'] }, { required: ['configuration'] }],
36
- additionalProperties: false,
37
- } as const;
38
-
39
- const saml2ProviderConfigSchema = {
40
- type: 'object',
41
- properties: {
42
- type: { type: 'string', const: AuthProviderType.SAML2 },
43
- title: { type: 'string' },
44
- issuerId: { type: 'string' },
45
- entityId: { type: 'string' },
46
- ssoUrl: { type: 'string' },
47
- x509PublicCert: { type: 'string' },
48
- teamsAttributeName: { type: 'string', default: DEFAULT_TEAM_CLAIM_NAME },
49
- teamsAttributeMap: { type: 'object', additionalProperties: { type: 'string' } },
50
- defaultTeams: { type: 'array', items: { type: 'string' } },
51
- },
52
- additionalProperties: false,
53
- required: ['type', 'issuerId', 'ssoUrl', 'x509PublicCert'],
54
- } as const;
55
-
56
- const basicAuthProviderConfigSchema = {
57
- type: 'object',
58
- properties: {
59
- type: { type: 'string', const: AuthProviderType.BASIC },
60
- title: { type: 'string' },
61
- credentials: {
62
- type: 'array',
63
- items: {
64
- type: 'object',
65
- properties: {
66
- username: { type: 'string' },
67
- password: { type: 'string' },
68
- passwordHash: { type: 'string' },
69
- teams: { type: 'array', items: { type: 'string' } },
70
- },
71
- required: ['username'],
72
- additionalProperties: false,
73
- },
74
- },
75
- },
76
- required: ['type', 'credentials'],
77
- additionalProperties: false,
78
- } as const;
79
-
80
- const authProviderConfigSchema = {
81
- oneOf: [oidcProviderConfigSchema, saml2ProviderConfigSchema, basicAuthProviderConfigSchema],
82
- discriminator: { propertyName: 'type' },
83
- } as const;
84
-
85
- const rbacScopeItemsSchema = { type: 'object', additionalProperties: { type: 'string' } } as const;
86
-
87
- export const rbacConfigSchema = {
88
- type: 'object',
89
- properties: {
90
- defaults: rbacScopeItemsSchema,
91
- },
92
- additionalProperties: rbacScopeItemsSchema,
93
- } as const;
94
-
95
- export const ssoConfigSchema = {
96
- type: 'object',
97
- additionalProperties: authProviderConfigSchema,
98
- } as const;
99
-
100
- export const redirectConfigSchema = {
101
- type: 'object',
102
- properties: {
103
- to: { type: 'string' },
104
- type: { type: 'number', default: 301 },
105
- },
106
- required: ['to'],
107
- additionalProperties: false,
108
- } as const;
109
-
110
- export const seoConfigSchema = {
111
- type: 'object',
112
- properties: {
113
- title: { type: 'string' },
114
- description: { type: 'string' },
115
- siteUrl: { type: 'string' },
116
- image: { type: 'string' },
117
- keywords: { type: 'array', items: { type: 'string' } },
118
- lang: { type: 'string' },
119
- jsonLd: { type: 'object' },
120
- meta: {
121
- type: 'array',
122
- items: {
123
- type: 'object',
124
- properties: {
125
- name: { type: 'string' },
126
- content: { type: 'string' },
127
- },
128
- required: ['name', 'content'],
129
- additionalProperties: false,
130
- },
131
- },
132
- },
133
- additionalProperties: false,
134
- } as const;
135
-
136
- const apigeeAdapterAuthOauth2Schema = {
137
- type: 'object',
138
- properties: {
139
- type: { type: 'string', const: ApigeeDevOnboardingIntegrationAuthType.OAUTH2 },
140
- tokenEndpoint: { type: 'string' },
141
- clientId: { type: 'string' },
142
- clientSecret: { type: 'string' },
143
- },
144
- additionalProperties: false,
145
- required: ['type', 'tokenEndpoint', 'clientId', 'clientSecret'],
146
- } as const;
147
-
148
- const apigeeAdapterAuthServiceAccountSchema = {
149
- type: 'object',
150
- properties: {
151
- type: { type: 'string', const: ApigeeDevOnboardingIntegrationAuthType.SERVICE_ACCOUNT },
152
- serviceAccountEmail: { type: 'string' },
153
- serviceAccountPrivateKey: { type: 'string' },
154
- },
155
- additionalProperties: false,
156
- required: ['type', 'serviceAccountEmail', 'serviceAccountPrivateKey'],
157
- } as const;
158
-
159
- const apigeeXAdapterConfigSchema = {
160
- type: 'object',
161
- properties: {
162
- type: { type: 'string', const: 'APIGEE_X' },
163
- apiUrl: { type: 'string' },
164
- stage: { type: 'string', default: 'non-production' },
165
- organizationName: { type: 'string' },
166
- ignoreApiProducts: { type: 'array', items: { type: 'string' } },
167
- allowApiProductsOutsideCatalog: { type: 'boolean', default: false },
168
- auth: {
169
- type: 'object',
170
- oneOf: [apigeeAdapterAuthOauth2Schema, apigeeAdapterAuthServiceAccountSchema],
171
- discriminator: { propertyName: 'type' },
172
- },
173
- },
174
- additionalProperties: false,
175
- required: ['type', 'organizationName', 'auth'],
176
- } as const;
177
-
178
- const apigeeEdgeAdapterConfigSchema = {
179
- ...apigeeXAdapterConfigSchema,
180
- properties: {
181
- ...apigeeXAdapterConfigSchema.properties,
182
- type: { type: 'string', const: 'APIGEE_EDGE' },
183
- },
184
- } as const;
185
-
186
- const graviteeAdapterConfigSchema = {
187
- type: 'object',
188
- properties: {
189
- type: { type: 'string', const: 'GRAVITEE' },
190
- apiBaseUrl: { type: 'string' },
191
- env: { type: 'string' },
192
- allowApiProductsOutsideCatalog: { type: 'boolean', default: false },
193
- stage: { type: 'string', default: 'non-production' },
194
-
195
- auth: { type: 'object', properties: { static: { type: 'string' } } },
196
- },
197
- additionalProperties: false,
198
- required: ['type', 'apiBaseUrl'],
199
- } as const;
200
-
201
- const devOnboardingAdapterConfigSchema = {
202
- type: 'object',
203
- oneOf: [apigeeXAdapterConfigSchema, apigeeEdgeAdapterConfigSchema, graviteeAdapterConfigSchema],
204
- discriminator: { propertyName: 'type' },
205
- } as const;
206
-
207
- export const devOnboardingConfigSchema = {
208
- type: 'object',
209
- required: ['adapters'],
210
- additionalProperties: false,
211
- properties: {
212
- adapters: {
213
- type: 'array',
214
- items: devOnboardingAdapterConfigSchema,
215
- },
216
- },
217
- } as const;
218
-
219
- export const responseHeaderSchema = {
220
- type: 'object',
221
- properties: {
222
- name: { type: 'string' },
223
- value: { type: 'string' },
224
- },
225
- additionalProperties: false,
226
- required: ['name', 'value'],
227
- } as const;
228
-
229
- export const i18nConfigSchema = {
230
- type: 'object',
231
- properties: {
232
- defaultLocale: {
233
- type: 'string',
234
- },
235
- locales: {
236
- type: 'array',
237
- items: {
238
- type: 'object',
239
- properties: {
240
- code: {
241
- type: 'string',
242
- },
243
- name: {
244
- type: 'string',
245
- },
246
- },
247
- required: ['code'],
248
- },
249
- },
250
- },
251
- required: ['defaultLocale', 'locales'],
252
- } as const;
253
-
254
- export const mockServerConfigSchema = {
255
- type: 'object',
256
- properties: {
257
- off: { type: 'boolean', default: false },
258
- position: { type: 'string', enum: ['first', 'last', 'replace', 'off'], default: 'first' },
259
- strictExamples: { type: 'boolean', default: false },
260
- errorIfForcedExampleNotFound: { type: 'boolean', default: false },
261
- description: { type: 'string' },
262
- },
263
- } as const;
264
-
265
1
  const logoConfigSchema = {
266
2
  type: 'object',
267
3
  properties: {
268
4
  image: { type: 'string' },
5
+ srcSet: { type: 'string' },
269
6
  altText: { type: 'string' },
270
7
  link: { type: 'string' },
271
8
  favicon: { type: 'string' },
@@ -359,8 +96,6 @@ const markdownConfigSchema = {
359
96
  type: 'object',
360
97
  properties: {
361
98
  baseUrl: { type: 'string' },
362
- icon: { type: 'string' },
363
- text: { type: 'string', default: 'Edit this page' },
364
99
  ...hideConfigSchema.properties,
365
100
  },
366
101
  additionalProperties: false,
@@ -457,37 +192,17 @@ const googleAnalyticsConfigSchema = {
457
192
  properties: {
458
193
  includeInDevelopment: { type: 'boolean' },
459
194
  trackingId: { type: 'string' },
195
+
196
+ conversionId: { type: 'string' },
197
+ floodlightId: { type: 'string' },
198
+
460
199
  head: { type: 'boolean' },
461
200
  respectDNT: { type: 'boolean' },
462
- anonymize: { type: 'boolean' },
463
201
  exclude: { type: 'array', items: { type: 'string' } },
464
- optimizeId: { type: 'string' },
465
- experimentId: { type: 'string' },
466
- variationId: { type: 'string' },
467
- enableWebVitalsTracking: { type: 'boolean' },
468
202
 
469
- defer: { type: 'boolean' },
470
- sampleRate: { type: 'number' },
471
- name: { type: 'string' },
472
- clientId: { type: 'string' },
473
- siteSpeedSampleRate: { type: 'number' },
474
- alwaysSendReferrer: { type: 'boolean' },
475
- allowAnchor: { type: 'boolean' },
476
- cookieName: { type: 'string' },
477
- cookieFlags: { type: 'string' },
478
- cookieDomain: { type: 'string' },
203
+ optimizeId: { type: 'string' },
204
+ anonymizeIp: { type: 'boolean' },
479
205
  cookieExpires: { type: 'number' },
480
- storeGac: { type: 'boolean' },
481
- legacyCookieDomain: { type: 'string' },
482
- legacyHistoryImport: { type: 'boolean' },
483
- allowLinker: { type: 'boolean' },
484
- storage: { type: 'string' },
485
-
486
- allowAdFeatures: { type: 'boolean' },
487
- dataSource: { type: 'string' },
488
- queueTime: { type: 'number' },
489
- forceSSL: { type: 'boolean' },
490
- transport: { type: 'string' },
491
206
  },
492
207
  additionalProperties: false,
493
208
  required: ['trackingId'],
@@ -513,6 +228,11 @@ const navItemSchema = {
513
228
  label: { type: 'string' },
514
229
  separator: { type: 'string' },
515
230
  separatorLine: { type: 'boolean' },
231
+ linePosition: {
232
+ type: 'string',
233
+ enum: ['top', 'bottom'],
234
+ default: 'top',
235
+ },
516
236
  version: { type: 'string' },
517
237
  menuStyle: { type: 'string', enum: ['drilldown'] },
518
238
  expanded: { type: 'string', const: 'always' },
@@ -579,6 +299,14 @@ const scorecardConfigSchema = {
579
299
  required: ['levels'],
580
300
  properties: {
581
301
  failBuildIfBelowMinimum: { type: 'boolean', default: false },
302
+ teamMetadataProperty: {
303
+ type: 'object',
304
+ properties: {
305
+ property: { type: 'string' },
306
+ label: { type: 'string' },
307
+ default: { type: 'string' },
308
+ },
309
+ },
582
310
  levels: {
583
311
  type: 'array',
584
312
  items: {
@@ -622,11 +350,15 @@ const scorecardConfigSchema = {
622
350
  const catalogSchema = {
623
351
  type: 'object',
624
352
  additionalProperties: true,
625
- required: ['slug', 'filters', 'groupByFirstFilter', 'items'],
353
+ required: ['slug', 'items'],
626
354
  properties: {
627
355
  slug: { type: 'string' },
628
356
  filters: { type: 'array', items: catalogFilterSchema },
629
357
  groupByFirstFilter: { type: 'boolean' },
358
+ filterValuesCasing: {
359
+ type: 'string',
360
+ enum: ['sentence', 'original', 'lowercase', 'uppercase'],
361
+ },
630
362
  items: navItemsSchema,
631
363
  requiredPermission: { type: 'string' },
632
364
  separateVersions: { type: 'boolean' },
@@ -670,11 +402,30 @@ export const themeConfigSchema = {
670
402
  properties: {
671
403
  items: navItemsSchema,
672
404
  copyrightText: { type: 'string' },
405
+ logo: hideConfigSchema,
673
406
  ...hideConfigSchema.properties,
674
407
  },
675
408
  additionalProperties: false,
676
409
  },
677
- sidebar: hideConfigSchema,
410
+ sidebar: {
411
+ type: 'object',
412
+ properties: {
413
+ separatorLine: { type: 'boolean' },
414
+ linePosition: {
415
+ type: 'string',
416
+ enum: ['top', 'bottom'],
417
+ default: 'bottom',
418
+ },
419
+ ...hideConfigSchema.properties,
420
+ },
421
+ additionalProperties: false,
422
+ },
423
+ seo: {
424
+ type: 'object',
425
+ properties: {
426
+ title: { type: 'string' },
427
+ },
428
+ },
678
429
  scripts: {
679
430
  type: 'object',
680
431
  properties: {
@@ -873,6 +624,15 @@ export const themeConfigSchema = {
873
624
  additionalProperties: false,
874
625
  default: {},
875
626
  },
627
+ versionPicker: {
628
+ type: 'object',
629
+ properties: {
630
+ hide: { type: 'boolean' },
631
+ showForUnversioned: {
632
+ type: 'boolean',
633
+ },
634
+ },
635
+ },
876
636
  breadcrumbs: {
877
637
  type: 'object',
878
638
  properties: {
@@ -915,3 +675,9 @@ export const productThemeOverrideSchema = {
915
675
  additionalProperties: true,
916
676
  default: {},
917
677
  } as const;
678
+
679
+ export enum ScorecardStatus {
680
+ BelowMinimum = 'Below minimum',
681
+ Highest = 'Highest',
682
+ Minimum = 'Minimum',
683
+ }
@@ -0,0 +1,26 @@
1
+ export interface Async2Definition {
2
+ asyncapi: string;
3
+ info?: Async2Info;
4
+ // TBD
5
+ }
6
+
7
+ export interface Async2Info {
8
+ title: string;
9
+ version: string;
10
+
11
+ description?: string;
12
+ termsOfService?: string;
13
+ contact?: Async2Contact;
14
+ license?: Async2License;
15
+ }
16
+
17
+ export interface Async2Contact {
18
+ name?: string;
19
+ url?: string;
20
+ email?: string;
21
+ }
22
+
23
+ export interface Async2License {
24
+ name: string;
25
+ url?: string;
26
+ }
package/src/visitors.ts CHANGED
@@ -49,6 +49,7 @@ import { NormalizedNodeType, SpecExtension } from './types';
49
49
  import type { Stack } from './utils';
50
50
  import type { UserContext, ResolveResult, ProblemSeverity } from './walk';
51
51
  import type { Location } from './ref-utils';
52
+ import { Async2Definition } from './typings/asyncapi';
52
53
 
53
54
  export type SkipFunctionContext = Pick<
54
55
  UserContext,
@@ -206,6 +207,10 @@ type Oas2FlatVisitor = {
206
207
  SpecExtension?: VisitFunctionOrObject<unknown>;
207
208
  };
208
209
 
210
+ type Async2FlatVisitor = {
211
+ Root?: VisitFunctionOrObject<Async2Definition>;
212
+ };
213
+
209
214
  const legacyTypesMap = {
210
215
  Root: 'DefinitionRoot',
211
216
  ServerVariablesMap: 'ServerVariableMap',
@@ -232,6 +237,12 @@ type Oas2NestedVisitor = {
232
237
  : Oas2FlatVisitor[T] & NestedVisitor<Oas2NestedVisitor>;
233
238
  };
234
239
 
240
+ type Async2NestedVisitor = {
241
+ [T in keyof Async2FlatVisitor]: Async2FlatVisitor[T] extends Function
242
+ ? Async2FlatVisitor[T]
243
+ : Async2FlatVisitor[T] & NestedVisitor<Async2NestedVisitor>;
244
+ };
245
+
235
246
  export type Oas3Visitor = BaseVisitor &
236
247
  Oas3NestedVisitor &
237
248
  Record<string, VisitFunction<any> | NestedVisitObject<any, Oas3NestedVisitor>>;
@@ -240,6 +251,10 @@ export type Oas2Visitor = BaseVisitor &
240
251
  Oas2NestedVisitor &
241
252
  Record<string, VisitFunction<any> | NestedVisitObject<any, Oas2NestedVisitor>>;
242
253
 
254
+ export type Async2Visitor = BaseVisitor &
255
+ Async2NestedVisitor &
256
+ Record<string, VisitFunction<any> | NestedVisitObject<any, Async2NestedVisitor>>;
257
+
243
258
  export type Oas3TransformVisitor = BaseVisitor &
244
259
  Oas3FlatVisitor &
245
260
  Record<string, VisitFunction<any> | VisitObject<any>>;
@@ -248,6 +263,10 @@ export type Oas2TransformVisitor = BaseVisitor &
248
263
  Oas2FlatVisitor &
249
264
  Record<string, VisitFunction<any> | VisitObject<any>>;
250
265
 
266
+ export type Async2TransformVisitor = BaseVisitor &
267
+ Async2FlatVisitor &
268
+ Record<string, VisitFunction<any> | VisitObject<any>>;
269
+
251
270
  export type NestedVisitor<T> = Exclude<T, 'any' | 'ref' | 'Root'>;
252
271
 
253
272
  export type NormalizedOasVisitors<T extends BaseVisitor> = {
@@ -269,10 +288,13 @@ export type NormalizedOasVisitors<T extends BaseVisitor> = {
269
288
 
270
289
  export type Oas3Rule = (options: Record<string, any>) => Oas3Visitor | Oas3Visitor[];
271
290
  export type Oas2Rule = (options: Record<string, any>) => Oas2Visitor | Oas2Visitor[];
291
+ export type Async2Rule = (options: Record<string, any>) => Async2Visitor | Async2Visitor[];
272
292
  export type Oas3Preprocessor = (options: Record<string, any>) => Oas3TransformVisitor;
273
293
  export type Oas2Preprocessor = (options: Record<string, any>) => Oas2TransformVisitor;
294
+ export type Async2Preprocessor = (options: Record<string, any>) => Async2TransformVisitor;
274
295
  export type Oas3Decorator = (options: Record<string, any>) => Oas3TransformVisitor;
275
296
  export type Oas2Decorator = (options: Record<string, any>) => Oas2TransformVisitor;
297
+ export type Async2Decorator = (options: Record<string, any>) => Async2TransformVisitor;
276
298
 
277
299
  // alias for the latest version supported
278
300
  // every time we update it - consider semver
package/src/walk.ts CHANGED
@@ -12,7 +12,7 @@ import type { RuleSeverity } from './config';
12
12
  import { Location, isRef } from './ref-utils';
13
13
  import { pushStack, popStack } from './utils';
14
14
  import { ResolveError, YamlParseError, Source, makeRefId } from './resolve';
15
- import { OasVersion } from './oas-types';
15
+ import { SpecVersion } from './oas-types';
16
16
  import { isNamedType, SpecExtension } from './types';
17
17
 
18
18
  type NonUndefined = string | number | boolean | symbol | bigint | object | Record<string, any>;
@@ -33,7 +33,7 @@ export type UserContext = {
33
33
  type: NormalizedNodeType;
34
34
  key: string | number;
35
35
  parent: any;
36
- oasVersion: OasVersion;
36
+ oasVersion: SpecVersion;
37
37
  getVisitorData: () => Record<string, unknown>;
38
38
  };
39
39
 
@@ -79,7 +79,7 @@ export type NormalizedProblem = {
79
79
 
80
80
  export type WalkContext = {
81
81
  problems: NormalizedProblem[];
82
- oasVersion: OasVersion;
82
+ oasVersion: SpecVersion;
83
83
  visitorsData: Record<string, Record<string, unknown>>; // custom data store that visitors can use for various purposes
84
84
  refTypes?: Map<string, NormalizedNodeType>;
85
85
  };