@redocly/openapi-core 1.0.0-beta.102 → 1.0.0-beta.103

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 (53) hide show
  1. package/lib/config/config.d.ts +3 -3
  2. package/lib/config/load.d.ts +1 -1
  3. package/lib/config/load.js +15 -2
  4. package/lib/config/rules.d.ts +1 -1
  5. package/lib/config/types.d.ts +4 -2
  6. package/lib/decorators/common/filters/filter-helper.d.ts +3 -0
  7. package/lib/decorators/common/filters/filter-helper.js +67 -0
  8. package/lib/decorators/common/filters/filter-in.d.ts +2 -0
  9. package/lib/decorators/common/filters/filter-in.js +17 -0
  10. package/lib/decorators/common/filters/filter-out.d.ts +2 -0
  11. package/lib/decorators/common/filters/filter-out.js +17 -0
  12. package/lib/decorators/oas2/index.d.ts +2 -0
  13. package/lib/decorators/oas2/index.js +5 -1
  14. package/lib/decorators/oas3/index.d.ts +2 -0
  15. package/lib/decorators/oas3/index.js +5 -1
  16. package/lib/index.d.ts +1 -1
  17. package/lib/lint.d.ts +2 -0
  18. package/lib/lint.js +2 -2
  19. package/lib/redocly/registry-api-types.d.ts +2 -0
  20. package/lib/redocly/registry-api.d.ts +1 -1
  21. package/lib/redocly/registry-api.js +3 -1
  22. package/lib/rules/common/assertions/asserts.d.ts +6 -1
  23. package/lib/rules/common/assertions/asserts.js +81 -51
  24. package/lib/rules/common/assertions/utils.d.ts +2 -1
  25. package/lib/rules/common/assertions/utils.js +27 -8
  26. package/lib/types/redocly-yaml.js +316 -27
  27. package/lib/utils.d.ts +2 -1
  28. package/lib/utils.js +5 -1
  29. package/lib/walk.d.ts +2 -0
  30. package/lib/walk.js +16 -7
  31. package/package.json +1 -1
  32. package/src/__tests__/lint.test.ts +17 -4
  33. package/src/config/__tests__/load.test.ts +6 -0
  34. package/src/config/load.ts +28 -5
  35. package/src/config/types.ts +6 -5
  36. package/src/decorators/__tests__/filter-in.test.ts +310 -0
  37. package/src/decorators/__tests__/filter-out.test.ts +227 -0
  38. package/src/decorators/common/filters/filter-helper.ts +72 -0
  39. package/src/decorators/common/filters/filter-in.ts +18 -0
  40. package/src/decorators/common/filters/filter-out.ts +18 -0
  41. package/src/decorators/oas2/index.ts +5 -1
  42. package/src/decorators/oas3/index.ts +5 -1
  43. package/src/index.ts +1 -0
  44. package/src/lint.ts +4 -3
  45. package/src/redocly/registry-api-types.ts +2 -0
  46. package/src/redocly/registry-api.ts +4 -0
  47. package/src/rules/common/assertions/__tests__/asserts.test.ts +149 -146
  48. package/src/rules/common/assertions/asserts.ts +97 -52
  49. package/src/rules/common/assertions/utils.ts +41 -16
  50. package/src/types/redocly-yaml.ts +321 -34
  51. package/src/utils.ts +10 -7
  52. package/src/walk.ts +39 -19
  53. package/tsconfig.tsbuildinfo +1 -1
@@ -3,13 +3,124 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.ConfigTypes = void 0;
4
4
  const _1 = require(".");
5
5
  const utils_1 = require("../utils");
