@scalar/workspace-store 0.64.0 → 0.66.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 (168) hide show
  1. package/CHANGELOG.md +121 -0
  2. package/README.md +45 -10
  3. package/dist/client.d.ts.map +1 -1
  4. package/dist/client.js +109 -10
  5. package/dist/entities/auth/schema.d.ts +351 -20
  6. package/dist/entities/auth/schema.d.ts.map +1 -1
  7. package/dist/entities/auth/schema.js +3 -1
  8. package/dist/events/definitions/auth.d.ts +1 -2
  9. package/dist/events/definitions/auth.d.ts.map +1 -1
  10. package/dist/events/definitions/operation.d.ts +3 -4
  11. package/dist/events/definitions/operation.d.ts.map +1 -1
  12. package/dist/events/definitions/server.d.ts +1 -2
  13. package/dist/events/definitions/server.d.ts.map +1 -1
  14. package/dist/events/definitions/ui.d.ts +3 -4
  15. package/dist/events/definitions/ui.d.ts.map +1 -1
  16. package/dist/events/old-definitions.d.ts +1 -2
  17. package/dist/events/old-definitions.d.ts.map +1 -1
  18. package/dist/helpers/chunk-index.d.ts +20 -2
  19. package/dist/helpers/chunk-index.d.ts.map +1 -1
  20. package/dist/helpers/chunk-index.js +14 -1
  21. package/dist/helpers/external-examples.d.ts +2 -0
  22. package/dist/helpers/external-examples.d.ts.map +1 -1
  23. package/dist/helpers/external-examples.js +1 -0
  24. package/dist/helpers/for-each-path-item-operation.d.ts +6 -5
  25. package/dist/helpers/for-each-path-item-operation.d.ts.map +1 -1
  26. package/dist/helpers/for-each-path-item-operation.js +40 -14
  27. package/dist/helpers/get-example-value.d.ts +15 -0
  28. package/dist/helpers/get-example-value.d.ts.map +1 -0
  29. package/dist/helpers/get-example-value.js +28 -0
  30. package/dist/helpers/get-parameter-example.d.ts +14 -0
  31. package/dist/helpers/get-parameter-example.d.ts.map +1 -0
  32. package/dist/helpers/get-parameter-example.js +19 -0
  33. package/dist/helpers/get-resolved-ref.d.ts.map +1 -1
  34. package/dist/helpers/get-resolved-ref.js +12 -1
  35. package/dist/helpers/normalize-boolean-schemas.d.ts +10 -0
  36. package/dist/helpers/normalize-boolean-schemas.d.ts.map +1 -0
  37. package/dist/helpers/normalize-boolean-schemas.js +193 -0
  38. package/dist/helpers/operation-examples.d.ts.map +1 -1
  39. package/dist/helpers/operation-examples.js +5 -2
  40. package/dist/helpers/querystring-parameter.d.ts +21 -0
  41. package/dist/helpers/querystring-parameter.d.ts.map +1 -0
  42. package/dist/helpers/querystring-parameter.js +108 -0
  43. package/dist/helpers/serialize-stream-example.d.ts +8 -0
  44. package/dist/helpers/serialize-stream-example.d.ts.map +1 -0
  45. package/dist/helpers/serialize-stream-example.js +52 -0
  46. package/dist/helpers/use-external-examples.d.ts.map +1 -1
  47. package/dist/helpers/use-external-examples.js +8 -1
  48. package/dist/mutators/index.d.ts +3 -3
  49. package/dist/mutators/operation/body.d.ts.map +1 -1
  50. package/dist/mutators/operation/body.js +9 -2
  51. package/dist/mutators/operation/operation.d.ts.map +1 -1
  52. package/dist/mutators/operation/operation.js +4 -7
  53. package/dist/mutators/operation/parameters.d.ts.map +1 -1
  54. package/dist/mutators/operation/parameters.js +43 -3
  55. package/dist/navigation/get-navigation-options.d.ts.map +1 -1
  56. package/dist/navigation/get-navigation-options.js +19 -4
  57. package/dist/navigation/helpers/traverse-paths.d.ts.map +1 -1
  58. package/dist/navigation/helpers/traverse-paths.js +2 -2
  59. package/dist/navigation/helpers/traverse-webhooks.d.ts.map +1 -1
  60. package/dist/navigation/helpers/traverse-webhooks.js +2 -2
  61. package/dist/navigation/helpers/update-order-ids.d.ts +1 -2
  62. package/dist/navigation/helpers/update-order-ids.d.ts.map +1 -1
  63. package/dist/plugins/bundler/index.d.ts +1 -0
  64. package/dist/plugins/bundler/index.d.ts.map +1 -1
  65. package/dist/plugins/bundler/index.js +11 -3
  66. package/dist/plugins/bundler/openapi-document.d.ts +6 -0
  67. package/dist/plugins/bundler/openapi-document.d.ts.map +1 -0
  68. package/dist/plugins/bundler/openapi-document.js +57 -0
  69. package/dist/request-example/builder/body/build-multipart.d.ts +29 -0
  70. package/dist/request-example/builder/body/build-multipart.d.ts.map +1 -0
  71. package/dist/request-example/builder/body/build-multipart.js +191 -0
  72. package/dist/request-example/builder/body/build-request-body.d.ts +6 -1
  73. package/dist/request-example/builder/body/build-request-body.d.ts.map +1 -1
  74. package/dist/request-example/builder/body/build-request-body.js +80 -23
  75. package/dist/request-example/builder/body/encode-multipart-body.d.ts +8 -8
  76. package/dist/request-example/builder/body/encode-multipart-body.d.ts.map +1 -1
  77. package/dist/request-example/builder/body/encode-multipart-body.js +56 -18
  78. package/dist/request-example/builder/body/get-request-body-example.d.ts.map +1 -1
  79. package/dist/request-example/builder/body/get-request-body-example.js +20 -6
  80. package/dist/request-example/builder/body/multipart-limits.d.ts +3 -0
  81. package/dist/request-example/builder/body/multipart-limits.d.ts.map +1 -0
  82. package/dist/request-example/builder/body/multipart-limits.js +2 -0
  83. package/dist/request-example/builder/body/serialize-form-property.d.ts +2 -0
  84. package/dist/request-example/builder/body/serialize-form-property.d.ts.map +1 -1
  85. package/dist/request-example/builder/body/serialize-form-property.js +3 -2
  86. package/dist/request-example/builder/body/serialize-multipart-array.d.ts +1 -1
  87. package/dist/request-example/builder/build-request.d.ts.map +1 -1
  88. package/dist/request-example/builder/build-request.js +7 -1
  89. package/dist/request-example/builder/header/build-request-parameters.d.ts +2 -0
  90. package/dist/request-example/builder/header/build-request-parameters.d.ts.map +1 -1
  91. package/dist/request-example/builder/header/build-request-parameters.js +54 -11
  92. package/dist/request-example/builder/header/is-param-disabled.d.ts.map +1 -1
  93. package/dist/request-example/builder/header/is-param-disabled.js +3 -1
  94. package/dist/request-example/builder/header/serialize-parameter.d.ts +11 -0
  95. package/dist/request-example/builder/header/serialize-parameter.d.ts.map +1 -1
  96. package/dist/request-example/builder/header/serialize-parameter.js +22 -0
  97. package/dist/request-example/builder/helpers/get-example-from-schema.d.ts.map +1 -1
  98. package/dist/request-example/builder/helpers/get-example-from-schema.js +42 -3
  99. package/dist/request-example/builder/helpers/get-example.d.ts.map +1 -1
  100. package/dist/request-example/builder/helpers/get-example.js +5 -2
  101. package/dist/request-example/builder/index.d.ts +2 -2
  102. package/dist/request-example/builder/index.d.ts.map +1 -1
  103. package/dist/request-example/builder/index.js +1 -1
  104. package/dist/request-example/builder/request-factory.d.ts +7 -0
  105. package/dist/request-example/builder/request-factory.d.ts.map +1 -1
  106. package/dist/request-example/builder/request-factory.js +10 -1
  107. package/dist/request-example/builder/resolve-request-factory-url.d.ts.map +1 -1
  108. package/dist/request-example/builder/resolve-request-factory-url.js +18 -2
  109. package/dist/request-example/builder/security/secret-types.d.ts +4 -1
  110. package/dist/request-example/builder/security/secret-types.d.ts.map +1 -1
  111. package/dist/request-example/context/headers.d.ts +1 -2
  112. package/dist/request-example/context/headers.d.ts.map +1 -1
  113. package/dist/request-example/context/security/extract-security-scheme-secrets.d.ts.map +1 -1
  114. package/dist/request-example/context/security/extract-security-scheme-secrets.js +15 -0
  115. package/dist/request-example/index.d.ts +5 -2
  116. package/dist/request-example/index.d.ts.map +1 -1
  117. package/dist/request-example/index.js +4 -1
  118. package/dist/request-example/types.d.ts +1 -2
  119. package/dist/request-example/types.d.ts.map +1 -1
  120. package/dist/request-example/xml/serialize-xml-part.d.ts +9 -0
  121. package/dist/request-example/xml/serialize-xml-part.d.ts.map +1 -0
  122. package/dist/request-example/xml/serialize-xml-part.js +12 -0
  123. package/dist/schemas/extensions/operation/x-code-samples.d.ts +22 -0
  124. package/dist/schemas/extensions/operation/x-code-samples.d.ts.map +1 -1
  125. package/dist/schemas/extensions/operation/x-code-samples.js +4 -0
  126. package/dist/schemas/extensions.d.ts +9 -0
  127. package/dist/schemas/extensions.d.ts.map +1 -1
  128. package/dist/schemas/extensions.js +9 -0
  129. package/dist/schemas/navigation.d.ts +40 -34
  130. package/dist/schemas/navigation.d.ts.map +1 -1
  131. package/dist/schemas/navigation.js +2 -3
  132. package/dist/schemas/reference-config/index.d.ts +24 -4
  133. package/dist/schemas/reference-config/index.d.ts.map +1 -1
  134. package/dist/schemas/reference-config/settings.d.ts +24 -4
  135. package/dist/schemas/reference-config/settings.d.ts.map +1 -1
  136. package/dist/schemas/v3.1/strict/oauthflows.d.ts +26 -0
  137. package/dist/schemas/v3.1/strict/oauthflows.d.ts.map +1 -1
  138. package/dist/schemas/v3.1/strict/oauthflows.js +3 -0
  139. package/dist/schemas/v3.1/strict/openapi-document.d.ts +1582 -147
  140. package/dist/schemas/v3.1/strict/openapi-document.d.ts.map +1 -1
  141. package/dist/schemas/v3.1/strict/operation.d.ts +8 -0
  142. package/dist/schemas/v3.1/strict/operation.d.ts.map +1 -1
  143. package/dist/schemas/v3.1/strict/path-item.d.ts +19 -0
  144. package/dist/schemas/v3.1/strict/path-item.d.ts.map +1 -1
  145. package/dist/schemas/v3.1/strict/path-item.js +5 -0
  146. package/dist/schemas/v3.2/openapi/index.d.ts +5 -0
  147. package/dist/schemas/v3.2/openapi/index.d.ts.map +1 -1
  148. package/dist/schemas/v3.2/openapi/index.js +48 -12
  149. package/dist/schemas/v3.2/openapi/reference.d.ts.map +1 -1
  150. package/dist/schemas/v3.2/openapi/reference.js +11 -3
  151. package/dist/schemas/v3.2/strict/openapi-document.d.ts +842 -140
  152. package/dist/schemas/v3.2/strict/openapi-document.d.ts.map +1 -1
  153. package/dist/schemas/v3.2/strict/openapi-document.js +6 -14
  154. package/dist/schemas/v3.2/strict/operation.d.ts +8 -0
  155. package/dist/schemas/v3.2/strict/operation.d.ts.map +1 -1
  156. package/dist/schemas/v3.2/strict/parameter.d.ts +14 -0
  157. package/dist/schemas/v3.2/strict/parameter.d.ts.map +1 -1
  158. package/dist/schemas/v3.2/strict/parameter.js +2 -0
  159. package/dist/server.d.ts +10 -6
  160. package/dist/server.d.ts.map +1 -1
  161. package/dist/server.js +67 -45
  162. package/package.json +19 -9
  163. package/dist/schemas/v3.1/openapi/index.d.ts +0 -149
  164. package/dist/schemas/v3.1/openapi/index.d.ts.map +0 -1
  165. package/dist/schemas/v3.1/openapi/index.js +0 -732
  166. package/dist/schemas/v3.1/openapi/reference.d.ts +0 -4
  167. package/dist/schemas/v3.1/openapi/reference.d.ts.map +0 -1
  168. package/dist/schemas/v3.1/openapi/reference.js +0 -29
