@redocly/openapi-core 1.0.0-beta.78 → 1.0.0-beta.82

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 (99) hide show
  1. package/__tests__/utils.ts +11 -1
  2. package/lib/bundle.js +18 -7
  3. package/lib/config/builtIn.js +18 -4
  4. package/lib/{rules → decorators}/common/info-description-override.d.ts +0 -0
  5. package/lib/{rules → decorators}/common/info-description-override.js +0 -0
  6. package/lib/{rules → decorators}/common/operation-description-override.d.ts +0 -0
  7. package/lib/{rules → decorators}/common/operation-description-override.js +0 -0
  8. package/lib/{rules → decorators}/common/registry-dependencies.d.ts +0 -0
  9. package/lib/{rules → decorators}/common/registry-dependencies.js +0 -0
  10. package/lib/{rules → decorators}/common/remove-x-internal.d.ts +0 -0
  11. package/lib/{rules → decorators}/common/remove-x-internal.js +20 -2
  12. package/lib/{rules → decorators}/common/tag-description-override.d.ts +0 -0
  13. package/lib/{rules → decorators}/common/tag-description-override.js +0 -0
  14. package/lib/decorators/oas2/index.d.ts +8 -0
  15. package/lib/decorators/oas2/index.js +15 -0
  16. package/lib/decorators/oas3/index.d.ts +8 -0
  17. package/lib/decorators/oas3/index.js +15 -0
  18. package/lib/js-yaml/index.js +1 -1
  19. package/lib/resolve.d.ts +1 -0
  20. package/lib/resolve.js +7 -3
  21. package/lib/rules/common/operation-security-defined.js +1 -4
  22. package/lib/rules/common/spec.js +18 -3
  23. package/lib/rules/oas2/index.d.ts +1 -8
  24. package/lib/rules/oas2/index.js +1 -13
  25. package/lib/rules/oas2/remove-unused-components.js +11 -9
  26. package/lib/rules/oas3/index.d.ts +0 -8
  27. package/lib/rules/oas3/index.js +1 -13
  28. package/lib/rules/oas3/no-invalid-media-type-examples.js +12 -11
  29. package/lib/rules/oas3/remove-unused-components.js +11 -9
  30. package/lib/types/index.d.ts +4 -0
  31. package/lib/types/oas2.js +42 -35
  32. package/lib/types/oas3.js +68 -139
  33. package/lib/types/oas3_1.js +52 -49
  34. package/lib/utils.js +1 -1
  35. package/lib/walk.js +1 -1
  36. package/package.json +1 -1
  37. package/src/__tests__/js-yaml.test.ts +29 -5
  38. package/src/__tests__/lint.test.ts +1 -3
  39. package/src/bundle.ts +21 -8
  40. package/src/config/builtIn.ts +20 -7
  41. package/src/{rules/__tests__/hide-internals.test.ts → decorators/__tests__/remove-x-internal.test.ts} +124 -42
  42. package/src/{rules → decorators}/common/info-description-override.ts +0 -0
  43. package/src/{rules → decorators}/common/operation-description-override.ts +0 -0
  44. package/src/{rules → decorators}/common/registry-dependencies.ts +0 -0
  45. package/src/{rules → decorators}/common/remove-x-internal.ts +20 -3
  46. package/src/{rules → decorators}/common/tag-description-override.ts +0 -0
  47. package/src/decorators/oas2/index.ts +14 -0
  48. package/src/decorators/oas3/index.ts +14 -0
  49. package/src/js-yaml/index.ts +1 -2
  50. package/src/redocly/registry-api.ts +4 -1
  51. package/src/resolve.ts +6 -6
  52. package/src/rules/__tests__/no-unresolved-refs.test.ts +1 -4
  53. package/src/rules/common/__tests__/info-description.test.ts +1 -3
  54. package/src/rules/common/__tests__/info-license.test.ts +1 -2
  55. package/src/rules/common/__tests__/license-url.test.ts +1 -2
  56. package/src/rules/common/__tests__/no-ambiguous-paths.test.ts +1 -2
  57. package/src/rules/common/__tests__/no-enum-type-mismatch.test.ts +1 -2
  58. package/src/rules/common/__tests__/no-identical-paths.test.ts +1 -2
  59. package/src/rules/common/__tests__/no-path-trailing-slash.test.ts +1 -2
  60. package/src/rules/common/__tests__/operation-2xx-response.test.ts +1 -2
  61. package/src/rules/common/__tests__/operation-4xx-response.test.ts +1 -2
  62. package/src/rules/common/__tests__/operation-operationId-unique.test.ts +1 -2
  63. package/src/rules/common/__tests__/operation-operationId-url-safe.test.ts +1 -2
  64. package/src/rules/common/__tests__/operation-parameters-unique.test.ts +1 -2
  65. package/src/rules/common/__tests__/operation-security-defined.test.ts +1 -2
  66. package/src/rules/common/__tests__/operation-singular-tag.test.ts +1 -2
  67. package/src/rules/common/__tests__/path-http-verbs-order.test.ts +1 -2
  68. package/src/rules/common/__tests__/path-not-include-query.test.ts +1 -2
  69. package/src/rules/common/__tests__/path-params-defined.test.ts +1 -2
  70. package/src/rules/common/__tests__/paths-kebab-case.test.ts +1 -2
  71. package/src/rules/common/__tests__/tag-description.test.ts +1 -2
  72. package/src/rules/common/__tests__/tags-alphabetical.test.ts +1 -2
  73. package/src/rules/common/operation-security-defined.ts +4 -5
  74. package/src/rules/common/spec.ts +18 -0
  75. package/src/rules/oas2/__tests__/boolean-parameter-prefixes.test.ts +1 -2
  76. package/src/rules/oas2/__tests__/spec/referenceableScalars.test.ts +1 -2
  77. package/src/rules/oas2/index.ts +1 -13
  78. package/src/rules/oas2/remove-unused-components.ts +12 -10
  79. package/src/rules/oas3/__tests__/boolean-parameter-prefixes.test.ts +1 -2
  80. package/src/rules/oas3/__tests__/no-empty-enum-servers.com.test.ts +1 -2
  81. package/src/rules/oas3/__tests__/no-example-value-and-externalValue.test.ts +1 -2
  82. package/src/rules/oas3/__tests__/no-invalid-media-type-examples.test.ts +1 -2
  83. package/src/rules/oas3/__tests__/no-server-example.com.test.ts +1 -2
  84. package/src/rules/oas3/__tests__/no-server-trailing-slash.test.ts +1 -2
  85. package/src/rules/oas3/__tests__/no-unused-components.test.ts +1 -2
  86. package/src/rules/oas3/index.ts +0 -14
  87. package/src/rules/oas3/no-invalid-media-type-examples.ts +17 -21
  88. package/src/rules/oas3/remove-unused-components.ts +12 -10
  89. package/src/types/index.ts +4 -0
  90. package/src/types/oas2.ts +42 -40
  91. package/src/types/oas3.ts +68 -141
  92. package/src/types/oas3_1.ts +51 -50
  93. package/src/utils.ts +1 -1
  94. package/src/walk.ts +2 -4
  95. package/tsconfig.tsbuildinfo +1 -1
  96. package/lib/rules/builtin.d.ts +0 -22
  97. package/lib/rules/builtin.js +0 -17
  98. package/src/rules/__tests__/config.ts +0 -11
  99. package/src/rules/builtin.ts +0 -18