6
+ const builtInRulesList = [
7
+ 'spec',
8
+ 'info-description',
9
+ 'info-contact',
10
+ 'info-license',
11
+ 'info-license-url',
12
+ 'operation-2xx-response',
13
+ 'operation-4xx-response',
14
+ 'assertions',
15
+ 'operation-operationId-unique',
16
+ 'operation-parameters-unique',
17
+ 'path-parameters-defined',
18
+ 'operation-tag-defined',
19
+ 'no-example-value-and-externalValue',
20
+ 'no-enum-type-mismatch',
21
+ 'no-path-trailing-slash',
22
+ 'no-empty-servers',
23
+ 'path-declaration-must-exist',
24
+ 'operation-operationId-url-safe',
25
+ 'operation-operationId',
26
+ 'operation-summary',
27
+ 'tags-alphabetical',
28
+ 'no-server-example.com',
29
+ 'no-server-trailing-slash',
30
+ 'tag-description',
31
+ 'operation-description',
32
+ 'no-unused-components',
33
+ 'path-not-include-query',
34
+ 'path-params-defined',
35
+ 'parameter-description',
36
+ 'operation-singular-tag',
37
+ 'operation-security-defined',
38
+ 'no-unresolved-refs',
39
+ 'paths-kebab-case',
40
+ 'boolean-parameter-prefixes',
41
+ 'path-http-verbs-order',
42
+ 'no-invalid-media-type-examples',
43
+ 'no-identical-paths',
44
+ 'no-ambiguous-paths',
45
+ 'no-undefined-server-variable',
46
+ 'no-servers-empty-enum',
47
+ 'no-http-verbs-in-paths',
48
+ 'path-excludes-patterns',
49
+ 'request-mime-type',
50
+ 'response-mime-type',
51
+ 'path-segment-plural',
52
+ 'no-invalid-schema-examples',
53
+ 'no-invalid-parameter-examples',
54
+ 'response-contains-header',
55
+ 'response-contains-property',
56
+ ];
57
+ const nodeTypesList = [
58
+ 'DefinitionRoot',
59
+ 'Tag',
60
+ 'ExternalDocs',
61
+ 'Server',
62
+ 'ServerVariable',
63
+ 'SecurityRequirement',
64
+ 'Info',
65
+ 'Contact',
66
+ 'License',
67
+ 'PathMap',
68
+ 'PathItem',
69
+ 'Parameter',
70
+ 'Operation',
71
+ 'Callback',
72
+ 'RequestBody',
73
+ 'MediaTypeMap',
74
+ 'MediaType',
75
+ 'Example',
76
+ 'Encoding',
77
+ 'Header',
78
+ 'ResponsesMap',
79
+ 'Response',
80
+ 'Link',
81
+ 'Schema',
82
+ 'Xml',
83
+ 'SchemaProperties',
84
+ 'DiscriminatorMapping',
85
+ 'Discriminator',
86
+ 'Components',
87
+ 'NamedSchemas',
88
+ 'NamedResponses',
89
+ 'NamedParameters',
90
+ 'NamedExamples',
91
+ 'NamedRequestBodies',
92
+ 'NamedHeaders',
93
+ 'NamedSecuritySchemes',
94
+ 'NamedLinks',
95
+ 'NamedCallbacks',
96
+ 'ImplicitFlow',
97
+ 'PasswordFlow',
98
+ 'ClientCredentials',
99
+ 'AuthorizationCode',
100
+ 'SecuritySchemeFlows',
101
+ 'SecurityScheme',
102
+ 'XCodeSample',
103
+ 'WebhooksMap',
104
+ ];
6
105
  const ConfigRoot = {
7
106
  properties: {
8
107
  organization: { type: 'string' },
9
108
  apis: 'ConfigApis',
109
+ apiDefinitions: {
110
+ type: 'object',
111
+ properties: {},
112
+ additionalProperties: { properties: { type: 'string' } },
113
+ },
10
114
  lint: 'RootConfigLint',
11
115
  'features.openapi': 'ConfigReferenceDocs',
116
+ referenceDocs: 'ConfigReferenceDocs',
12
117
  'features.mockServer': 'ConfigMockServer',
118
+ region: { enum: ['us', 'eu'] },
119
+ resolve: {
120
+ properties: {
121
+ http: 'ConfigHTTP',
122
+ },
123
+ },
13
124
  },
14
125
  };