@@ -51,6 +51,7 @@ const externalDocs = object({
51
51
  })),
52
52
  }, { typeName: 'ExternalDocumentationObject' });
53
53
  const xml = object({
54
+ nodeType: optional(union([literal('element'), literal('attribute'), literal('text'), literal('cdata'), literal('none')])),
54
55
  name: optional(string({
55
56
  typeComment: 'Replaces the name of the element/attribute used for the described schema property. When defined within items, it will affect the name of the individual XML elements within the list. When defined alongside type being "array" (outside the items), it will affect the wrapping element if and only if wrapped is true. If wrapped is false, it will be ignored.',
56
57
  })),
@@ -66,6 +67,7 @@ const xml = object({
66
67
  })),
67
68
  }, { typeName: 'XMLObject' });
68
69
  const discriminatorObject = object({
70
+ defaultMapping: optional(string({ typeComment: 'Schema name or URI reference used when the discriminator value is absent or unmapped.' })),
69
71
  propertyName: string({
70
72
  typeComment: 'REQUIRED. The name of the property in the payload that will hold the discriminating value. This property SHOULD be required in the payload schema, as the behavior when the property is absent is undefined.',
71
73
  }),
@@ -274,6 +276,7 @@ export const generateSchema = (maybeRef, options = {}) => {
274
276
  })),