package/lib/types/oas2.js CHANGED
@@ -68,9 +68,7 @@ const PathItem = {
68
68
  const Operation = {
69
69
  properties: {
70
70
  tags: { type: 'array', items: { type: 'string' } },
71
- summary: {
72
- type: 'string',
73
- },
71
+ summary: { type: 'string' },
74
72
  description: { type: 'string' },
75
73
  externalDocs: 'ExternalDocs',
76
74
  operationId: { type: 'string' },
@@ -180,9 +178,7 @@ const ResponsesMap = {
180
178
  };
181
179
  const Response = {
182
180
  properties: {
183
- description: {
184
- type: 'string',
185
- },
181
+ description: { type: 'string' },
186
182
  schema: 'Schema',
187
183
  headers: _1.mapOf('Header'),
188
184
  examples: 'Examples',
@@ -299,44 +295,55 @@ const SecurityScheme = {
299
295
  type: { enum: ['basic', 'apiKey', 'oauth2'] },
300
296
  description: { type: 'string' },
301
297
  name: { type: 'string' },
302
- in: { type: 'string', enum: ['query', 'header', 'cookie'] },
298
+ in: { type: 'string', enum: ['query', 'header'] },
303
299
  flow: { enum: ['implicit', 'password', 'application', 'accessCode'] },
304
300
  authorizationUrl: { type: 'string' },
305
301
  tokenUrl: { type: 'string' },
306
302
  scopes: { type: 'object', additionalProperties: { type: 'string' } },
307
303
  },
308
304
  required(value) {
309
- if (!(value === null || value === void 0 ? void 0 : value.type)) {
310
- return ['type'];
311
- }
312
- if (value.type === 'apiKey') {
313
- return ['type', 'name', 'in'];
314
- }
315
- else if (value.type === 'http') {
316
- return ['type', 'scheme'];
305
+ switch (value === null || value === void 0 ? void 0 : value.type) {
306
+ case 'apiKey':
307
+ return ['type', 'name', 'in'];
308
+ case 'oauth2':
309
+ switch (value === null || value === void 0 ? void 0 : value.flow) {
310
+ case 'implicit':
311
+ return ['type', 'flow', 'authorizationUrl', 'scopes'];
312
+ case 'accessCode':
313
+ return ['type', 'flow', 'authorizationUrl', 'tokenUrl', 'scopes'];
314
+ case 'application':
315
+ case 'password':
316
+ return ['type', 'flow', 'tokenUrl', 'scopes'];
317
+ default:
318
+ return ['type', 'flow', 'scopes'];
319
+ }
320
+ default:
321
+ return ['type'];
317
322
  }
318
- else if (value.type === 'oauth2') {
319
- if (!(value === null || value === void 0 ? void 0 : value.flow)) {
320
- return ['type', 'flow'];
321
- }
322
- else if (value.flow === 'implicit') {
323
- return ['type', 'flow', 'authorizationUrl'];
324
- }
325
- else if (value.flow === 'accessCode') {
326
- return ['type', 'flow', 'authorizationUrl', 'tokenUrl'];
327
- }
328
- else if (value.flow === 'application') {
329
- return ['type', 'flow', 'tokenUrl'];
330
- }
331
- else if (value.flow === 'password') {
332
- return ['type', 'flow', 'tokenUrl'];
333
- }
334
- else {
335
- return ['type', 'flow'];
336
- }
323
+ },
324
+ allowed(value) {
325
+ switch (value === null || value === void 0 ? void 0 : value.type) {
326
+ case 'basic':
327
+ return ['type', 'description'];
328
+ case 'apiKey':
329
+ return ['type', 'name', 'in', 'description'];
330
+ case 'oauth2':
331
+ switch (value === null || value === void 0 ? void 0 : value.flow) {
332
+ case 'implicit':
333
+ return ['type', 'flow', 'authorizationUrl', 'description', 'scopes'];
334
+ case 'accessCode':
335
+ return ['type', 'flow', 'authorizationUrl', 'tokenUrl', 'description', 'scopes'];
336
+ case 'application':
337
+ case 'password':
338
+ return ['type', 'flow', 'tokenUrl', 'description', 'scopes'];
339
+ default:
340
+ return ['type', 'flow', 'tokenUrl', 'authorizationUrl', 'description', 'scopes'];
341
+ }
342
+ default:
343
+ return ['type', 'description'];
337
344
  }
338
- return ['type'];
339
345
  },
346
+ extensionsPrefix: 'x-',
340
347
  };
341
348
  const SecurityRequirement = {
342
349
  properties: {},
package/lib/types/oas3.js CHANGED
@@ -28,23 +28,15 @@ const Tag = {
28
28
  };
29
29
  const ExternalDocs = {
30
30
  properties: {
31
- description: {
32
- type: 'string',
33
- },
34
- url: {
35
- type: 'string',
36
- },
31
+ description: { type: 'string' },
32
+ url: { type: 'string' },
37
33
  },
38
34
  required: ['url'],
39
35
  };
40
36
  const Server = {
41
37
  properties: {
42
- url: {
43
- type: 'string',
44
- },
45
- description: {
46
- type: 'string',
47
- },
38
+ url: { type: 'string' },
39
+ description: { type: 'string' },
48
40
  variables: _1.mapOf('ServerVariable'),
49
41
  },
50
42
  required: ['url'],
@@ -55,9 +47,7 @@ const ServerVariable = {
55
47
  type: 'array',
56
48
  items: { type: 'string' },
57
49
  },
58
- default: {
59
- type: 'string',
60
- },
50
+ default: { type: 'string' },
61
51
  description: null,
62
52
  },
63
53
  required: ['default'],
@@ -68,18 +58,10 @@ const SecurityRequirement = {
68
58
  };
69
59
  const Info = {
70
60
  properties: {
71
- title: {
72
- type: 'string',
73
- },
74
- version: {
75
- type: 'string',
76
- },
77
- description: {
78
- type: 'string',
79
- },
80
- termsOfService: {
81
- type: 'string',
82
- },
61
+ title: { type: 'string' },
62
+ version: { type: 'string' },
63
+ description: { type: 'string' },
64
+ termsOfService: { type: 'string' },
83
65
  contact: 'Contact',
84
66
  license: 'License',
85
67
  },
@@ -87,25 +69,15 @@ const Info = {
87
69
  };
88
70
  const Contact = {
89
71
  properties: {
90
- name: {
91
- type: 'string',
92
- },
93
- url: {
94
- type: 'string',
95
- },
96
- email: {
97
- type: 'string',
98
- },
72
+ name: { type: 'string' },
73
+ url: { type: 'string' },
74
+ email: { type: 'string' },
99
75
  },
100
76
  };
101
77
  const License = {
102
78
  properties: {
103
- name: {
104
- type: 'string',
105
- },
106
- url: {
107
- type: 'string',
108
- },
79
+ name: { type: 'string' },
80
+ url: { type: 'string' },
109
81
  },
110
82
  required: ['name'],
111
83
  };
@@ -122,12 +94,8 @@ const PathItem = {
122
94
  $ref: { type: 'string' },
123
95
  servers: _1.listOf('Server'),
124
96
  parameters: _1.listOf('Parameter'),
125
- summary: {
126
- type: 'string',
127
- },
128
- description: {
129
- type: 'string',
130
- },
97
+ summary: { type: 'string' },
98
+ description: { type: 'string' },
131
99
  get: 'Operation',
132
100
  put: 'Operation',
133
101
  post: 'Operation',
@@ -140,33 +108,17 @@ const PathItem = {
140
108
  };
141
109
  const Parameter = {
142
110
  properties: {
143
- name: {
144
- type: 'string',
145
- },
146
- in: {
147
- enum: ['query', 'header', 'path', 'cookie'],
148
- },
149
- description: {
150
- type: 'string',
151
- },
152
- required: {
153
- type: 'boolean',
154
- },
155
- deprecated: {
156
- type: 'boolean',
157
- },
158
- allowEmptyValue: {
159
- type: 'boolean',
160
- },
111
+ name: { type: 'string' },
112
+ in: { enum: ['query', 'header', 'path', 'cookie'] },
113
+ description: { type: 'string' },
114
+ required: { type: 'boolean' },
115
+ deprecated: { type: 'boolean' },
116
+ allowEmptyValue: { type: 'boolean' },
161
117
  style: {
162
118
  enum: ['form', 'simple', 'label', 'matrix', 'spaceDelimited', 'pipeDelimited', 'deepObject'],
163
119
  },
164
- explode: {
165
- type: 'boolean',
166
- },
167
- allowReserved: {
168
- type: 'boolean',
169
- },
120
+ explode: { type: 'boolean' },
121
+ allowReserved: { type: 'boolean' },
170
122
  schema: 'Schema',
171
123
  example: { isExample: true },
172
124
  examples: _1.mapOf('Example'),
@@ -193,9 +145,7 @@ const Operation = {
193
145
  servers: _1.listOf('Server'),
194
146
  requestBody: 'RequestBody',
195
147
  responses: 'ResponsesMap',
196
- deprecated: {
197
- type: 'boolean',
198
- },
148
+ deprecated: { type: 'boolean' },
199
149
  callbacks: _1.mapOf('Callback'),
200
150
  'x-codeSamples': _1.listOf('XCodeSample'),
201
151
  'x-code-samples': _1.listOf('XCodeSample'), // deprecated
@@ -211,12 +161,8 @@ const XCodeSample = {
211
161
  };
212
162
  const RequestBody = {
213
163
  properties: {
214
- description: {
215
- type: 'string',
216
- },
217
- required: {
218
- type: 'boolean',
219
- },
164
+ description: { type: 'string' },
165
+ required: { type: 'boolean' },
220
166
  content: 'MediaTypeMap',
221
167
  },
222
168
  required: ['content'],
@@ -236,57 +182,33 @@ const MediaType = {
236
182
  const Example = {
237
183
  properties: {
238
184
  value: { isExample: true },
239
- summary: {
240
- type: 'string',
241
- },
242
- description: {
243
- type: 'string',
244
- },
245
- externalValue: {
246
- type: 'string',
247
- },
185
+ summary: { type: 'string' },
186
+ description: { type: 'string' },
187
+ externalValue: { type: 'string' },
248
188
  },
249
189
  };
250
190
  const Encoding = {
251
191
  properties: {
252
- contentType: {
253
- type: 'string',
254
- },
192
+ contentType: { type: 'string' },
255
193
  headers: _1.mapOf('Header'),
256
194
  style: {
257
195
  enum: ['form', 'simple', 'label', 'matrix', 'spaceDelimited', 'pipeDelimited', 'deepObject'],
258
196
  },
259
- explode: {
260
- type: 'boolean',
261
- },
262
- allowReserved: {
263
- type: 'boolean',
264
- },
197
+ explode: { type: 'boolean' },
198
+ allowReserved: { type: 'boolean' },
265
199
  },
266
200
  };
267
201
  const Header = {
268
202
  properties: {
269
- description: {
270
- type: 'string',
271
- },
272
- required: {
273
- type: 'boolean',
274
- },
275
- deprecated: {
276
- type: 'boolean',
277
- },
278
- allowEmptyValue: {
279
- type: 'boolean',
280
- },
203
+ description: { type: 'string' },
204
+ required: { type: 'boolean' },
205
+ deprecated: { type: 'boolean' },
206
+ allowEmptyValue: { type: 'boolean' },
281
207
  style: {
282
208
  enum: ['form', 'simple', 'label', 'matrix', 'spaceDelimited', 'pipeDelimited', 'deepObject'],
283
209
  },
284
- explode: {
285
- type: 'boolean',
286
- },
287
- allowReserved: {
288
- type: 'boolean',
289
- },
210
+ explode: { type: 'boolean' },
211
+ allowReserved: { type: 'boolean' },
290
212
  schema: 'Schema',
291
213
  example: { isExample: true },
292
214
  examples: _1.mapOf('Example'),
@@ -294,16 +216,12 @@ const Header = {
294
216
  },
295
217
  };
296
218
  const ResponsesMap = {
297
- properties: {
298
- default: 'Response',
299
- },
219
+ properties: { default: 'Response' },
300
220
  additionalProperties: (_v, key) => responseCodeRegexp.test(key) ? 'Response' : undefined,
301
221
  };
302
222
  const Response = {
303
223
  properties: {
304
- description: {
305
- type: 'string',
306
- },
224
+ description: { type: 'string' },
307
225
  headers: _1.mapOf('Header'),
308
226
  content: 'MediaTypeMap',
309
227
  links: _1.mapOf('Link'),
@@ -425,7 +343,7 @@ const ImplicitFlow = {
425
343
  scopes: { type: 'object', additionalProperties: { type: 'string' } },
426
344
  authorizationUrl: { type: 'string' },
427
345
  },
428
- required: ['authorizationUrl', 'scopes'],
346
+ required: ['authorizationUrl', 'scopes']
429
347
  };
430
348
  const PasswordFlow = {
431
349
  properties: {
@@ -465,30 +383,41 @@ const SecurityScheme = {
465
383
  type: { enum: ['apiKey', 'http', 'oauth2', 'openIdConnect'] },
466
384
  description: { type: 'string' },
467
385
  name: { type: 'string' },
468
- in: { type: 'string' },
386
+ in: { type: 'string', enum: ['query', 'header', 'cookie'] },
469
387
  scheme: { type: 'string' },
470
388
  bearerFormat: { type: 'string' },
471
389
  flows: 'SecuritySchemeFlows',
472
390
  openIdConnectUrl: { type: 'string' },
473
391
  },
474
392
  required(value) {
475
- if (!(value === null || value === void 0 ? void 0 : value.type)) {
476
- return ['type'];
393
+ switch (value === null || value === void 0 ? void 0 : value.type) {
394
+ case 'apiKey':
395
+ return ['type', 'name', 'in'];
396
+ case 'http':
397
+ return ['type', 'scheme'];
398
+ case 'oauth2':
399
+ return ['type', 'flows'];
400
+ case 'openIdConnect':
401
+ return ['type', 'openIdConnectUrl'];
402
+ default:
403
+ return ['type'];
477
404
  }
478
- if (value.type === 'apiKey') {
479
- return ['type', 'name', 'in'];
480
- }
481
- else if (value.type === 'http') {
482
- return ['type', 'scheme'];
483
- }
484
- else if (value.type === 'oauth2') {
485
- return ['type', 'flows'];
486
- }
487
- else if (value.type === 'openIdConnect') {
488
- return ['type', 'openIdConnectUrl'];
405
+ },
406
+ allowed(value) {
407
+ switch (value === null || value === void 0 ? void 0 : value.type) {
408
+ case 'apiKey':
409
+ return ['type', 'name', 'in', 'description'];
410
+ case 'http':
411
+ return ['type', 'scheme', 'bearerFormat', 'description'];
412
+ case 'oauth2':
413
+ return ['type', 'flows', 'description'];
414
+ case 'openIdConnect':
415
+ return ['type', 'openIdConnectUrl', 'description'];
416
+ default:
417
+ return ['type', 'description'];
489
418
  }
490
- return ['type'];
491
419
  },
420
+ extensionsPrefix: 'x-',
492
421
  };
493
422
  exports.Oas3Types = {
494
423
  DefinitionRoot,
@@ -21,35 +21,19 @@ const DefinitionRoot = {
21
21
  };
22
22
  const License = {
23
23
  properties: {
24
- name: {
25
- type: 'string',
26
- },
27
- url: {
28
- type: 'string',
29
- },
30
- identifier: {
31
- type: 'string',
32
- },
24
+ name: { type: 'string' },
25
+ url: { type: 'string' },
26
+ identifier: { type: 'string' },
33
27
  },
34
28
  required: ['name'],
35
29
  };
36
30
  const Info = {
37
31
  properties: {
38
- title: {
39
- type: 'string',
40
- },
41
- version: {
42
- type: 'string',
43
- },
44
- description: {
45
- type: 'string',
46
- },
47
- termsOfService: {
48
- type: 'string',
49
- },
50
- summary: {
51
- type: 'string',
52
- },
32
+ title: { type: 'string' },
33
+ version: { type: 'string' },
34
+ description: { type: 'string' },
35
+ termsOfService: { type: 'string' },
36
+ summary: { type: 'string' },
53
37
  contact: 'Contact',
54
38
  license: 'License',
55
39
  },
@@ -84,9 +68,7 @@ const Operation = {
84
68
  servers: _1.listOf('Server'),
85
69
  requestBody: 'RequestBody',
86
70
  responses: 'ResponsesMap',
87
- deprecated: {
88
- type: 'boolean',
89
- },
71
+ deprecated: { type: 'boolean' },
90
72
  callbacks: _1.mapOf('Callback'),
91
73
  'x-codeSamples': _1.listOf('XCodeSample'),
92
74
  'x-code-samples': _1.listOf('XCodeSample'), // deprecated
@@ -137,7 +119,7 @@ const Schema = {
137
119
  then: 'Schema',
138
120
  else: 'Schema',
139
121
  dependentSchemas: _1.listOf('Schema'),
140
- prefixItems: { type: 'array' },
122
+ prefixItems: _1.listOf('Schema'),
141
123
  contains: 'Schema',
142
124
  patternProperties: { type: 'object' },
143
125
  propertyNames: 'Schema',
@@ -149,18 +131,16 @@ const Schema = {
149
131
  if (Array.isArray(value)) {
150
132
  return _1.listOf('Schema');
151
133
  }
152
- else {
153
- return 'Schema';
154
- }
155
- },
156
- additionalProperties: (value) => {
157
- if (typeof value === 'boolean') {
134
+ else if (typeof value === 'boolean') {
158
135
  return { type: 'boolean' };
159
136
  }
160
137
  else {
161
138
  return 'Schema';
162
139
  }
163
140
  },
141
+ additionalProperties: (value) => {
142
+ return typeof value === 'boolean' ? { type: 'boolean' } : 'Schema';
143
+ },
164
144
  description: { type: 'string' },
165
145
  format: { type: 'string' },
166
146
  contentEncoding: { type: 'string' },
@@ -181,30 +161,53 @@ const SecurityScheme = {
181
161
  type: { enum: ['apiKey', 'http', 'oauth2', 'openIdConnect', 'mutualTLS'] },
182
162
  description: { type: 'string' },
183
163
  name: { type: 'string' },
184
- in: { type: 'string' },
164
+ in: { type: 'string', enum: ['query', 'header', 'cookie'] },
185
165
  scheme: { type: 'string' },
186
166
  bearerFormat: { type: 'string' },
187
167
  flows: 'SecuritySchemeFlows',
188
168
  openIdConnectUrl: { type: 'string' },
189
169
  },
190
170
  required(value) {
191
- if (!(value === null || value === void 0 ? void 0 : value.type)) {
192
- return ['type'];
193
- }
194
- if (value.type === 'apiKey') {
195
- return ['type', 'name', 'in'];
171
+ switch (value === null || value === void 0 ? void 0 : value.type) {
172
+ case 'apiKey':
173
+ return ['type', 'name', 'in'];
174
+ case 'http':
175
+ return ['type', 'scheme'];
176
+ case 'oauth2':
177
+ return ['type', 'flows'];
178
+ case 'openIdConnect':
179
+ return ['type', 'openIdConnectUrl'];
180
+ default:
181
+ return ['type'];
196
182
  }
197
- else if (value.type === 'http') {
198
- return ['type', 'scheme'];
199
- }
200
- else if (value.type === 'oauth2') {
201
- return ['type', 'flows'];
202
- }
203
- else if (value.type === 'openIdConnect') {
204
- return ['type', 'openIdConnectUrl'];
183
+ },
184
+ allowed(value) {
185
+ switch (value === null || value === void 0 ? void 0 : value.type) {
186
+ case 'apiKey':
187
+ return ['type', 'name', 'in', 'description'];
188
+ case 'http':
189
+ return ['type', 'scheme', 'bearerFormat', 'description'];
190
+ case 'oauth2':
191
+ switch (value === null || value === void 0 ? void 0 : value.flows) {
192
+ case 'implicit':
193
+ return ['type', 'flows', 'authorizationUrl', 'refreshUrl', 'description', 'scopes'];
194
+ case 'password':
195
+ case 'clientCredentials':
196
+ return ['type', 'flows', 'tokenUrl', 'refreshUrl', 'description', 'scopes'];
197
+ case 'authorizationCode':
198
+ return ['type', 'flows', 'authorizationUrl', 'refreshUrl', 'tokenUrl', 'description', 'scopes'];
199
+ default:
200
+ return ['type', 'flows', 'authorizationUrl', 'refreshUrl', 'tokenUrl', 'description', 'scopes'];
201
+ }
202
+ case 'openIdConnect':
203
+ return ['type', 'openIdConnectUrl', 'description'];
204
+ case 'mutualTLS':
205
+ return ['type', 'description'];
206
+ default:
207
+ return ['type', 'description'];
205
208
  }
206
- return ['type'];
207
209
  },
210
+ extensionsPrefix: 'x-',
208
211
  };
209
212
  exports.Oas3_1Types = Object.assign(Object.assign({}, oas3_1.Oas3Types), { Info,
210
213
  DefinitionRoot,
package/lib/utils.js CHANGED
@@ -138,7 +138,7 @@ function readFileAsStringSync(filePath) {
138
138
  }
139
139
  exports.readFileAsStringSync = readFileAsStringSync;
140
140
  function isPathParameter(pathSegment) {
141
- return pathSegment.startsWith('{') && pathSegment.endsWith('{');
141
+ return pathSegment.startsWith('{') && pathSegment.endsWith('}');
142
142
  }
143
143
  exports.isPathParameter = isPathParameter;
144
144
  /**
package/lib/walk.js CHANGED
@@ -218,7 +218,7 @@ function walkDocument(opts) {
218
218
  function resolve(ref, from = currentLocation.source.absoluteRef) {
219
219
  if (!ref_utils_1.isRef(ref))
220
220
  return { location, node: ref };
221
- const refId = from + '::' + ref.$ref;
221
+ const refId = resolve_1.makeRefId(from, ref.$ref);
222
222
  const resolvedRef = resolvedRefMap.get(refId);
223
223
  if (!resolvedRef) {
224
224
  return {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@redocly/openapi-core",
3
- "version": "1.0.0-beta.78",
3
+ "version": "1.0.0-beta.82",
4
4
  "description": "",
5
5
  "main": "lib/index.js",
6
6
  "engines": {