15
126
  const ConfigApis = {
@@ -19,9 +130,17 @@ const ConfigApis = {
19
130
  const ConfigApisProperties = {
20
131
  properties: {
21
132
  root: { type: 'string' },
133
+ labels: {
134
+ type: 'array',
135
+ items: {
136
+ type: 'string',
137
+ },
138
+ },
22
139
  lint: 'ConfigLint',
23
140
  'features.openapi': 'ConfigReferenceDocs',
141
+ 'features.mockServer': 'ConfigMockServer',
24
142
  },
143
+ required: ['root'],
25
144
  };
26
145
  const ConfigHTTP = {
27
146
  properties: {
@@ -42,10 +161,10 @@ const ConfigLint = {
42
161
  },
43
162
  },
44
163
  doNotResolveExamples: { type: 'boolean' },
45
- rules: { type: 'object' },
46
- oas2Rules: { type: 'object' },
47
- oas3_0Rules: { type: 'object' },
48
- oas3_1Rules: { type: 'object' },
164
+ rules: 'Rules',
165
+ oas2Rules: 'Rules',
166
+ oas3_0Rules: 'Rules',
167
+ oas3_1Rules: 'Rules',
49
168
  preprocessors: { type: 'object' },
50
169
  oas2Preprocessors: { type: 'object' },
51
170
  oas3_0Preprocessors: { type: 'object' },
@@ -54,11 +173,6 @@ const ConfigLint = {
54
173
  oas2Decorators: { type: 'object' },
55
174
  oas3_0Decorators: { type: 'object' },
56
175
  oas3_1Decorators: { type: 'object' },
57
- resolve: {
58
- properties: {
59
- http: 'ConfigHTTP',
60
- },
61
- },
62
176
  },
63
177
  };
64
178
  const RootConfigLint = {
@@ -67,11 +181,111 @@ const RootConfigLint = {
67
181
  items: { type: 'string' },
68
182
  } }, ConfigLint.properties),
69
183
  };
184
+ const Rules = {
185
+ properties: {},
186
+ additionalProperties: (value, key) => {
187
+ if (key.startsWith('assert/')) {
188
+ return 'Assert';
189
+ }
190
+ else if (builtInRulesList.includes(key) || utils_1.isCustomRuleId(key)) {
191
+ if (typeof value === 'string') {
192
+ return { enum: ['error', 'warn', 'off'] };
193
+ }
194
+ else {
195
+ return 'ObjectRule';
196
+ }
197
+ }
198
+ // Otherwise is considered as invalid
199
+ return;
200
+ },
201
+ };
202
+ const ObjectRule = {
203
+ properties: {
204
+ severity: { enum: ['error', 'warn', 'off'] },
205
+ },
206
+ additionalProperties: {},
207
+ required: ['severity'],
208
+ };
209
+ const Assert = {
210
+ properties: {
211
+ subject: (value) => {
212
+ if (Array.isArray(value)) {
213
+ return { type: 'array', items: { enum: nodeTypesList } };
214
+ }
215
+ else {
216
+ return { enum: nodeTypesList };
217
+ }
218
+ },
219
+ property: (value) => {
220
+ if (Array.isArray(value)) {
221
+ return { type: 'array', items: { type: 'string' } };
222
+ }
223
+ else if (value === null) {
224
+ return null;
225
+ }
226
+ else {
227
+ return { type: 'string' };
228
+ }
229
+ },
230
+ context: _1.listOf('Context'),
231
+ message: { type: 'string' },
232
+ suggest: { type: 'array', items: { type: 'string' } },
233
+ severity: { enum: ['error', 'warn', 'off'] },
234
+ enum: { type: 'array', items: { type: 'string' } },
235
+ pattern: { type: 'string' },
236
+ casing: {
237
+ enum: [
238
+ 'camelCase',
239
+ 'kebab-case',
240
+ 'snake_case',
241
+ 'PascalCase',
242
+ 'MACRO_CASE',
243
+ 'COBOL-CASE',
244
+ 'flatcase',
245
+ ],
246
+ },
247
+ mutuallyExclusive: { type: 'array', items: { type: 'string' } },
248
+ mutuallyRequired: { type: 'array', items: { type: 'string' } },
249
+ required: { type: 'array', items: { type: 'string' } },
250
+ requireAny: { type: 'array', items: { type: 'string' } },
251
+ disallowed: { type: 'array', items: { type: 'string' } },
252
+ defined: { type: 'boolean' },
253
+ undefined: { type: 'boolean' },
254
+ nonEmpty: { type: 'boolean' },
255
+ minLength: { type: 'integer' },
256
+ maxLength: { type: 'integer' },
257
+ ref: (value) => typeof value === 'string' ? { type: 'string' } : { type: 'boolean' },
258
+ },
259
+ required: ['subject'],
260
+ };
261
+ const Context = {
262
+ properties: {
263
+ type: { enum: nodeTypesList },
264
+ matchParentKeys: { type: 'array', items: { type: 'string' } },
265
+ excludeParentKeys: { type: 'array', items: { type: 'string' } },
266
+ },
267
+ required: ['type'],
268
+ };
70
269
  const ConfigLanguage = {
71
270
  properties: {
72
271
  label: { type: 'string' },
73
- lang: { type: 'string' },
272
+ lang: {
273
+ enum: [
274
+ 'curl',
275
+ 'C#',
276
+ 'Go',
277
+ 'Java',
278
+ 'Java8+Apache',
279
+ 'JavaScript',
280
+ 'Node.js',
281
+ 'PHP',
282
+ 'Python',
283
+ 'R',
284
+ 'Ruby',
285
+ ],
286
+ },
74
287
  },
288
+ required: ['lang'],
75
289
  };