275
277
  }, { typeName: 'ServerVariableObject' });
276
278
  const servers = object({
279
+ name: optional(string({ typeComment: 'A name for the server.' })),
277
280
  url: string({
278
281
  typeComment: 'REQUIRED. A URL to the target host. This URL supports Server Variables and MAY be relative, to indicate that the host location is relative to the location where the document containing the Server Object is being served. Variable substitutions will be made when a variable is named in {braces}.',
279
282
  }),
@@ -290,6 +293,9 @@ export const generateSchema = (maybeRef, options = {}) => {
290
293
  const tag = intersection([
291
294
  object({
292
295
  name: string({ typeComment: 'REQUIRED. The name of the tag.' }),
296
+ summary: optional(string({ typeComment: 'A short summary of the tag.' })),
297
+ parent: optional(string({ typeComment: 'The name of the parent tag.' })),
298
+ kind: optional(string({ typeComment: 'A machine-readable category for the tag.' })),
293
299
  description: optional(string({
294
300
  typeComment: 'A description for the tag. CommonMark syntax MAY be used for rich text representation.',
295
301
  })),
@@ -305,6 +311,7 @@ export const generateSchema = (maybeRef, options = {}) => {
305
311
  typeComment: 'Lists the required security schemes to execute this operation. An empty object ({}) indicates anonymous access is supported.',
306
312
  });
307
313
  const securitySchemeBase = object({
314
+ deprecated: optional(boolean({ typeComment: 'Whether the security scheme is deprecated.' })),
308
315
  description: optional(string({
309
316
  typeComment: 'A description for security scheme. CommonMark syntax MAY be used for rich text representation.',
310
317
  })),
@@ -391,11 +398,21 @@ export const generateSchema = (maybeRef, options = {}) => {
391
398
  XusePkce,
392
399
  XScalarCredentialsLocation,
393
400
  ]);
401
+ const deviceAuthorizationOAuth2Flow = intersection([
402
+ oauthFlowCore,
403
+ ...oauthFlowExtensionObjects,
404
+ object({
405
+ deviceAuthorizationUrl: string({ typeComment: 'The device authorization endpoint URL.' }),
406
+ tokenUrl: string({ typeComment: 'The token endpoint URL.' }),
407
+ }, { typeName: 'DeviceAuthorizationOAuthFlowObject' }),
408
+ XScalarCredentialsLocation,
409
+ ]);
394
410
  const oauth2Flows = object({
395
411
  implicit: optional(implicitOAuth2Flow),
396
412
  password: optional(passwordOAuth2Flow),
397
413
  clientCredentials: optional(clientCredentialsOAuth2Flow),
398
414
  authorizationCode: optional(authorizationCodeOAuth2Flow),
415
+ deviceAuthorization: optional(deviceAuthorizationOAuth2Flow),
399
416
  }, { typeName: 'OAuthFlowsObject' });
400
417
  const oauth2SecurityScheme = intersection([
401
418
  object({
@@ -424,6 +441,7 @@ export const generateSchema = (maybeRef, options = {}) => {
424
441
  ], { typeName: 'SecuritySchemeObject' });
425
442
  const components = object({
426
443
  schemas: optional(record(string(), maybeRef(schema), { typeName: 'ComponentsSchemas' })),
444
+ mediaTypes: optional(record(string(), maybeRef(lazy(() => mediaType)), { typeName: 'ComponentsMediaTypes' })),
427
445
  responses: optional(record(string(), maybeRef(lazy(() => response)), { typeName: 'ComponentsResponses' })),
428
446
  parameters: optional(record(string(), maybeRef(lazy(() => parameter)), { typeName: 'ComponentsParameters' })),
429
447
  examples: optional(record(string(), maybeRef(lazy(() => example)), { typeName: 'ComponentsExamples' })),
@@ -443,6 +461,8 @@ export const generateSchema = (maybeRef, options = {}) => {
443
461
  value: optional(any({
444
462
  typeComment: 'Embedded literal example. The value field and externalValue field are mutually exclusive.',
445
463
  })),
464
+ dataValue: optional(any()),
465
+ serializedValue: optional(string()),
446
466
  externalValue: optional(string({
447
467
  typeComment: 'A URI that identifies the literal example. The value field and externalValue field are mutually exclusive.',
448
468
  })),
@@ -475,18 +495,28 @@ export const generateSchema = (maybeRef, options = {}) => {
475
495
  const headerWithContent = intersection([
476
496
  headerBase,
477
497
  object({
478
- content: optional(record(string(), lazy(() => mediaType), { typeName: 'HeaderContent' })),
498
+ content: optional(record(string(), maybeRef(lazy(() => mediaType)), { typeName: 'HeaderContent' })),
479
499
  }, { typeName: 'HeaderObjectWithContent' }),
480
500
  ]);
481
501
  const header = union([headerWithSchema, headerWithContent], { typeName: 'HeaderObject' });
482
502
  const encoding = object({
503
+ style: optional(string()),
504
+ explode: optional(boolean()),
505
+ allowReserved: optional(boolean()),
506
+ encoding: optional(record(string(), lazy(() => encoding))),
507
+ prefixEncoding: optional(array(lazy(() => encoding))),
508
+ itemEncoding: optional(lazy(() => encoding)),
483
509
  contentType: optional(string({
484
510
  typeComment: 'The Content-Type for encoding a specific property. The value is a comma-separated list, each element of which is either a specific media type (e.g. image/png) or a wildcard media type (e.g. image/*).',
485
511
  })),
486
512
  headers: optional(record(string(), maybeRef(lazy(() => header)), { typeName: 'EncodingHeaders' })),
487
513
  }, { typeName: 'EncodingObject' });
488
514
  const mediaType = object({
515
+ description: optional(string()),
516
+ prefixEncoding: optional(array(encoding)),
517
+ itemEncoding: optional(encoding),
489
518
  schema: optional(maybeRef(lazy(() => schema))),
519
+ itemSchema: optional(maybeRef(lazy(() => schema))),
490
520
  example: optional(any({ typeComment: 'Example of the media type.' })),
491
521
  examples: optional(record(string(), maybeRef(lazy(() => example)), { typeName: 'MediaTypeExamples' })),
492
522
  encoding: optional(record(string(), encoding, {
@@ -499,9 +529,9 @@ export const generateSchema = (maybeRef, options = {}) => {
499
529
  name: string({
500
530
  typeComment: 'REQUIRED. The name of the parameter. Parameter names are case sensitive. If in is "path", the name field MUST correspond to a template expression occurring within the path field in the Paths Object.',
501
531
  }),
502
- in: union([literal('query'), literal('header'), literal('path'), literal('cookie')], {
532
+ in: union([literal('query'), literal('header'), literal('path'), literal('cookie'), literal('querystring')], {
503
533
  typeName: 'ParameterLocation',
504
- typeComment: 'REQUIRED. The location of the parameter. Possible values are "query", "header", "path" or "cookie".',
534
+ typeComment: 'REQUIRED. The location of the parameter. Possible values are "query", "header", "path", "cookie" or "querystring".',
505
535
  }),
506
536
  description: optional(string({
507
537
  typeComment: 'A brief description of the parameter. This could contain examples of use. CommonMark syntax MAY be used for rich text representation.',
@@ -537,9 +567,9 @@ export const generateSchema = (maybeRef, options = {}) => {
537
567
  name: string({
538
568
  typeComment: 'REQUIRED. The name of the parameter. Parameter names are case sensitive. If in is "path", the name field MUST correspond to a template expression occurring within the path field in the Paths Object.',
539
569
  }),
540
- in: union([literal('query'), literal('header'), literal('path'), literal('cookie')], {
570
+ in: union([literal('query'), literal('header'), literal('path'), literal('cookie'), literal('querystring')], {
541
571
  typeName: 'ParameterLocation',
542
- typeComment: 'REQUIRED. The location of the parameter. Possible values are "query", "header", "path" or "cookie".',
572
+ typeComment: 'REQUIRED. The location of the parameter. Possible values are "query", "header", "path", "cookie" or "querystring".',
543
573
  }),
544
574
  description: optional(string({
545
575
  typeComment: 'A brief description of the parameter. This could contain examples of use. CommonMark syntax MAY be used for rich text representation.',
@@ -556,7 +586,9 @@ export const generateSchema = (maybeRef, options = {}) => {
556
586
  allowReserved: optional(boolean({
557
587
  typeComment: 'When this is true, parameter values are serialized using reserved expansion, as defined by RFC6570. This field only applies to parameters with an in value of query. The default value is false.',
558
588
  })),
559
- content: optional(record(string(), lazy(() => mediaType), { typeName: 'ParameterContent' })),
589
+ example: optional(any()),
590
+ examples: optional(record(string(), maybeRef(example))),
591
+ content: optional(record(string(), maybeRef(lazy(() => mediaType)), { typeName: 'ParameterContent' })),
560
592
  }, { typeName: 'ParameterObjectWithContent' }),
561
593
  XGlobal,
562
594
  XInternal,
@@ -568,7 +600,7 @@ export const generateSchema = (maybeRef, options = {}) => {
568
600
  description: optional(string({
569
601
  typeComment: 'A brief description of the request body. This could contain examples of use. CommonMark syntax MAY be used for rich text representation.',
570
602
  })),
571
- content: record(string(), lazy(() => mediaType), {
603
+ content: record(string(), maybeRef(lazy(() => mediaType)), {
572
604
  typeComment: 'REQUIRED. The content of the request body. The key is a media type or media type range and the value describes it.',
573
605
  typeName: 'RequestBodyContent',
574
606
  }),
@@ -596,11 +628,12 @@ export const generateSchema = (maybeRef, options = {}) => {
596
628
  server: optional(servers),
597
629
  }, { typeName: 'LinkObject' });
598
630
  const response = object({
599
- description: string({
600
- typeComment: 'REQUIRED. A description of the response. CommonMark syntax MAY be used for rich text representation.',
601
- }),
631
+ summary: optional(string({ typeComment: 'A short summary of the response.' })),
632
+ description: optional(string({
633
+ typeComment: 'A description of the response. CommonMark syntax MAY be used for rich text representation.',
634
+ })),
602
635
  headers: optional(record(string(), maybeRef(lazy(() => header)), { typeName: 'ResponseHeaders' })),
603
- content: optional(record(string(), lazy(() => mediaType), { typeName: 'ResponseContent' })),
636
+ content: optional(record(string(), maybeRef(lazy(() => mediaType)), { typeName: 'ResponseContent' })),
604
637
  links: optional(record(string(), maybeRef(lazy(() => link)), { typeName: 'ResponseLinks' })),
605
638
  }, { typeName: 'ResponseObject' });
606
639
  const responsesObject = record(string(), maybeRef(lazy(() => response)), {
@@ -663,6 +696,8 @@ export const generateSchema = (maybeRef, options = {}) => {
663
696
  options: optional(maybeRef(lazy(() => operation))),
664
697
  head: optional(maybeRef(lazy(() => operation))),
665
698
  trace: optional(maybeRef(lazy(() => operation))),
699
+ query: optional(maybeRef(lazy(() => operation))),
700
+ additionalOperations: optional(record(string(), maybeRef(lazy(() => operation)), { typeName: 'AdditionalOperations' })),
666
701
  servers: optional(array(servers, { typeName: 'PathItemServers' })),
667
702
  parameters: optional(array(maybeRef(lazy(() => parameter)), { typeName: 'PathItemParameters' })),
668
703
  }, { typeName: 'PathItemObject' });
@@ -673,6 +708,7 @@ export const generateSchema = (maybeRef, options = {}) => {
673
708
  })),
674
709
  }, { typeName: 'OpenApiExtensionsPartial' });
675
710
  const openApiDocumentCore = object({
711
+ $self: optional(string({ typeComment: 'The URI identifying this OpenAPI document.' })),
676
712
  openapi: string({
677
713
  typeComment: 'REQUIRED. This string MUST be the version number of the OpenAPI Specification that the OpenAPI Document uses. The openapi field SHOULD be used by tooling to interpret the OpenAPI Document. This is not related to the API info.version string.',
678
714
  }),
@@ -722,7 +758,7 @@ export const generateSchema = (maybeRef, options = {}) => {
722
758
  XPostResponse,
723
759
  ], {
724
760
  typeName: 'OpenApiDocument',
725
- typeComment: 'Root OpenAPI 3.1 document including Scalar workspace extensions (OpenApiExtensionsSchema).',
761
+ typeComment: 'Root OpenAPI 3.2 document including Scalar workspace extensions (OpenApiExtensionsSchema).',
726
762
  });
727
763
  return openapi;
728
764
  };
@@ -1 +1 @@
1
- {"version":3,"file":"reference.d.ts","sourceRoot":"","sources":["../../../../src/schemas/v3.2/openapi/reference.ts"],"names":[],"mappings":"AACA,OAAO,EACL,KAAK,MAAM,EASZ,MAAM,oBAAoB,CAAA;AAsC3B,eAAO,MAAM,SAAS,GAAI,QAAQ,MAAM,KAAG,MAAoC,CAAA;AAS/E,eAAO,MAAM,YAAY,GAAI,QAAQ,MAAM,KAAG,MACkE,CAAA"}
1
+ {"version":3,"file":"reference.d.ts","sourceRoot":"","sources":["../../../../src/schemas/v3.2/openapi/reference.ts"],"names":[],"mappings":"AACA,OAAO,EACL,KAAK,MAAM,EASZ,MAAM,oBAAoB,CAAA;AAsC3B,eAAO,MAAM,SAAS,GAAI,QAAQ,MAAM,KAAG,MAAoC,CAAA;AAkB/E,eAAO,MAAM,YAAY,GAAI,QAAQ,MAAM,KAAG,MACkE,CAAA"}
@@ -20,10 +20,18 @@ const reference = object({
20
20
  typeName: 'ReferenceObject',
21
21
  });
22
22
  export const normalRef = (schema) => union([schema, reference]);
23
+ /**
24
+ * Follows a chain of references to the value at its end. References can form a loop (`A` points at
25
+ * `B` and `B` points back at `A`, or a schema points at itself), so we stop at the first reference we
26
+ * have already passed. Without that, a loop in an untrusted document overflows the stack.
27
+ */
23
28
  const e = (value) => {
24
- if (isObject(value) && '$ref' in value) {
25
- return e(value['$ref-value']);
29
+ const seen = new Set();
30
+ let current = value;
31
+ while (isObject(current) && '$ref' in current && !seen.has(current)) {
32
+ seen.add(current);
33
+ current = current['$ref-value'];
26
34
  }
27
- return value;
35
+ return current;
28
36
  };
29
37
  export const recursiveRef = (schema) => union([schema, intersection([reference, object({ '$ref-value': evaluate(e, schema) }), referenceExtensions])]);