76
290
  const ConfigLabels = {
77
291
  properties: {
@@ -93,11 +307,17 @@ const ConfigLabels = {
93
307
  };
94
308
  const ConfigSidebarLinks = {
95
309
  properties: {
96
- placement: { type: 'string' },
310
+ beforeInfo: _1.listOf('CommonConfigSidebarLinks'),
311
+ end: _1.listOf('CommonConfigSidebarLinks'),
312
+ },
313
+ };
314
+ const CommonConfigSidebarLinks = {
315
+ properties: {
97
316
  label: { type: 'string' },
98
317
  link: { type: 'string' },
99
318
  target: { type: 'string' },
100
319
  },
320
+ required: ['label', 'link'],
101
321
  };
102
322
  const CommonThemeColors = {
103
323
  properties: {
@@ -133,7 +353,7 @@ const HttpColors = {
133
353
  };
134
354
  const ResponseColors = {
135
355
  properties: {
136
- errors: 'CommonColorProps',
356
+ error: 'CommonColorProps',
137
357
  info: 'CommonColorProps',
138
358
  redirect: 'CommonColorProps',
139
359
  success: 'CommonColorProps',
@@ -205,11 +425,14 @@ const HttpBadgesConfig = {
205
425
  const LabelControls = {
206
426
  properties: {
207
427
  top: { type: 'string' },
428
+ width: { type: 'string' },
429
+ height: { type: 'string' },
208
430
  },
209
431
  };
210
432
  const Panels = {
211
433
  properties: {
212
434
  borderRadius: { type: 'string' },
435
+ backgroundColor: { type: 'string' },
213
436
  },
214
437
  };
215
438
  const TryItButton = {
@@ -242,6 +465,7 @@ const StackedConfig = {
242
465
  const ThreePanelConfig = {
243
466
  properties: {
244
467
  maxWidth: 'Breakpoints',
468
+ middlePanelMaxWidth: 'Breakpoints',
245
469
  },
246
470
  };
247
471
  const Layout = {
@@ -301,7 +525,18 @@ const Heading = {
301
525
  properties: Object.assign(Object.assign({}, FontConfig.properties), { color: { type: 'string' }, transform: { type: 'string' } }),
302
526
  };
303
527
  const CodeConfig = {
304
- properties: Object.assign(Object.assign({}, FontConfig.properties), { backgroundColor: { type: 'string' }, color: { type: 'string' }, wordBreak: { type: 'string' }, wrap: { type: 'boolean' } }),
528
+ properties: Object.assign(Object.assign({}, FontConfig.properties), { backgroundColor: { type: 'string' }, color: { type: 'string' }, wordBreak: {
529
+ enum: [
530
+ 'break-all',
531
+ 'break-word',
532
+ 'keep-all',
533
+ 'normal',
534
+ 'revert',
535
+ 'unset',
536
+ 'inherit',
537
+ 'initial',
538
+ ],
539
+ }, wrap: { type: 'boolean' } }),
305
540
  };
306
541
  const HeadingsConfig = {
307
542
  properties: utils_1.omitObjectProps(FontConfig.properties, ['fontSize']),
@@ -316,7 +551,7 @@ const LinksConfig = {
316
551
  },
317
552
  };
318
553
  const Typography = {
319
- properties: Object.assign(Object.assign({ code: 'CodeConfig', fieldName: 'FontConfig' }, utils_1.pickObjectProps(FontConfig.properties, ['fontSize', 'fontFamily'])), { fontWeightBold: { type: 'string' }, fontWeightLight: { type: 'string' }, fontWeightRegular: { type: 'string' }, heading1: 'Heading', heading2: 'Heading', heading3: 'Heading', headings: 'HeadingsConfig', lineHeight: { type: 'string' }, links: 'LinksConfig', optimizeSpeed: { type: 'boolean' }, rightPanelHeading: 'Heading', smoothing: { type: 'string' } }),
554
+ properties: Object.assign(Object.assign({ code: 'CodeConfig', fieldName: 'FontConfig' }, utils_1.pickObjectProps(FontConfig.properties, ['fontSize', 'fontFamily'])), { fontWeightBold: { type: 'string' }, fontWeightLight: { type: 'string' }, fontWeightRegular: { type: 'string' }, heading1: 'Heading', heading2: 'Heading', heading3: 'Heading', headings: 'HeadingsConfig', lineHeight: { type: 'string' }, links: 'LinksConfig', optimizeSpeed: { type: 'boolean' }, rightPanelHeading: 'Heading', smoothing: { enum: ['auto', 'none', 'antialiased', 'subpixel-antialiased', 'grayscale'] } }),
320
555
  };
321
556
  const TokenProps = {
322
557
  properties: Object.assign({ color: { type: 'string' } }, utils_1.omitObjectProps(FontConfig.properties, ['fontWeight'])),
@@ -335,6 +570,12 @@ const Logo = {
335
570
  maxWidth: { type: 'string' },
336
571
  },
337
572
  };
573
+ const Fab = {
574
+ properties: {
575
+ backgroundColor: { type: 'string' },
576
+ color: { type: 'string' },
577
+ },
578
+ };
338
579
  const ButtonOverrides = {
339
580
  properties: {
340
581
  custom: { type: 'string' },
@@ -374,6 +615,7 @@ const ConfigTheme = {
374
615
  components: 'Components',
375
616
  layout: 'Layout',
376
617
  logo: 'Logo',
618
+ fab: 'Fab',
377
619
  overrides: 'Overrides',
378
620
  rightPanel: 'RightPanel',
379
621
  schema: 'Schema',
@@ -382,7 +624,7 @@ const ConfigTheme = {
382
624
  spacing: 'ThemeSpacing',
383
625
  typography: 'Typography',
384
626
  links: { properties: { color: { type: 'string' } } },
385
- codeSample: { properties: { backgroundColor: { type: 'string' } } },
627
+ codeSample: { properties: { backgroundColor: { type: 'string' } } }, // deprecated
386
628
  },
387
629
  };
388
630
  const GenerateCodeSamples = {
@@ -390,6 +632,7 @@ const GenerateCodeSamples = {
390
632
  skipOptionalParameters: { type: 'boolean' },
391
633
  languages: _1.listOf('ConfigLanguage'),
392
634
  },
635
+ required: ['languages'],
393
636
  };
394
637
  const ConfigReferenceDocs = {
395
638
  properties: {
@@ -415,16 +658,25 @@ const ConfigReferenceDocs = {
415
658
  hideLoading: { type: 'boolean' },
416
659
  hideLogo: { type: 'boolean' },
417
660
  hideRequestPayloadSample: { type: 'boolean' },
661
+ hideRightPanel: { type: 'boolean' },
418
662
  hideSchemaPattern: { type: 'boolean' },
419
663
  hideSchemaTitles: { type: 'boolean' },
420
664
  hideSingleRequestSampleTab: { type: 'boolean' },
665
+ hideSecuritySection: { type: 'boolean' },
421
666
  hideTryItPanel: { type: 'boolean' },
422
667
  hideFab: { type: 'boolean' },
423
668
  hideOneOfDescription: { type: 'boolean' },
424
669
  htmlTemplate: { type: 'string' },
425
- jsonSampleExpandLevel: { type: 'string' },
670
+ jsonSampleExpandLevel: (value) => {
671
+ if (typeof value === 'number') {
672
+ return { type: 'number', minimum: 1 };
673
+ }
674
+ else {
675
+ return { type: 'string' };
676
+ }
677
+ },
426
678
  labels: 'ConfigLabels',
427
- layout: { type: 'string' },
679
+ layout: { enum: ['stacked', 'three-panel'] },
428
680
  maxDisplayedEnumValues: { type: 'number' },
429
681
  menuToggle: { type: 'boolean' },
430
682
  nativeScrollbars: { type: 'boolean' },
@@ -432,26 +684,55 @@ const ConfigReferenceDocs = {
432
684
  oAuth2RedirectURI: { type: 'string' },
433
685
  onDeepLinkClick: { type: 'object' },
434
686
  onlyRequiredInSamples: { type: 'boolean' },
435
- pagination: { type: 'string' },
687
+ pagination: { enum: ['none', 'section', 'item'] },
436
688
  pathInMiddlePanel: { type: 'boolean' },
437
- payloadSampleIdx: { type: 'number' },
689
+ payloadSampleIdx: { type: 'number', minimum: 0 },
438
690
  requestInterceptor: { type: 'object' },
439
691
  requiredPropsFirst: { type: 'boolean' },
440
692
  routingBasePath: { type: 'string' },
693
+ routingStrategy: { type: 'string' },
441
694
  samplesTabsMaxCount: { type: 'number' },
442
- schemaExpansionLevel: { type: 'string' },
695
+ schemaExpansionLevel: (value) => {
696
+ if (typeof value === 'number') {
697
+ return { type: 'number', minimum: 0 };
698
+ }
699
+ else {
700
+ return { type: 'string' };
701
+ }
702
+ },
443
703
  schemaDefinitionsTagName: { type: 'string' },
444
- minCharacterLengthToInitSearch: { type: 'number' },
445
- maxResponseHeadersToShowInTryIt: { type: 'number' },
446
- scrollYOffset: { type: 'string' },
704
+ minCharacterLengthToInitSearch: { type: 'number', minimum: 1 },
705
+ maxResponseHeadersToShowInTryIt: { type: 'number', minimum: 0 },
706
+ scrollYOffset: (value) => {
707
+ if (typeof value === 'number') {
708
+ return { type: 'number' };
709
+ }
710
+ else {
711
+ return { type: 'string' };
712
+ }
713
+ },
447
714
  searchAutoExpand: { type: 'boolean' },
448
- searchFieldLevelBoost: { type: 'number' },
449
- searchMode: { type: 'string' },
715
+ searchFieldLevelBoost: { type: 'number', minimum: 0 },
716
+ searchMaxDepth: { type: 'number', minimum: 1 },
717
+ searchMode: { enum: ['default', 'path-only'] },
450
718
  searchOperationTitleBoost: { type: 'number' },
451
719
  searchTagTitleBoost: { type: 'number' },
720
+ sendXUserAgentInTryIt: { type: 'boolean' },
452
721
  showChangeLayoutButton: { type: 'boolean' },
453
722
  showConsole: { type: 'boolean' },
454
- showExtensions: { type: 'boolean' },
723
+ showExtensions: (value) => {
724
+ if (typeof value === 'boolean') {
725
+ return { type: 'boolean' };
726
+ }
727
+ else {
728
+ return {
729
+ type: 'array',
730
+ items: {
731
+ type: 'string',
732
+ },
733
+ };
734
+ }
735
+ },
455
736
  showNextButton: { type: 'boolean' },
456
737
  showRightPanelToggle: { type: 'boolean' },
457
738
  showSecuritySchemeType: { type: 'boolean' },
@@ -459,12 +740,14 @@ const ConfigReferenceDocs = {
459
740
  showObjectSchemaExamples: { type: 'boolean' },
460
741
  disableTryItRequestUrlEncoding: { type: 'boolean' },
461
742
  sidebarLinks: 'ConfigSidebarLinks',
462
- sideNavStyle: { type: 'string' },
743
+ sideNavStyle: { enum: ['summary-only', 'path-first', 'id-only'] },
463
744
  simpleOneOfTypeLabel: { type: 'boolean' },
464
745
  sortEnumValuesAlphabetically: { type: 'boolean' },
465
746
  sortOperationsAlphabetically: { type: 'boolean' },
466
747
  sortPropsAlphabetically: { type: 'boolean' },
467
748
  sortTagsAlphabetically: { type: 'boolean' },
749
+ suppressWarnings: { type: 'boolean' },
750
+ unstable_externalDescription: { type: 'boolean' },
468
751
  unstable_ignoreMimeParameters: { type: 'boolean' },
469
752
  untrustedDefinition: { type: 'boolean' },
470
753
  },
@@ -477,6 +760,7 @@ const ConfigMockServer = {
477
760
  },
478
761
  };
479
762
  exports.ConfigTypes = {
763
+ Assert,
480
764
  ConfigRoot,
481
765
  ConfigApis,
482
766
  ConfigApisProperties,
@@ -488,7 +772,9 @@ exports.ConfigTypes = {
488
772
  ConfigLanguage,
489
773
  ConfigLabels,
490
774
  ConfigSidebarLinks,
775
+ CommonConfigSidebarLinks,
491
776
  ConfigTheme,
777
+ Context,
492
778
  ThemeColors,
493
779
  CommonThemeColors,
494
780
  BorderThemeColors,
@@ -519,9 +805,12 @@ exports.ConfigTypes = {
519
805
  TokenProps,
520
806
  CodeBlock,
521
807
  Logo,
808
+ Fab,
522
809
  ButtonOverrides,
523
810
  Overrides,
811
+ ObjectRule,
524
812
  RightPanel,
813
+ Rules,
525
814
  Shape,
526
815
  ThemeSpacing,
527
816
  GenerateCodeSamples,
package/lib/utils.d.ts CHANGED
@@ -13,7 +13,7 @@ export declare function pushStack<T, P extends Stack<T> = Stack<T>>(head: P, val
13
13
  };
14
14
  export declare function popStack<T, P extends Stack<T>>(head: P): StackFrame<T> | null;
15
15
  export declare type BundleOutputFormat = 'json' | 'yml' | 'yaml';
16
- export declare function loadYaml(filename: string): Promise<unknown>;
16
+ export declare function loadYaml<T>(filename: string): Promise<T>;
17
17
  export declare function notUndefined<T>(x: T | undefined): x is T;
18
18
  export declare function isPlainObject(value: any): value is object;
19
19
  export declare function isEmptyObject(value: any): value is object;
@@ -39,3 +39,4 @@ export declare function isString(value: unknown): value is string;
39
39
  export declare function isNotString<T>(value: string | T): value is T;
40
40
  export declare function assignExisting<T>(target: Record<string, T>, obj: Record<string, T>): void;
41
41
  export declare const getMatchingStatusCodeRange: (code: number | string) => string;
42
+ export declare function isCustomRuleId(id: string): boolean;
package/lib/utils.js CHANGED
@@ -9,7 +9,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
9
9
  });
10
10
  };
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
- exports.getMatchingStatusCodeRange = exports.assignExisting = exports.isNotString = exports.isString = exports.isNotEmptyObject = exports.slash = exports.isPathParameter = exports.readFileAsStringSync = exports.isSingular = exports.validateMimeTypeOAS3 = exports.validateMimeType = exports.splitCamelCaseIntoWords = exports.omitObjectProps = exports.pickObjectProps = exports.readFileFromUrl = exports.isEmptyArray = exports.isEmptyObject = exports.isPlainObject = exports.notUndefined = exports.loadYaml = exports.popStack = exports.pushStack = exports.stringifyYaml = exports.parseYaml = void 0;
12
+ exports.isCustomRuleId = exports.getMatchingStatusCodeRange = exports.assignExisting = exports.isNotString = exports.isString = exports.isNotEmptyObject = exports.slash = exports.isPathParameter = exports.readFileAsStringSync = exports.isSingular = exports.validateMimeTypeOAS3 = exports.validateMimeType = exports.splitCamelCaseIntoWords = exports.omitObjectProps = exports.pickObjectProps = exports.readFileFromUrl = exports.isEmptyArray = exports.isEmptyObject = exports.isPlainObject = exports.notUndefined = exports.loadYaml = exports.popStack = exports.pushStack = exports.stringifyYaml = exports.parseYaml = void 0;
13
13
  const fs = require("fs");
14
14
  const minimatch = require("minimatch");
15
15
  const node_fetch_1 = require("node-fetch");
@@ -175,3 +175,7 @@ function assignExisting(target, obj) {
175
175
  exports.assignExisting = assignExisting;
176
176
  const getMatchingStatusCodeRange = (code) => `${code}`.replace(/^(\d)\d\d$/, (_, firstDigit) => `${firstDigit}XX`);
177
177
  exports.getMatchingStatusCodeRange = getMatchingStatusCodeRange;
178
+ function isCustomRuleId(id) {
179
+ return id.includes('/');
180
+ }
181
+ exports.isCustomRuleId = isCustomRuleId;
package/lib/walk.d.ts CHANGED
@@ -24,6 +24,8 @@ export declare type ResolveFn<T> = (node: Referenced<T>, from?: string) => {
24
24
  export declare type UserContext = {
25
25
  report(problem: Problem): void;
26
26
  location: Location;
27
+ rawNode: any;
28
+ rawLocation: Location;
27
29
  resolve<T>(node: Referenced<T>): {
28
30
  location: Location;
29
31
  node: T;
package/lib/walk.js CHANGED
@@ -32,6 +32,7 @@ function walkDocument(opts) {
32
32
  walkNode(document.parsed, rootType, new ref_utils_1.Location(document.source, '#/'), undefined, '');
33
33
  function walkNode(node, type, location, parent, key) {
34
34
  var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
35
+ const rawLocation = location;
35
36
  let currentLocation = location;
36
37
  const { node: resolvedNode, location: resolvedLocation, error } = resolve(node);
37
38
  const enteredContexts = new Set();
@@ -44,13 +45,15 @@ function walkDocument(opts) {
44
45
  visitor(node, {
45
46
  report,
46
47
  resolve,
48
+ rawNode: node,
49
+ rawLocation,
47
50
  location,
48
51
  type,
49
52
  parent,
50
53
  key,
51
54
  parentLocations: {},
52
55
  oasVersion: ctx.oasVersion,
53
- getVisitorData: getVisitorDataFn.bind(undefined, ruleId)
56
+ getVisitorData: getVisitorDataFn.bind(undefined, ruleId),
54
57
  }, { node: resolvedNode, location: resolvedLocation, error });
55
58
  if ((resolvedLocation === null || resolvedLocation === void 0 ? void 0 : resolvedLocation.source.absoluteRef) && ctx.refTypes) {
56
59
  ctx.refTypes.set(resolvedLocation === null || resolvedLocation === void 0 ? void 0 : resolvedLocation.source.absoluteRef, type);
@@ -101,7 +104,7 @@ function walkDocument(opts) {
101
104
  if (!activatedOn.skipped) {
102
105
  visitedBySome = true;
103
106
  enteredContexts.add(context);
104
- const { ignoreNextVisitorsOnNode } = visitWithContext(visit, resolvedNode, context, ruleId, severity);
107
+ const { ignoreNextVisitorsOnNode } = visitWithContext(visit, resolvedNode, node, context, ruleId, severity);
105
108
  if (ignoreNextVisitorsOnNode)
106
109
  break;
107
110
  }
@@ -173,7 +176,7 @@ function walkDocument(opts) {
173
176
  }
174
177
  for (const { context, visit, ruleId, severity } of currentLeaveVisitors) {
175
178
  if (!context.isSkippedLevel && enteredContexts.has(context)) {
176
- visitWithContext(visit, resolvedNode, context, ruleId, severity);
179
+ visitWithContext(visit, resolvedNode, node, context, ruleId, severity);
177
180
  }
178
181
  }
179
182
  }
@@ -186,31 +189,37 @@ function walkDocument(opts) {
186
189
  visitor(node, {
187
190
  report,
188
191
  resolve,
192
+ rawNode: node,
193
+ rawLocation,
189
194
  location,
190
195
  type,
191
196
  parent,
192
197
  key,
193
198
  parentLocations: {},
194
199
  oasVersion: ctx.oasVersion,
195
- getVisitorData: getVisitorDataFn.bind(undefined, ruleId)
200
+ getVisitorData: getVisitorDataFn.bind(undefined, ruleId),
196
201
  }, { node: resolvedNode, location: resolvedLocation, error });
197
202
  }
198
203
  }
199
204
  }
200
205
  // returns true ignores all the next visitors on the specific node
201
- function visitWithContext(visit, node, context, ruleId, severity) {
206
+ function visitWithContext(visit, resolvedNode, node, context, ruleId, severity) {
202
207
  const report = reportFn.bind(undefined, ruleId, severity);
203
208
  let ignoreNextVisitorsOnNode = false;
204
- visit(node, {
209
+ visit(resolvedNode, {
205
210
  report,
206
211
  resolve,
212
+ rawNode: node,
207
213
  location: currentLocation,
214
+ rawLocation,
208
215
  type,
209
216
  parent,
210
217
  key,
211
218
  parentLocations: collectParentsLocations(context),
212
219
  oasVersion: ctx.oasVersion,
213
- ignoreNextVisitorsOnNode: () => { ignoreNextVisitorsOnNode = true; },
220
+ ignoreNextVisitorsOnNode: () => {
221
+ ignoreNextVisitorsOnNode = true;
222
+ },
214
223
  getVisitorData: getVisitorDataFn.bind(undefined, ruleId),
215
224
  }, collectParents(context), context);
216
225
  return { ignoreNextVisitorsOnNode };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@redocly/openapi-core",
3
- "version": "1.0.0-beta.102",
3
+ "version": "1.0.0-beta.103",
4
4
  "description": "",
5
5
  "main": "lib/index.js",
6
6
  "engines": {