@scalar/workspace-store 0.68.2 → 0.68.4

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 (177) hide show
  1. package/CHANGELOG.md +39 -0
  2. package/README.md +20 -0
  3. package/dist/channel-example/build-connection-url.d.ts.map +1 -1
  4. package/dist/channel-example/build-connection-url.js +6 -5
  5. package/dist/channel-example/get-all-channel-messages.js +2 -2
  6. package/dist/channel-example/get-async-api-protocols.d.ts +3 -1
  7. package/dist/channel-example/get-async-api-protocols.d.ts.map +1 -1
  8. package/dist/channel-example/get-async-api-protocols.js +9 -5
  9. package/dist/channel-example/get-asyncapi-security-requirements.d.ts +14 -2
  10. package/dist/channel-example/get-asyncapi-security-requirements.d.ts.map +1 -1
  11. package/dist/channel-example/get-asyncapi-security-requirements.js +93 -36
  12. package/dist/channel-example/get-channel-connection-context.d.ts.map +1 -1
  13. package/dist/channel-example/get-channel-connection-context.js +3 -4
  14. package/dist/channel-example/get-channel-connection-security.d.ts +3 -2
  15. package/dist/channel-example/get-channel-connection-security.d.ts.map +1 -1
  16. package/dist/channel-example/get-channel-connection-security.js +4 -6
  17. package/dist/channel-example/get-channel-operations.d.ts.map +1 -1
  18. package/dist/channel-example/get-channel-operations.js +4 -3
  19. package/dist/channel-example/get-channel-parameters.d.ts.map +1 -1
  20. package/dist/channel-example/get-channel-parameters.js +4 -3
  21. package/dist/channel-example/index.d.ts +2 -2
  22. package/dist/channel-example/index.d.ts.map +1 -1
  23. package/dist/channel-example/index.js +2 -2
  24. package/dist/channel-example/resolve-channel.d.ts.map +1 -1
  25. package/dist/channel-example/resolve-channel.js +4 -3
  26. package/dist/channel-example/resolve-operation-channel.d.ts.map +1 -1
  27. package/dist/channel-example/resolve-operation-channel.js +8 -6
  28. package/dist/channel-example/resolve-operation-with-traits.d.ts +1 -3
  29. package/dist/channel-example/resolve-operation-with-traits.d.ts.map +1 -1
  30. package/dist/channel-example/resolve-operation-with-traits.js +3 -41
  31. package/dist/channel-example/servers.d.ts.map +1 -1
  32. package/dist/channel-example/servers.js +4 -3
  33. package/dist/client.d.ts.map +1 -1
  34. package/dist/client.js +8 -4
  35. package/dist/entities/auth/schema.d.ts +25 -0
  36. package/dist/entities/auth/schema.d.ts.map +1 -1
  37. package/dist/entities/auth/schema.js +2 -0
  38. package/dist/events/definitions/operation.d.ts +7 -0
  39. package/dist/events/definitions/operation.d.ts.map +1 -1
  40. package/dist/helpers/asyncapi-chunk-groups.d.ts.map +1 -1
  41. package/dist/helpers/asyncapi-chunk-groups.js +8 -4
  42. package/dist/helpers/asyncapi-model-chunk-reference.d.ts.map +1 -1
  43. package/dist/helpers/asyncapi-model-chunk-reference.js +2 -1
  44. package/dist/helpers/auth-secret-fields.d.ts +11 -0
  45. package/dist/helpers/auth-secret-fields.d.ts.map +1 -1
  46. package/dist/helpers/auth-secret-fields.js +22 -0
  47. package/dist/helpers/encode-path-parameter.d.ts.map +1 -1
  48. package/dist/helpers/encode-path-parameter.js +11 -12
  49. package/dist/helpers/external-examples.d.ts.map +1 -1
  50. package/dist/helpers/external-examples.js +6 -3
  51. package/dist/helpers/get-async-api-schema-view.d.ts +8 -0
  52. package/dist/helpers/get-async-api-schema-view.d.ts.map +1 -0
  53. package/dist/helpers/get-async-api-schema-view.js +82 -0
  54. package/dist/helpers/get-boolean-schema.d.ts +7 -0
  55. package/dist/helpers/get-boolean-schema.d.ts.map +1 -0
  56. package/dist/helpers/get-boolean-schema.js +5 -0
  57. package/dist/helpers/get-resolved-async-api-ref.d.ts +10 -0
  58. package/dist/helpers/get-resolved-async-api-ref.d.ts.map +1 -0
  59. package/dist/helpers/get-resolved-async-api-ref.js +18 -0
  60. package/dist/helpers/get-resolved-ref-deep.d.ts.map +1 -1
  61. package/dist/helpers/normalize-boolean-schemas.d.ts.map +1 -1
  62. package/dist/helpers/normalize-boolean-schemas.js +6 -1
  63. package/dist/helpers/operation-examples.d.ts.map +1 -1
  64. package/dist/helpers/operation-examples.js +2 -1
  65. package/dist/helpers/querystring-parameter.d.ts.map +1 -1
  66. package/dist/helpers/querystring-parameter.js +6 -6
  67. package/dist/helpers/resolve-security-requirements.d.ts.map +1 -1
  68. package/dist/helpers/resolve-security-requirements.js +38 -19
  69. package/dist/helpers/resolve-traits.d.ts +3 -0
  70. package/dist/helpers/resolve-traits.d.ts.map +1 -0
  71. package/dist/helpers/resolve-traits.js +76 -0
  72. package/dist/helpers/serialize-stream-example.js +1 -1
  73. package/dist/helpers/snapshot-schema.d.ts +9 -0
  74. package/dist/helpers/snapshot-schema.d.ts.map +1 -0
  75. package/dist/helpers/snapshot-schema.js +38 -0
  76. package/dist/helpers/use-external-examples.d.ts.map +1 -1
  77. package/dist/helpers/use-external-examples.js +10 -5
  78. package/dist/mutators/auth.d.ts +2 -1
  79. package/dist/mutators/auth.d.ts.map +1 -1
  80. package/dist/mutators/auth.js +32 -2
  81. package/dist/mutators/index.d.ts +2 -2
  82. package/dist/mutators/operation/helpers/har-to-operation.d.ts.map +1 -1
  83. package/dist/mutators/operation/helpers/har-to-operation.js +4 -2
  84. package/dist/mutators/operation/operation.d.ts.map +1 -1
  85. package/dist/mutators/operation/operation.js +4 -2
  86. package/dist/mutators/operation/parameters.d.ts.map +1 -1
  87. package/dist/mutators/operation/parameters.js +23 -1
  88. package/dist/mutators/tag.d.ts.map +1 -1
  89. package/dist/mutators/tag.js +4 -2
  90. package/dist/navigation/get-navigation-options.d.ts.map +1 -1
  91. package/dist/navigation/get-navigation-options.js +9 -5
  92. package/dist/navigation/helpers/get-tag-external-docs.d.ts +4 -0
  93. package/dist/navigation/helpers/get-tag-external-docs.d.ts.map +1 -0
  94. package/dist/navigation/helpers/get-tag-external-docs.js +6 -0
  95. package/dist/navigation/helpers/traverse-asyncapi-document.d.ts.map +1 -1
  96. package/dist/navigation/helpers/traverse-asyncapi-document.js +75 -36
  97. package/dist/navigation/helpers/traverse-paths.js +1 -1
  98. package/dist/navigation/helpers/traverse-schemas.d.ts.map +1 -1
  99. package/dist/navigation/helpers/traverse-schemas.js +2 -1
  100. package/dist/navigation/helpers/traverse-tags.d.ts.map +1 -1
  101. package/dist/navigation/helpers/traverse-tags.js +3 -0
  102. package/dist/plugins/bundler/index.d.ts.map +1 -1
  103. package/dist/plugins/bundler/index.js +2 -1
  104. package/dist/plugins/bundler/openapi-document.d.ts.map +1 -1
  105. package/dist/plugins/bundler/openapi-document.js +2 -1
  106. package/dist/request-example/builder/body/build-multipart.d.ts.map +1 -1
  107. package/dist/request-example/builder/body/build-multipart.js +18 -16
  108. package/dist/request-example/builder/body/encode-multipart-body.d.ts.map +1 -1
  109. package/dist/request-example/builder/body/encode-multipart-body.js +2 -1
  110. package/dist/request-example/builder/body/get-request-body-example.d.ts +2 -2
  111. package/dist/request-example/builder/body/get-request-body-example.d.ts.map +1 -1
  112. package/dist/request-example/builder/body/get-request-body-example.js +8 -7
  113. package/dist/request-example/builder/body/schema-value-coercion.d.ts.map +1 -1
  114. package/dist/request-example/builder/body/schema-value-coercion.js +4 -1
  115. package/dist/request-example/builder/header/build-request-parameters.d.ts.map +1 -1
  116. package/dist/request-example/builder/header/build-request-parameters.js +12 -2
  117. package/dist/request-example/builder/header/filter-disabled-properties.d.ts +3 -0
  118. package/dist/request-example/builder/header/filter-disabled-properties.d.ts.map +1 -0
  119. package/dist/request-example/builder/header/filter-disabled-properties.js +18 -0
  120. package/dist/request-example/builder/header/filter-global-cookies.d.ts +1 -1
  121. package/dist/request-example/builder/header/filter-global-cookies.d.ts.map +1 -1
  122. package/dist/request-example/builder/header/filter-global-cookies.js +15 -3
  123. package/dist/request-example/builder/header/is-param-disabled.d.ts +1 -1
  124. package/dist/request-example/builder/header/is-param-disabled.d.ts.map +1 -1
  125. package/dist/request-example/builder/header/is-param-disabled.js +3 -2
  126. package/dist/request-example/builder/helpers/get-example-from-schema.d.ts.map +1 -1
  127. package/dist/request-example/builder/helpers/get-example-from-schema.js +27 -16
  128. package/dist/request-example/builder/helpers/get-example.d.ts +2 -0
  129. package/dist/request-example/builder/helpers/get-example.d.ts.map +1 -1
  130. package/dist/request-example/builder/helpers/get-example.js +15 -5
  131. package/dist/request-example/builder/index.d.ts +1 -0
  132. package/dist/request-example/builder/index.d.ts.map +1 -1
  133. package/dist/request-example/builder/index.js +1 -0
  134. package/dist/request-example/builder/resolve-request-factory-url.d.ts.map +1 -1
  135. package/dist/request-example/builder/resolve-request-factory-url.js +9 -8
  136. package/dist/request-example/builder/security/secret-types.d.ts +13 -3
  137. package/dist/request-example/builder/security/secret-types.d.ts.map +1 -1
  138. package/dist/request-example/context/headers.js +1 -1
  139. package/dist/request-example/context/security/extract-security-scheme-secrets.d.ts.map +1 -1
  140. package/dist/request-example/context/security/extract-security-scheme-secrets.js +65 -25
  141. package/dist/request-example/context/security/get-selected-security.js +1 -1
  142. package/dist/request-example/context/security/merge-security.d.ts.map +1 -1
  143. package/dist/request-example/context/security/merge-security.js +12 -2
  144. package/dist/request-example/context/security/uses-api-key-name-override.d.ts +9 -0
  145. package/dist/request-example/context/security/uses-api-key-name-override.d.ts.map +1 -0
  146. package/dist/request-example/context/security/uses-api-key-name-override.js +9 -0
  147. package/dist/request-example/index.d.ts +1 -1
  148. package/dist/request-example/index.d.ts.map +1 -1
  149. package/dist/request-example/index.js +1 -1
  150. package/dist/request-example/xml/get-xml-example.js +2 -1
  151. package/dist/request-example/xml/write-xml.d.ts.map +1 -1
  152. package/dist/request-example/xml/write-xml.js +7 -5
  153. package/dist/resolve.d.ts +1 -1
  154. package/dist/resolve.d.ts.map +1 -1
  155. package/dist/resolve.js +16 -1
  156. package/dist/schemas/extensions/example/x-disabled.d.ts +4 -0
  157. package/dist/schemas/extensions/example/x-disabled.d.ts.map +1 -1
  158. package/dist/schemas/extensions/example/x-disabled.js +3 -1
  159. package/dist/schemas/navigation.d.ts +5 -1
  160. package/dist/schemas/navigation.d.ts.map +1 -1
  161. package/dist/schemas/navigation.js +2 -1
  162. package/dist/schemas/reference-config/index.d.ts +3 -0
  163. package/dist/schemas/reference-config/index.d.ts.map +1 -1
  164. package/dist/schemas/reference-config/settings.d.ts +3 -0
  165. package/dist/schemas/reference-config/settings.d.ts.map +1 -1
  166. package/dist/schemas/v3.1/strict/example.d.ts +3 -0
  167. package/dist/schemas/v3.1/strict/example.d.ts.map +1 -1
  168. package/dist/schemas/v3.1/strict/openapi-document.d.ts +106 -6
  169. package/dist/schemas/v3.1/strict/openapi-document.d.ts.map +1 -1
  170. package/dist/schemas/v3.2/strict/example.d.ts +3 -0
  171. package/dist/schemas/v3.2/strict/example.d.ts.map +1 -1
  172. package/dist/schemas/v3.2/strict/openapi-document.d.ts +106 -6
  173. package/dist/schemas/v3.2/strict/openapi-document.d.ts.map +1 -1
  174. package/dist/server.d.ts +7 -0
  175. package/dist/server.d.ts.map +1 -1
  176. package/dist/server.js +16 -7
  177. package/package.json +9 -9
@@ -1,3 +1,4 @@
1
+ import { isObject } from '@scalar/helpers/object/is-object';
1
2
  import { getResolvedRef, mergeSiblingReferences } from '../../helpers/get-resolved-ref.js';
2
3
  import { isHidden } from '../../helpers/is-hidden.js';
3
4
  import { getNavigationTagNames } from '../../navigation/helpers/get-navigation-tag-names.js';
@@ -15,7 +16,7 @@ const createSchemaEntry = ({ ref, name, generateId, parentTag, _schema, parentId
15
16
  const schema = getResolvedRef(_schema);
16
17
  // Use schema.title if available, otherwise fall back to name
17
18
  // @see https://json-schema.org/draft/2020-12/json-schema-core#section-4.3.5
18
- const title = (schema && 'title' in schema && schema.title) || name;
19
+ const title = (isObject(schema) && 'title' in schema && schema.title) || name;
19
20
  const entry = {
20
21
  id,
21
22
  title,
@@ -1 +1 @@
1
- {"version":3,"file":"traverse-tags.d.ts","sourceRoot":"","sources":["../../../src/navigation/helpers/traverse-tags.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,OAAO,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAA;AACtE,OAAO,KAAK,EAAE,cAAc,EAAgB,MAAM,sBAAsB,CAAA;AACxE,OAAO,KAAK,EAAE,eAAe,EAAa,MAAM,wCAAwC,CAAA;AAIxF,KAAK,OAAO,GAAG,IAAI,CAAC,mBAAmB,EAAE,YAAY,GAAG,kBAAkB,GAAG,YAAY,CAAC,CAAA;AAmS1F;;;;;;;;GAQG;AACH,eAAO,MAAM,YAAY,GAAI,2FAK1B;IACD,QAAQ,EAAE,eAAe,CAAA;IACzB,oCAAoC;IACpC,OAAO,EAAE,OAAO,CAAA;IAChB,UAAU,EAAE,MAAM,CAAA;IAClB,OAAO,EAAE,OAAO,CAAA;CACjB,KAAG,cAAc,EAuEjB,CAAA"}
1
+ {"version":3,"file":"traverse-tags.d.ts","sourceRoot":"","sources":["../../../src/navigation/helpers/traverse-tags.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,OAAO,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAA;AACtE,OAAO,KAAK,EAAE,cAAc,EAAgB,MAAM,sBAAsB,CAAA;AACxE,OAAO,KAAK,EAAE,eAAe,EAAa,MAAM,wCAAwC,CAAA;AAIxF,KAAK,OAAO,GAAG,IAAI,CAAC,mBAAmB,EAAE,YAAY,GAAG,kBAAkB,GAAG,YAAY,CAAC,CAAA;AAqS1F;;;;;;;;GAQG;AACH,eAAO,MAAM,YAAY,GAAI,2FAK1B;IACD,QAAQ,EAAE,eAAe,CAAA;IACzB,oCAAoC;IACpC,OAAO,EAAE,OAAO,CAAA;IAChB,UAAU,EAAE,MAAM,CAAA;IAClB,OAAO,EAAE,OAAO,CAAA;CACjB,KAAG,cAAc,EAuEjB,CAAA"}
@@ -2,6 +2,7 @@ import { sortByOrder } from '@scalar/helpers/array/sort-by-order';
2
2
  import { getTagKind } from '../../helpers/get-tag-kind.js';
3
3
  import { isHidden } from '../../helpers/is-hidden.js';
4
4
  import { unpackProxyObject } from '../../helpers/unpack-proxy.js';
5
+ import { getTagExternalDocs } from '../../navigation/helpers/get-tag-external-docs.js';
5
6
  import { getXKeysFromObject } from '../../navigation/helpers/get-x-keys.js';
6
7
  import { getTag } from './get-tag.js';
7
8
  /** Creates a traversed tag entry from an OpenAPI tag object.
@@ -22,6 +23,7 @@ const createTagEntry = ({ tag, generateId, children, isGroup = false, isTagGroup
22
23
  isTagGroup,
23
24
  });
24
25
  // `summary` is the OpenAPI 3.2 display label; `x-displayName` keeps precedence for backwards compatibility.
26
+ const externalDocs = getTagExternalDocs(tag);
25
27
  const title = tag['x-displayName'] ?? tag.summary ?? tag.name ?? 'Untitled Tag';
26
28
  // Update the order of the children based on the items
27
29
  // This will ensure that the sort order is always in sync with the items
@@ -31,6 +33,7 @@ const createTagEntry = ({ tag, generateId, children, isGroup = false, isTagGroup
31
33
  title,
32
34
  name: tag.name || title,
33
35
  description: tag.description,
36
+ ...(externalDocs ? { externalDocs } : {}),
34
37
  children,
35
38
  isGroup,
36
39
  // Only tag on legacy `x-tagGroups` wrappers so the renderer can flatten them without a header.
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/plugins/bundler/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAKH,OAAO,EAAE,KAAK,eAAe,EAAwB,MAAM,2BAA2B,CAAA;AAStF;;;;;GAKG;AACH,eAAO,MAAM,aAAa,QAAO,eAahC,CAAA;AAED;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,qBAAqB,GAAI,UAAU;IAAE,IAAI,CAAC,EAAE,OAAO,CAAA;CAAE,KAAG,eA2CpE,CAAA;AAED;;;;;;;;;GASG;AACH,eAAO,MAAM,cAAc,QAAO,eAwCjC,CAAA;AAED;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,eAAO,MAAM,mBAAmB,QAAO,eA6BtC,CAAA;AAED;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,eAAO,MAAM,oBAAoB,QAAO,eAuBvC,CAAA;AAED;;;;;;;;GAQG;AACH,eAAO,MAAM,aAAa,QAAO,eAyBhC,CAAA;AAED;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,kBAAkB,QAAO,eAmFrC,CAAA;AAKD;;;;;GAKG;AACH,eAAO,MAAM,qBAAqB,QAAO,eAaxC,CAAA;AAED,OAAO,EAAE,eAAe,EAAE,sBAAsB,EAAE,MAAM,oBAAoB,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/plugins/bundler/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAKH,OAAO,EAAE,KAAK,eAAe,EAAwB,MAAM,2BAA2B,CAAA;AAStF;;;;;GAKG;AACH,eAAO,MAAM,aAAa,QAAO,eAahC,CAAA;AAED;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,qBAAqB,GAAI,UAAU;IAAE,IAAI,CAAC,EAAE,OAAO,CAAA;CAAE,KAAG,eA6CpE,CAAA;AAED;;;;;;;;;GASG;AACH,eAAO,MAAM,cAAc,QAAO,eAwCjC,CAAA;AAED;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,eAAO,MAAM,mBAAmB,QAAO,eA6BtC,CAAA;AAED;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,eAAO,MAAM,oBAAoB,QAAO,eAuBvC,CAAA;AAED;;;;;;;;GAQG;AACH,eAAO,MAAM,aAAa,QAAO,eAyBhC,CAAA;AAED;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,kBAAkB,QAAO,eAmFrC,CAAA;AAKD;;;;;GAKG;AACH,eAAO,MAAM,qBAAqB,QAAO,eAaxC,CAAA;AAED,OAAO,EAAE,eAAe,EAAE,sBAAsB,EAAE,MAAM,oBAAoB,CAAA"}
@@ -57,8 +57,9 @@ export const externalValueResolver = (options) => {
57
57
  const resolvedValue = resolveReferencePath(context.origin, externalValue);
58
58
  if (options?.lazy) {
59
59
  const path = context.path.at(-2) === 'examples' ? context.path : (context.referencedFromPath ?? context.path);
60
- if (path.at(-2) !== 'examples' || isSchemaPath(path))
60
+ if (path.at(-2) !== 'examples' || isSchemaPath(path)) {
61
61
  return;
62
+ }
62
63
  // Preserve the referenced document origin before bundling loses that context.
63
64
  node['externalValue'] = resolvedValue;
64
65
  return;
@@ -1 +1 @@
1
- {"version":3,"file":"openapi-document.d.ts","sourceRoot":"","sources":["../../../src/plugins/bundler/openapi-document.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,gBAAgB,EAAE,KAAK,eAAe,EAAwB,MAAM,2BAA2B,CAAA;AAE7G,uFAAuF;AACvF,eAAO,MAAM,sBAAsB,EAAE,gBAcpC,CAAA;AAED,8FAA8F;AAC9F,eAAO,MAAM,eAAe,QAAO,eAsClC,CAAA"}
1
+ {"version":3,"file":"openapi-document.d.ts","sourceRoot":"","sources":["../../../src/plugins/bundler/openapi-document.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,gBAAgB,EAAE,KAAK,eAAe,EAAwB,MAAM,2BAA2B,CAAA;AAE7G,uFAAuF;AACvF,eAAO,MAAM,sBAAsB,EAAE,gBAcpC,CAAA;AAED,8FAA8F;AAC9F,eAAO,MAAM,eAAe,QAAO,eAwClC,CAAA"}
@@ -19,8 +19,9 @@ export const openApiDocument = () => {
19
19
  const authoredRefs = new WeakMap();
20
20
  const paths = new WeakMap();
21
21
  const indexPaths = (value, path) => {
22
- if (value === null || typeof value !== 'object' || paths.has(value))
22
+ if (value === null || typeof value !== 'object' || paths.has(value)) {
23
23
  return;
24
+ }
24
25
  paths.set(value, path);
25
26
  for (const [key, child] of Object.entries(value)) {
26
27
  indexPaths(child, [...path, key]);
@@ -1 +1 @@
1
- {"version":3,"file":"build-multipart.d.ts","sourceRoot":"","sources":["../../../../src/request-example/builder/body/build-multipart.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAEV,eAAe,EACf,YAAY,EACb,MAAM,8DAA8D,CAAA;AAQrE,sGAAsG;AACtG,MAAM,MAAM,aAAa,GAAG;IAC1B,GAAG,CAAC,EAAE,MAAM,CAAA;IACZ,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;CACjC,GAAG,CACA;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,GAC/B;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,IAAI,CAAA;CAAE,GAC7B;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,IAAI,CAAA;CAAE,GAC7B;IAAE,IAAI,EAAE,WAAW,CAAC;IAAC,KAAK,EAAE,aAAa,EAAE,CAAC;IAAC,WAAW,EAAE,MAAM,CAAA;CAAE,CACrE,CAAA;AAED,mFAAmF;AACnF,eAAO,MAAM,qBAAqB,GAAI,aAAa,MAAM,EAAE,OAAO,eAAe,KAAG,OASnF,CAAA;AAED,4EAA4E;AAC5E,eAAO,MAAM,sBAAsB,GAAI,aAAa,MAAM,EAAE,OAAO,eAAe,KAAG,OASpF,CAAA;AA4CD,sFAAsF;AACtF,eAAO,MAAM,sBAAsB,GACjC,QAAQ,YAAY,GAAG,SAAS,EAChC,OAAO,MAAM,EACb,aAAa,eAAe,CAAC,YAAY,CAAC,KACzC,YAAY,GAAG,SAMa,CAAA;AAc/B,6FAA6F;AAC7F,eAAO,MAAM,cAAc,GACzB,OAAO,OAAO,EACd,aAAa,MAAM,EACnB,WAAU,IAAI,CAAC,eAAe,EAAE,UAAU,GAAG,gBAAgB,GAAG,cAAc,GAAG,YAAY,CAAM,EACnG,SAAS,YAAY,EACrB,gBAAW,KACV,aAAa,EAkIf,CAAA"}
1
+ {"version":3,"file":"build-multipart.d.ts","sourceRoot":"","sources":["../../../../src/request-example/builder/body/build-multipart.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAEV,eAAe,EACf,YAAY,EACb,MAAM,8DAA8D,CAAA;AAQrE,sGAAsG;AACtG,MAAM,MAAM,aAAa,GAAG;IAC1B,GAAG,CAAC,EAAE,MAAM,CAAA;IACZ,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;CACjC,GAAG,CACA;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,GAC/B;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,IAAI,CAAA;CAAE,GAC7B;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,IAAI,CAAA;CAAE,GAC7B;IAAE,IAAI,EAAE,WAAW,CAAC;IAAC,KAAK,EAAE,aAAa,EAAE,CAAC;IAAC,WAAW,EAAE,MAAM,CAAA;CAAE,CACrE,CAAA;AAED,mFAAmF;AACnF,eAAO,MAAM,qBAAqB,GAAI,aAAa,MAAM,EAAE,OAAO,eAAe,KAAG,OASnF,CAAA;AAED,4EAA4E;AAC5E,eAAO,MAAM,sBAAsB,GAAI,aAAa,MAAM,EAAE,OAAO,eAAe,KAAG,OASpF,CAAA;AA4CD,sFAAsF;AACtF,eAAO,MAAM,sBAAsB,GACjC,QAAQ,YAAY,GAAG,SAAS,EAChC,OAAO,MAAM,EACb,aAAa,eAAe,CAAC,YAAY,CAAC,KACzC,YAAY,GAAG,SAMa,CAAA;AAc/B,6FAA6F;AAC7F,eAAO,MAAM,cAAc,GACzB,OAAO,OAAO,EACd,aAAa,MAAM,EACnB,WAAU,IAAI,CAAC,eAAe,EAAE,UAAU,GAAG,gBAAgB,GAAG,cAAc,GAAG,YAAY,CAAM,EACnG,SAAS,YAAY,EACrB,gBAAW,KACV,aAAa,EAmIf,CAAA"}
@@ -83,8 +83,9 @@ export const buildMultipart = (value, contentType, encoding = {}, schema, nestin
83
83
  }
84
84
  const named = parseMimeType(contentType).essence === 'multipart/form-data';
85
85
  const positional = Array.isArray(value);
86
- const entries = positional
87
- ? value.map((item, index) => {
86
+ let entries = [];
87
+ if (positional) {
88
+ entries = value.map((item, index) => {
88
89
  const itemEncoding = index < (encoding.prefixEncoding?.length ?? 0) ? encoding.prefixEncoding?.[index] : encoding.itemEncoding;
89
90
  const itemSchema = getMultipartItemSchema(schema, index, encoding.itemSchema);
90
91
  if (named && item !== null && typeof item === 'object' && !Array.isArray(item)) {
@@ -97,20 +98,21 @@ export const buildMultipart = (value, contentType, encoding = {}, schema, nestin
97
98
  return [entry[0], entry[1], itemEncoding, resolveLeafSchema(itemSchema, [entry[0]])];
98
99
  }
99
100
  return [undefined, item, itemEncoding, itemSchema];
100
- })
101
- : value !== null && typeof value === 'object'
102
- ? Object.entries(value).flatMap(([key, item]) => {
103
- const propertySchema = resolveLeafSchema(schema, [key]);
104
- return (Array.isArray(item) ? item : [item]).map((part) => [
105
- key,
106
- part,
107
- encoding.encoding?.[key],
108
- Array.isArray(item)
109
- ? getResolvedRef(propertySchema && isArraySchema(propertySchema) ? propertySchema.items : undefined, mergeSiblingReferences)
110
- : propertySchema,
111
- ]);
112
- })
113
- : [];
101
+ });
102
+ }
103
+ else if (value !== null && typeof value === 'object') {
104
+ entries = Object.entries(value).flatMap(([key, item]) => {
105
+ const propertySchema = resolveLeafSchema(schema, [key]);
106
+ return (Array.isArray(item) ? item : [item]).map((part) => [
107
+ key,
108
+ part,
109
+ encoding.encoding?.[key],
110
+ Array.isArray(item)
111
+ ? getResolvedRef(propertySchema && isArraySchema(propertySchema) ? propertySchema.items : undefined, mergeSiblingReferences)
112
+ : propertySchema,
113
+ ]);
114
+ });
115
+ }
114
116
  return entries.flatMap(([key, item, partEncoding, partSchema]) => {
115
117
  const style = named && hasEncodingStyle(partEncoding);
116
118
  const styleParts = style ? serializeFormPropertyWithEncoding(key ?? '', item, partEncoding) : null;
@@ -1 +1 @@
1
- {"version":3,"file":"encode-multipart-body.d.ts","sourceRoot":"","sources":["../../../../src/request-example/builder/body/encode-multipart-body.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAA;AA0BtD,sFAAsF;AACtF,eAAO,MAAM,sBAAsB,GACjC,OAAO,aAAa,EAAE,EACtB,oBAAmC,EACnC,UAAS,CAAC,KAAK,EAAE,MAAM,KAAK,MAAyB,EACrD,gBAAW,KACV;IAAE,MAAM,EAAE,QAAQ,EAAE,CAAC;IAAC,WAAW,EAAE,MAAM,CAAA;CA6C3C,CAAA;AAED,+FAA+F;AAC/F,eAAO,MAAM,mBAAmB,GAC9B,OAAO,aAAa,EAAE,EACtB,oBAAmC,EACnC,UAAU,CAAC,KAAK,EAAE,MAAM,KAAK,MAAM,KAClC,IAGF,CAAA"}
1
+ {"version":3,"file":"encode-multipart-body.d.ts","sourceRoot":"","sources":["../../../../src/request-example/builder/body/encode-multipart-body.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAA;AA0BtD,sFAAsF;AACtF,eAAO,MAAM,sBAAsB,GACjC,OAAO,aAAa,EAAE,EACtB,oBAAmC,EACnC,UAAS,CAAC,KAAK,EAAE,MAAM,KAAK,MAAyB,EACrD,gBAAW,KACV;IAAE,MAAM,EAAE,QAAQ,EAAE,CAAC;IAAC,WAAW,EAAE,MAAM,CAAA;CA8C3C,CAAA;AAED,+FAA+F;AAC/F,eAAO,MAAM,mBAAmB,GAC9B,OAAO,aAAa,EAAE,EACtB,oBAAmC,EACnC,UAAU,CAAC,KAAK,EAAE,MAAM,KAAK,MAAM,KAClC,IAGF,CAAA"}
@@ -33,7 +33,8 @@ export const serializeMultipartBody = (parts, contentType = 'multipart/form-data
33
33
  const encoded = part.type === 'multipart'
34
34
  ? serializeMultipartBody(part.value, part.contentType, replace, nesting + 1)
35
35
  : { chunks: [part.type === 'text' ? replace(part.value) : part.value], contentType: part.contentType };
36
- const filename = part.type === 'file' ? part.value.name : part.type === 'blob' ? 'blob' : undefined;
36
+ const blobFilename = part.type === 'blob' ? 'blob' : undefined;
37
+ const filename = part.type === 'file' ? part.value.name : blobFilename;
37
38
  const partContentType = encoded.contentType ??
38
39
  (part.type === 'file' || part.type === 'blob' ? part.value.type || 'application/octet-stream' : undefined);
39
40
  if (partContentType && /[\r\n\0]/.test(partContentType)) {
@@ -5,8 +5,8 @@ import type { ExampleObject, RequestBodyObject } from '@scalar/workspace-store/s
5
5
  * This is the schema-generation half of {@link getExampleFromBody}. It is exposed on its own so
6
6
  * callers that need to regenerate a body for a freshly selected composition branch (rather than the
7
7
  * edited example that would otherwise shadow it) produce the exact same value the initial example
8
- * does. Data generation deep-resolves nested `$ref` members. XML retains reference sites so node
9
- * naming and version-specific wrappers survive serialization.
8
+ * does. Keep reference sites intact so the generator can detect cycles without losing the schema
9
+ * at the recursion point. XML also needs them for node naming and version-specific wrappers.
10
10
  *
11
11
  * Returns `undefined` when there is no schema for the content type.
12
12
  */
@@ -1 +1 @@
1
- {"version":3,"file":"get-request-body-example.d.ts","sourceRoot":"","sources":["../../../../src/request-example/builder/body/get-request-body-example.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACV,aAAa,EACb,iBAAiB,EAElB,MAAM,8DAA8D,CAAA;AASrE;;;;;;;;;;GAUG;AACH,eAAO,MAAM,wBAAwB,GACnC,aAAa,iBAAiB,EAC9B,aAAa,MAAM,EACnB,kCAAkC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,EACxD,iBAAiB,MAAM,KACtB,OAgCF,CAAA;AAED;;GAEG;AACH,eAAO,MAAM,kBAAkB,GAC7B,aAAa,iBAAiB,EAC9B,aAAa,MAAM,EACnB,aAAa,MAAM,EACnB,kCAAkC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,EACxD,iBAAiB,MAAM,KACtB,aAAa,GAAG,IA0ClB,CAAA"}
1
+ {"version":3,"file":"get-request-body-example.d.ts","sourceRoot":"","sources":["../../../../src/request-example/builder/body/get-request-body-example.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACV,aAAa,EACb,iBAAiB,EAElB,MAAM,8DAA8D,CAAA;AAUrE;;;;;;;;;;GAUG;AACH,eAAO,MAAM,wBAAwB,GACnC,aAAa,iBAAiB,EAC9B,aAAa,MAAM,EACnB,kCAAkC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,EACxD,iBAAiB,MAAM,KACtB,OA8BF,CAAA;AAED;;GAEG;AACH,eAAO,MAAM,kBAAkB,GAC7B,aAAa,iBAAiB,EAC9B,aAAa,MAAM,EACnB,aAAa,MAAM,EACnB,kCAAkC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,EACxD,iBAAiB,MAAM,KACtB,aAAa,GAAG,IA4ClB,CAAA"}
@@ -1,8 +1,9 @@
1
1
  import { isXmlMediaType } from '@scalar/helpers/http/is-xml-media-type';
2
2
  import { parseMimeType } from '@scalar/helpers/http/mime-type';
3
3
  import { getExampleValue } from '../../../helpers/get-example-value.js';
4
- import { getResolvedRefDeep } from '../../../helpers/get-resolved-ref-deep.js';
4
+ import { getResolvedRef } from '../../../helpers/get-resolved-ref.js';
5
5
  import { serializeStreamExample } from '../../../helpers/serialize-stream-example.js';
6
+ import { snapshotSchema } from '../../../helpers/snapshot-schema.js';
6
7
  import { getExample } from '../../../request-example/builder/helpers/get-example.js';
7
8
  import { getExampleFromSchema } from '../../../request-example/builder/helpers/get-example-from-schema.js';
8
9
  import { getXmlBodyExample } from '../../../request-example/xml/get-xml-body-example.js';
@@ -12,8 +13,8 @@ import { getXmlBodyExample } from '../../../request-example/xml/get-xml-body-exa
12
13
  * This is the schema-generation half of {@link getExampleFromBody}. It is exposed on its own so
13
14
  * callers that need to regenerate a body for a freshly selected composition branch (rather than the
14
15
  * edited example that would otherwise shadow it) produce the exact same value the initial example
15
- * does. Data generation deep-resolves nested `$ref` members. XML retains reference sites so node
16
- * naming and version-specific wrappers survive serialization.
16
+ * does. Keep reference sites intact so the generator can detect cycles without losing the schema
17
+ * at the recursion point. XML also needs them for node naming and version-specific wrappers.
17
18
  *
18
19
  * Returns `undefined` when there is no schema for the content type.
19
20
  */
@@ -31,11 +32,10 @@ export const getSchemaExampleFromBody = (requestBody, contentType, requestBodyCo
31
32
  schemaPath: ['requestBody'],
32
33
  }).xml;
33
34
  }
34
- if (!schema) {
35
+ if (!schema || getResolvedRef(schema) === undefined) {
35
36
  return undefined;
36
37
  }
37
- const resolvedSchema = getResolvedRefDeep(schema);
38
- const value = getExampleFromSchema(resolvedSchema, {
38
+ const value = getExampleFromSchema(snapshotSchema(schema), {
39
39
  mode: 'write',
40
40
  compositionSelection: requestBodyCompositionSelection,
41
41
  }, {
@@ -58,8 +58,9 @@ export const getExampleFromBody = (requestBody, contentType, exampleName, reques
58
58
  compositionSelection: requestBodyCompositionSelection,
59
59
  schemaPath: ['requestBody'],
60
60
  });
61
- if (result.xml === undefined)
61
+ if (result.xml === undefined) {
62
62
  return null;
63
+ }
63
64
  // Consumers select dataValue before value, so retain the serialized result for editor and wire output.
64
65
  return example?.dataValue !== undefined
65
66
  ? { ...example, value: result.xml, serializedValue: result.xml }
@@ -1 +1 @@
1
- {"version":3,"file":"schema-value-coercion.d.ts","sourceRoot":"","sources":["../../../../src/request-example/builder/body/schema-value-coercion.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,8DAA8D,CAAA;AAShG;;;GAGG;AACH,eAAO,MAAM,iBAAiB,GAAI,QAAQ,YAAY,GAAG,SAAS,EAAE,UAAU,MAAM,EAAE,KAAG,YAAY,GAAG,SASvG,CAAA;AA2BD;;;;;;;;GAQG;AACH,eAAO,MAAM,2BAA2B,GAAI,OAAO,OAAO,EAAE,QAAQ,YAAY,GAAG,SAAS,KAAG,OAe9F,CAAA;AAED;;;;;;;GAOG;AACH,eAAO,MAAM,kBAAkB,GAAI,OAAO,OAAO,KAAG,OAUnD,CAAA;AAED;;;;;;GAMG;AACH,eAAO,MAAM,6BAA6B,GAAI,QAAQ,OAAO,aAG1C,MAAM,UAAU,OAAO,YAgBzC,CAAA"}
1
+ {"version":3,"file":"schema-value-coercion.d.ts","sourceRoot":"","sources":["../../../../src/request-example/builder/body/schema-value-coercion.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,8DAA8D,CAAA;AAYhG;;;GAGG;AACH,eAAO,MAAM,iBAAiB,GAAI,QAAQ,YAAY,GAAG,SAAS,EAAE,UAAU,MAAM,EAAE,KAAG,YAAY,GAAG,SASvG,CAAA;AA2BD;;;;;;;;GAQG;AACH,eAAO,MAAM,2BAA2B,GAAI,OAAO,OAAO,EAAE,QAAQ,YAAY,GAAG,SAAS,KAAG,OAe9F,CAAA;AAED;;;;;;;GAOG;AACH,eAAO,MAAM,kBAAkB,GAAI,OAAO,OAAO,KAAG,OAUnD,CAAA;AAED;;;;;;GAMG;AACH,eAAO,MAAM,6BAA6B,GAAI,QAAQ,OAAO,aAG1C,MAAM,UAAU,OAAO,YAgBzC,CAAA"}
@@ -3,7 +3,10 @@ import { isObjectSchema } from '@scalar/workspace-store/schemas/v3.2/strict/type
3
3
  /** Normalize a schema's `type` (string | string[] | absent) into a plain string array. */
4
4
  const normalizeSchemaTypes = (schema) => {
5
5
  const type = 'type' in schema ? schema.type : undefined;
6
- return Array.isArray(type) ? [...type] : type == null ? [] : [type];
6
+ if (Array.isArray(type)) {
7
+ return [...type];
8
+ }
9
+ return type == null ? [] : [type];
7
10
  };
8
11
  /**
9
12
  * Walk an object schema along a dotted-row path and return the resolved leaf schema,
@@ -1 +1 @@
1
- {"version":3,"file":"build-request-parameters.d.ts","sourceRoot":"","sources":["../../../../src/request-example/builder/header/build-request-parameters.ts"],"names":[],"mappings":"AAIA,OAAO,EACL,KAAK,aAAa,EAEnB,MAAM,qEAAqE,CAAA;AAE5E,OAAO,KAAK,EAAE,eAAe,EAAE,aAAa,EAAE,MAAM,8DAA8D,CAAA;AAElH,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,iCAAiC,CAAA;AAoB5E;;;;;;;;;GASG;AACH,eAAO,MAAM,sBAAsB;AACjC,qBAAqB;AACrB,aAAY,aAAa,CAAC,eAAe,CAAC,EAAO;AACjD,qCAAqC;AACrC,cAAa,MAAkB;AAC/B,6DAA6D;AAC7D,iBAAiB,MAAM,KACtB;IACD,OAAO,EAAE,aAAa,EAAE,CAAA;IACxB,0EAA0E;IAC1E,YAAY,CAAC,EAAE,MAAM,EAAE,CAAA;IACvB,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;IAC/B,aAAa,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;IACrC,sBAAsB,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,qBAAqB,CAAC,CAAA;IAC9D,4BAA4B,EAAE,GAAG,CAAC,MAAM,CAAC,CAAA;IACzC,SAAS,EAAE,eAAe,CAAA;IAC1B,eAAe,CAAC,EAAE,MAAM,EAAE,CAAA;IAC1B,wBAAwB,CAAC,EAAE,GAAG,CAAC,MAAM,CAAC,CAAA;CA+JvC,CAAA"}
1
+ {"version":3,"file":"build-request-parameters.d.ts","sourceRoot":"","sources":["../../../../src/request-example/builder/header/build-request-parameters.ts"],"names":[],"mappings":"AAIA,OAAO,EACL,KAAK,aAAa,EAEnB,MAAM,qEAAqE,CAAA;AAE5E,OAAO,KAAK,EAAE,eAAe,EAAE,aAAa,EAAE,MAAM,8DAA8D,CAAA;AAElH,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,iCAAiC,CAAA;AAqB5E;;;;;;;;;GASG;AACH,eAAO,MAAM,sBAAsB;AACjC,qBAAqB;AACrB,aAAY,aAAa,CAAC,eAAe,CAAC,EAAO;AACjD,qCAAqC;AACrC,cAAa,MAAkB;AAC/B,6DAA6D;AAC7D,iBAAiB,MAAM,KACtB;IACD,OAAO,EAAE,aAAa,EAAE,CAAA;IACxB,0EAA0E;IAC1E,YAAY,CAAC,EAAE,MAAM,EAAE,CAAA;IACvB,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;IAC/B,aAAa,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;IACrC,sBAAsB,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,qBAAqB,CAAC,CAAA;IAC9D,4BAA4B,EAAE,GAAG,CAAC,MAAM,CAAC,CAAA;IACzC,SAAS,EAAE,eAAe,CAAA;IAC1B,eAAe,CAAC,EAAE,MAAM,EAAE,CAAA;IAC1B,wBAAwB,CAAC,EAAE,GAAG,CAAC,MAAM,CAAC,CAAA;CAyKvC,CAAA"}
@@ -6,6 +6,7 @@ import { xScalarCookieSchema, } from '@scalar/workspace-store/schemas/extensions
6
6
  import { coerceValue } from '@scalar/workspace-store/schemas/typebox-coerce';
7
7
  import { getParameterExample } from '../../../helpers/get-parameter-example.js';
8
8
  import { deSerializeParameter } from '../../../request-example/builder/header/de-serialize-parameter.js';
9
+ import { filterDisabledProperties } from './filter-disabled-properties.js';
9
10
  import { isParamDisabled } from './is-param-disabled.js';
10
11
  import { serializeContentValue, serializeCookieStyle, serializeDeepObjectStyle, serializeFormStyle, serializeFormStyleForCookies, serializePipeDelimitedStyle, serializeSimpleStyle, serializeSpaceDelimitedStyle, } from './serialize-parameter.js';
11
12
  /** Helper to get explode value with default */
@@ -47,7 +48,10 @@ openapiVersion) => {
47
48
  const selected = getParameterExample(param, exampleName);
48
49
  const { example, value } = selected;
49
50
  // Skip disabled examples
50
- if (!example || isParamDisabled(param, example)) {
51
+ const propertyStates = param.in === 'query' && !selected.serialized && !selected.mediaSerialized
52
+ ? example?.['x-scalar-disabled-properties']
53
+ : undefined;
54
+ if (!example || (!propertyStates && isParamDisabled(param, example))) {
51
55
  continue;
52
56
  }
53
57
  /** Parameter-level wire text already contains its name, delimiters, and encoding. */
@@ -94,7 +98,13 @@ openapiVersion) => {
94
98
  continue;
95
99
  }
96
100
  /** De-serialize the example value if it is a string and matches the schema type */
97
- const deSerializedValue = deSerializeParameter(value, param);
101
+ const fullValue = deSerializeParameter(value, param);
102
+ const deSerializedValue = propertyStates
103
+ ? filterDisabledProperties(fullValue, propertyStates, isParamDisabled(param, example))
104
+ : fullValue;
105
+ if (propertyStates && deSerializedValue === undefined) {
106
+ continue;
107
+ }
98
108
  const paramName = param.name;
99
109
  // Handle by parameter location
100
110
  switch (param.in) {
@@ -0,0 +1,3 @@
1
+ /** Build the enabled portion of a query object without discarding stored disabled values. */
2
+ export declare const filterDisabledProperties: (value: unknown, states: Record<string, boolean>, inheritedDisabled: boolean, path?: string[]) => unknown;
3
+ //# sourceMappingURL=filter-disabled-properties.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"filter-disabled-properties.d.ts","sourceRoot":"","sources":["../../../../src/request-example/builder/header/filter-disabled-properties.ts"],"names":[],"mappings":"AAEA,6FAA6F;AAC7F,eAAO,MAAM,wBAAwB,GACnC,OAAO,OAAO,EACd,QAAQ,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC/B,mBAAmB,OAAO,EAC1B,OAAM,MAAM,EAAO,KAClB,OAgBF,CAAA"}
@@ -0,0 +1,18 @@
1
+ import { isObject } from '@scalar/helpers/object/is-object';
2
+ /** Build the enabled portion of a query object without discarding stored disabled values. */
3
+ export const filterDisabledProperties = (value, states, inheritedDisabled, path = []) => {
4
+ const disabled = states[JSON.stringify(path)] ?? inheritedDisabled;
5
+ if (!isObject(value) || Array.isArray(value)) {
6
+ return disabled ? undefined : value;
7
+ }
8
+ const entries = Object.entries(value);
9
+ const enabled = entries.flatMap(([key, child]) => {
10
+ const filtered = filterDisabledProperties(child, states, disabled, [...path, key]);
11
+ return filtered === undefined ? [] : [[key, filtered]];
12
+ });
13
+ // Do not serialize parents whose children were all excluded.
14
+ if (enabled.length === 0 && (disabled || entries.length > 0)) {
15
+ return undefined;
16
+ }
17
+ return Object.fromEntries(enabled);
18
+ };
@@ -3,7 +3,7 @@ import type { XScalarCookie } from '@scalar/workspace-store/schemas/extensions/g
3
3
  * Filter a global cookie to determine if it should be included with a request to the given URL.
4
4
  * - Returns false if the cookie is disabled, in the disabledGlobalCookies map, or missing a name.
5
5
  * - Returns false if the domain does not match.
6
- * - Returns false if the path is specified and does not match the URL pathname.
6
+ * - Returns false if the path is specified and the request pathname does not path-match it.
7
7
  * - Returns true otherwise.
8
8
  */
9
9
  export declare const filterGlobalCookie: ({ cookie, url, disabledGlobalCookies, }: {
@@ -1 +1 @@
1
- {"version":3,"file":"filter-global-cookies.d.ts","sourceRoot":"","sources":["../../../../src/request-example/builder/header/filter-global-cookies.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,qEAAqE,CAAA;AAIxG;;;;;;GAMG;AACH,eAAO,MAAM,kBAAkB,GAAI,yCAIhC;IACD,MAAM,EAAE,aAAa,CAAA;IACrB,GAAG,EAAE,MAAM,CAAA;IACX,qBAAqB,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;CAC/C,KAAG,OAqBH,CAAA"}
1
+ {"version":3,"file":"filter-global-cookies.d.ts","sourceRoot":"","sources":["../../../../src/request-example/builder/header/filter-global-cookies.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,qEAAqE,CAAA;AAiBxG;;;;;;GAMG;AACH,eAAO,MAAM,kBAAkB,GAAI,yCAIhC;IACD,MAAM,EAAE,aAAa,CAAA;IACrB,GAAG,EAAE,MAAM,CAAA;IACX,qBAAqB,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;CAC/C,KAAG,OAsBH,CAAA"}
@@ -1,9 +1,20 @@
1
1
  import { matchesDomain } from './matches-domain.js';
2
+ /**
3
+ * RFC 6265 path-match: cookie-path C matches request-path R when they are the same,
4
+ * or C is a prefix of R and the next character is a slash. A trailing slash on C
5
+ * already supplies that boundary, so `/api` matches `/api/users` but not `/apiv2`.
6
+ */
7
+ const pathMatches = (requestPath, cookiePath) => {
8
+ if (requestPath === cookiePath || cookiePath.endsWith('/')) {
9
+ return requestPath.startsWith(cookiePath);
10
+ }
11
+ return requestPath.startsWith(`${cookiePath}/`);
12
+ };
2
13
  /**
3
14
  * Filter a global cookie to determine if it should be included with a request to the given URL.
4
15
  * - Returns false if the cookie is disabled, in the disabledGlobalCookies map, or missing a name.
5
16
  * - Returns false if the domain does not match.
6
- * - Returns false if the path is specified and does not match the URL pathname.
17
+ * - Returns false if the path is specified and the request pathname does not path-match it.
7
18
  * - Returns true otherwise.
8
19
  */
9
20
  export const filterGlobalCookie = ({ cookie, url, disabledGlobalCookies, }) => {
@@ -17,8 +28,9 @@ export const filterGlobalCookie = ({ cookie, url, disabledGlobalCookies, }) => {
17
28
  if (cookie.domain && !matchesDomain(url, cookie.domain)) {
18
29
  return false;
19
30
  }
20
- // If a path restriction exists, ensure the cookie is only sent for URLs with a matching prefix.
21
- if (cookie.path && !urlObject.pathname.startsWith(cookie.path)) {
31
+ // An empty path means no path restriction. Otherwise require an RFC 6265 path-match,
32
+ // so a cookie for `/api` is not sent to `/apiv2`.
33
+ if (cookie.path && !pathMatches(urlObject.pathname, cookie.path)) {
22
34
  return false;
23
35
  }
24
36
  // Cookie passed all checks; include it in the request.
@@ -3,7 +3,7 @@ import type { ExampleObject, ParameterObject } from '@scalar/workspace-store/sch
3
3
  * Determines if a parameter is disabled
4
4
  *
5
5
  * First we explicitly check if its been disabled via the `x-disabled` extension.
6
- * Populated examples are enabled unless explicitly disabled. Empty optional parameters stay disabled.
6
+ * Authored populated examples are enabled unless explicitly disabled. Empty optional parameters stay disabled.
7
7
  *
8
8
  * @param param - The parameter to check.
9
9
  * @param example - The example to check.
@@ -1 +1 @@
1
- {"version":3,"file":"is-param-disabled.d.ts","sourceRoot":"","sources":["../../../../src/request-example/builder/header/is-param-disabled.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,8DAA8D,CAAA;AAIlH;;;;;;;;;;GAUG;AACH,eAAO,MAAM,eAAe,GAC1B,OAAO,eAAe,EACtB,SAAS,aAAa,GAAG,SAAS,EAClC,kBAAiB,OAAc,KAC9B,OAiBF,CAAA"}
1
+ {"version":3,"file":"is-param-disabled.d.ts","sourceRoot":"","sources":["../../../../src/request-example/builder/header/is-param-disabled.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,8DAA8D,CAAA;AAKlH;;;;;;;;;;GAUG;AACH,eAAO,MAAM,eAAe,GAC1B,OAAO,eAAe,EACtB,SAAS,aAAa,GAAG,SAAS,EAClC,kBAAiB,OAAc,KAC9B,OAiBF,CAAA"}
@@ -1,9 +1,10 @@
1
1
  import { getExampleValue } from '../../../helpers/get-example-value.js';
2
+ import { isGeneratedExample } from '../../../request-example/builder/helpers/get-example.js';
2
3
  /**
3
4
  * Determines if a parameter is disabled
4
5
  *
5
6
  * First we explicitly check if its been disabled via the `x-disabled` extension.
6
- * Populated examples are enabled unless explicitly disabled. Empty optional parameters stay disabled.
7
+ * Authored populated examples are enabled unless explicitly disabled. Empty optional parameters stay disabled.
7
8
  *
8
9
  * @param param - The parameter to check.
9
10
  * @param example - The example to check.
@@ -18,7 +19,7 @@ export const isParamDisabled = (param, example, defaultDisabled = true) => {
18
19
  }
19
20
  // Keep the editor, generated snippets, and outgoing requests aligned for pre-populated values.
20
21
  const value = getExampleValue(example)?.value;
21
- const hasValue = value !== undefined && value !== '' && value !== null;
22
+ const hasValue = value !== undefined && value !== '' && value !== null && !isGeneratedExample(example);
22
23
  if (!defaultDisabled || hasValue) {
23
24
  return false;
24
25
  }
@@ -1 +1 @@
1
- {"version":3,"file":"get-example-from-schema.d.ts","sourceRoot":"","sources":["../../../../src/request-example/builder/helpers/get-example-from-schema.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,KAAK,YAAY,EAAqD,MAAM,uBAAuB,CAAA;AAG5G,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,wCAAwC,CAAA;AAE1E,OAAO,EAAE,kBAAkB,EAA0B,KAAK,sBAAsB,EAAE,MAAM,sBAAsB,CAAA;AAwZ9G,gGAAgG;AAChG,eAAO,MAAM,wBAAwB,GACnC,QAAQ,YAAY,EACpB,YAAY,MAAM,EAAE,EACpB,UAAU,2BAA2B,EACrC,mBAAiB,EACjB,QAAQ,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAC9B,YAAY,GAAG,SAmBjB,CAAA;AAuZD,sEAAsE;AACtE,MAAM,MAAM,2BAA2B,GAAG;IACxC,2EAA2E;IAC3E,CAAC,kBAAkB,CAAC,CAAC,EAAE,sBAAsB,CAAA;IAC7C,mFAAmF;IACnF,YAAY,CAAC,EAAE,OAAO,CAAA;IACtB,+CAA+C;IAC/C,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,kFAAkF;IAClF,GAAG,CAAC,EAAE,OAAO,CAAA;IACb,uDAAuD;IACvD,IAAI,CAAC,EAAE,MAAM,GAAG,OAAO,CAAA;IACvB,iEAAiE;IACjE,SAAS,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;IACnC,qDAAqD;IACrD,8BAA8B,CAAC,EAAE,OAAO,CAAA;IACxC;;;;;;OAMG;IACH,iBAAiB,CAAC,EAAE,OAAO,CAAA;IAC3B,0DAA0D;IAC1D,oBAAoB,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;CAC9C,CAAA;AAwPD;;;;;;;;;;;;;;GAcG;AACH,QAAA,MAAM,yBAAyB,GAC7B,QAAQ,YAAY,EACpB,UAAU,2BAA2B,EACrC,iEAOG,OAAO,CAAC;IACT,KAAK,EAAE,MAAM,CAAA;IACb,YAAY,EAAE,YAAY,CAAA;IAC1B,IAAI,EAAE,MAAM,CAAA;IACZ,IAAI,EAAE,OAAO,CAAC,MAAM,CAAC,CAAA;IACrB,6EAA6E;IAC7E,UAAU,EAAE,MAAM,EAAE,CAAA;IACpB,qGAAqG;IACrG,YAAY,EAAE,YAAY,CAAA;CAC3B,CAAM,KACN,OA8OF,CAAA;AAoBD,gGAAgG;AAChG,eAAO,MAAM,oBAAoB,GAC/B,QAAQ,YAAY,EACpB,UAAU,2BAA2B,EACrC,UAAS,UAAU,CAAC,OAAO,yBAAyB,CAAC,CAAC,CAAC,CAAM,KAC5D,OA2BF,CAAA"}
1
+ {"version":3,"file":"get-example-from-schema.d.ts","sourceRoot":"","sources":["../../../../src/request-example/builder/helpers/get-example-from-schema.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,KAAK,YAAY,EAAqD,MAAM,uBAAuB,CAAA;AAG5G,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,wCAAwC,CAAA;AAE1E,OAAO,EAAE,kBAAkB,EAA0B,KAAK,sBAAsB,EAAE,MAAM,sBAAsB,CAAA;AAwZ9G,gGAAgG;AAChG,eAAO,MAAM,wBAAwB,GACnC,QAAQ,YAAY,EACpB,YAAY,MAAM,EAAE,EACpB,UAAU,2BAA2B,EACrC,mBAAiB,EACjB,QAAQ,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAC9B,YAAY,GAAG,SAoBjB,CAAA;AAiaD,sEAAsE;AACtE,MAAM,MAAM,2BAA2B,GAAG;IACxC,2EAA2E;IAC3E,CAAC,kBAAkB,CAAC,CAAC,EAAE,sBAAsB,CAAA;IAC7C,mFAAmF;IACnF,YAAY,CAAC,EAAE,OAAO,CAAA;IACtB,+CAA+C;IAC/C,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,kFAAkF;IAClF,GAAG,CAAC,EAAE,OAAO,CAAA;IACb,uDAAuD;IACvD,IAAI,CAAC,EAAE,MAAM,GAAG,OAAO,CAAA;IACvB,iEAAiE;IACjE,SAAS,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;IACnC,qDAAqD;IACrD,8BAA8B,CAAC,EAAE,OAAO,CAAA;IACxC;;;;;;OAMG;IACH,iBAAiB,CAAC,EAAE,OAAO,CAAA;IAC3B,0DAA0D;IAC1D,oBAAoB,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;CAC9C,CAAA;AAyPD;;;;;;;;;;;;;;GAcG;AACH,QAAA,MAAM,yBAAyB,GAC7B,QAAQ,YAAY,EACpB,UAAU,2BAA2B,EACrC,iEAOG,OAAO,CAAC;IACT,KAAK,EAAE,MAAM,CAAA;IACb,YAAY,EAAE,YAAY,CAAA;IAC1B,IAAI,EAAE,MAAM,CAAA;IACZ,IAAI,EAAE,OAAO,CAAC,MAAM,CAAC,CAAA;IACrB,6EAA6E;IAC7E,UAAU,EAAE,MAAM,EAAE,CAAA;IACpB,qGAAqG;IACrG,YAAY,EAAE,YAAY,CAAA;CAC3B,CAAM,KACN,OAgPF,CAAA;AAoBD,gGAAgG;AAChG,eAAO,MAAM,oBAAoB,GAC/B,QAAQ,YAAY,EACpB,UAAU,2BAA2B,EACrC,UAAS,UAAU,CAAC,OAAO,yBAAyB,CAAC,CAAC,CAAC,CAAM,KAC5D,OA2BF,CAAA"}
@@ -324,7 +324,8 @@ const consumeCompositionSelection = (options, schemaPath, composition) => {
324
324
  };
325
325
  /** Select a composition branch once for both generated values and supplied example metadata. */
326
326
  export const selectExampleComposition = (schema, schemaPath, options, arrayItem = false, value) => {
327
- const keyword = schema.oneOf ? 'oneOf' : schema.anyOf ? 'anyOf' : undefined;
327
+ const anyOfKeyword = schema.anyOf ? 'anyOf' : undefined;
328
+ const keyword = schema.oneOf ? 'oneOf' : anyOfKeyword;
328
329
  const members = keyword ? schema[keyword] : undefined;
329
330
  if (!keyword || !members?.length) {
330
331
  return undefined;
@@ -472,16 +473,14 @@ const handleObjectSchema = (schema, options, level, seen, cacheKey, schemaPath,
472
473
  // Use propertyNames enum values as example keys when no custom name is set
473
474
  const propertyNamesEnum = hasCustomName ? undefined : getPropertyNamesEnumValues(schema);
474
475
  const additionalName = hasCustomName ? customName.trim() : DEFAULT_ADDITIONAL_PROPERTIES_NAME;
475
- const additionalValue = isAnyType
476
- ? 'anything'
477
- : typeof additional === 'object'
478
- ? getExampleFromSchema(additional, options, {
479
- level: level + 1,
480
- schemaPath: [...schemaPath, additionalName],
481
- seen,
482
- dynamicScope: childScope,
483
- })
484
- : 'anything';
476
+ const additionalValue = !isAnyType && typeof additional === 'object'
477
+ ? getExampleFromSchema(additional, options, {
478
+ level: level + 1,
479
+ schemaPath: [...schemaPath, additionalName],
480
+ seen,
481
+ dynamicScope: childScope,
482
+ })
483
+ : 'anything';
485
484
  if (propertyNamesEnum && propertyNamesEnum.length > 0) {
486
485
  // Use the first enum value as a realistic example key
487
486
  response[String(propertyNamesEnum[0])] = additionalValue;
@@ -490,7 +489,8 @@ const handleObjectSchema = (schema, options, level, seen, cacheKey, schemaPath,
490
489
  response[additionalName] = additionalValue;
491
490
  }
492
491
  }
493
- const compositionKeyword = schema.oneOf ? 'oneOf' : schema.anyOf ? 'anyOf' : undefined;
492
+ const anyOfKeyword = schema.anyOf ? 'anyOf' : undefined;
493
+ const compositionKeyword = schema.oneOf ? 'oneOf' : anyOfKeyword;
494
494
  const oneOfAnyOf = compositionKeyword ? schema[compositionKeyword] : undefined;
495
495
  if (compositionKeyword && oneOfAnyOf?.length) {
496
496
  const chosen = selectExampleComposition(schema, schemaPath, options, false, response);
@@ -593,7 +593,8 @@ const handleArraySchema = (schema, options, level, seen, cacheKey, schemaPath, d
593
593
  .filter(isDefined);
594
594
  return cache(schema, wrapItems ? examples.map((e) => ({ [itemsXmlTagName]: e })) : examples, cacheKey, skipCache);
595
595
  }
596
- const compositionKeyword = items.oneOf ? 'oneOf' : items.anyOf ? 'anyOf' : undefined;
596
+ const anyOfKeyword = items.anyOf ? 'anyOf' : undefined;
597
+ const compositionKeyword = items.oneOf ? 'oneOf' : anyOfKeyword;
597
598
  const union = compositionKeyword ? items[compositionKeyword] : undefined;
598
599
  if (compositionKeyword && union && union.length > 0) {
599
600
  const selectedIndex = getCompositionSelectionIndex(itemsSchemaPath, compositionKeyword, options, union.length) ??
@@ -607,6 +608,9 @@ const handleArraySchema = (schema, options, level, seen, cacheKey, schemaPath, d
607
608
  seen: itemsSeen,
608
609
  dynamicScope: childScope,
609
610
  });
611
+ if (ex === undefined) {
612
+ return undefined;
613
+ }
610
614
  return cache(schema, wrapItems ? [{ [itemsXmlTagName]: ex }] : [ex], cacheKey, skipCache);
611
615
  }
612
616
  }
@@ -619,6 +623,10 @@ const handleArraySchema = (schema, options, level, seen, cacheKey, schemaPath, d
619
623
  seen: itemsSeen,
620
624
  dynamicScope: childScope,
621
625
  });
626
+ // Propagate an omitted recursive item so optional arrays do not serialize it as null.
627
+ if (ex === undefined) {
628
+ return undefined;
629
+ }
622
630
  return cache(schema, wrapItems ? [{ [itemsXmlTagName]: ex }] : [ex], cacheKey, skipCache);
623
631
  }
624
632
  return cache(schema, [], cacheKey, skipCache);
@@ -730,7 +738,8 @@ const getEmptyContainer = (schema) => {
730
738
  };
731
739
  /** Pick the `oneOf`/`anyOf` variant the walk itself would have rendered, honoring an explicit selection. */
732
740
  const getSelectedVariant = (schema, options, schemaPath) => {
733
- const compositionKeyword = schema.oneOf ? 'oneOf' : schema.anyOf ? 'anyOf' : undefined;
741
+ const anyOfKeyword = schema.anyOf ? 'anyOf' : undefined;
742
+ const compositionKeyword = schema.oneOf ? 'oneOf' : anyOfKeyword;
734
743
  const variants = compositionKeyword ? schema[compositionKeyword] : undefined;
735
744
  if (!compositionKeyword || !Array.isArray(variants) || variants.length === 0) {
736
745
  return undefined;
@@ -990,7 +999,8 @@ const generateExampleFromSchema = (schema, options, { level = 0, parentSchema, n
990
999
  }
991
1000
  // Resolve non-object unions before type dispatch so shared root keywords do not
992
1001
  // hide the selected member. Use the same selection and discriminator rules as other unions.
993
- const selectedComposition = _schema.oneOf ? 'oneOf' : _schema.anyOf ? 'anyOf' : undefined;
1002
+ const selectedAnyOf = _schema.anyOf ? 'anyOf' : undefined;
1003
+ const selectedComposition = _schema.oneOf ? 'oneOf' : selectedAnyOf;
994
1004
  const selectedVariant = getSelectedVariant(_schema, options, schemaPath);
995
1005
  if (selectedComposition && selectedVariant) {
996
1006
  const rootType = 'type' in _schema ? _schema.type : undefined;
@@ -1037,7 +1047,8 @@ const generateExampleFromSchema = (schema, options, { level = 0, parentSchema, n
1037
1047
  return cache(_schema, primitive, cacheKey, skipCache);
1038
1048
  }
1039
1049
  // Handle composition schemas (oneOf, anyOf)
1040
- const compositionKeyword = _schema.oneOf ? 'oneOf' : _schema.anyOf ? 'anyOf' : undefined;
1050
+ const anyOfKeyword = _schema.anyOf ? 'anyOf' : undefined;
1051
+ const compositionKeyword = _schema.oneOf ? 'oneOf' : anyOfKeyword;
1041
1052
  const discriminate = compositionKeyword ? _schema[compositionKeyword] : undefined;
1042
1053
  if (compositionKeyword && Array.isArray(discriminate) && discriminate.length > 0) {
1043
1054
  const candidate = selectExampleComposition(_schema, schemaPath, options);
@@ -1,4 +1,6 @@
1
1
  import type { ExampleObject, MediaTypeObject, ParameterObject, RequestBodyObject } from '@scalar/workspace-store/schemas/v3.2/strict/openapi-document';
2
+ /** Whether an example contains only enum suggestions rather than authored values. */
3
+ export declare const isGeneratedExample: (example: ExampleObject | undefined) => boolean;
2
4
  /**
3
5
  * Resolve an example value for a parameter or requestBody from either `examples` or `content.*.examples`.
4
6
  * Or the [deprecated] `example` field.
@@ -1 +1 @@
1
- {"version":3,"file":"get-example.d.ts","sourceRoot":"","sources":["../../../../src/request-example/builder/helpers/get-example.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,aAAa,EACb,eAAe,EACf,eAAe,EACf,iBAAiB,EAGlB,MAAM,8DAA8D,CAAA;AAoHrE;;;;;;;;GAQG;AACH,eAAO,MAAM,UAAU,GACrB,OAAO,eAAe,GAAG,iBAAiB,GAAG,eAAe,EAC5D,aAAa,MAAM,GAAG,SAAS,EAC/B,aAAa,MAAM,GAAG,SAAS,KAC9B,aAAa,GAAG,SAyBlB,CAAA"}
1
+ {"version":3,"file":"get-example.d.ts","sourceRoot":"","sources":["../../../../src/request-example/builder/helpers/get-example.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,aAAa,EACb,eAAe,EACf,eAAe,EACf,iBAAiB,EAGlB,MAAM,8DAA8D,CAAA;AAQrE,qFAAqF;AACrF,eAAO,MAAM,kBAAkB,GAAI,SAAS,aAAa,GAAG,SAAS,KAAG,OACf,CAAA;AAuHzD;;;;;;;;GAQG;AACH,eAAO,MAAM,UAAU,GACrB,OAAO,eAAe,GAAG,iBAAiB,GAAG,eAAe,EAC5D,aAAa,MAAM,GAAG,SAAS,EAC/B,aAAa,MAAM,GAAG,SAAS,KAC9B,aAAa,GAAG,SAyBlB,CAAA"}
@@ -1,5 +1,9 @@
1
1
  import { getResolvedRef } from '../../../helpers/get-resolved-ref.js';
2
2
  import { resolve } from '../../../resolve.js';
3
+ // Keep suggestion provenance out of API descriptions and persisted user examples.
4
+ const generatedExamples = new WeakSet();
5
+ /** Whether an example contains only enum suggestions rather than authored values. */
6
+ export const isGeneratedExample = (example) => example !== undefined && generatedExamples.has(example);
3
7
  /** Helper to get example from examples object with fallback to example field */
4
8
  const getExampleFromExamples = (examples, exampleField, exampleName) => {
5
9
  if (!examples && exampleField === undefined) {
@@ -34,15 +38,17 @@ const getSchemaExample = (input, walk = { ancestors: new Set(), withoutValues: n
34
38
  if ('default' in schema && schema.default !== undefined) {
35
39
  return { value: schema.default };
36
40
  }
37
- if ('enum' in schema && schema.enum?.[0] !== undefined) {
38
- return { value: schema.enum[0] };
39
- }
40
41
  if ('examples' in schema && schema.examples?.[0] !== undefined) {
41
42
  return { value: schema.examples[0] };
42
43
  }
43
44
  if ('example' in schema && schema.example !== undefined) {
44
45
  return { value: schema.example };
45
46
  }
47
+ if ('enum' in schema && schema.enum?.[0] !== undefined) {
48
+ const example = { value: schema.enum[0] };
49
+ generatedExamples.add(example);
50
+ return example;
51
+ }
46
52
  // Reference siblings create a fresh merged object, so track the underlying schema for cycles.
47
53
  const target = getResolvedRef(input) ?? input;
48
54
  if (!('properties' in schema) || !schema.properties) {
@@ -62,7 +68,7 @@ const getSchemaExample = (input, walk = { ancestors: new Set(), withoutValues: n
62
68
  walk.ancestors.add(target);
63
69
  const properties = Object.entries(schema.properties).flatMap(([name, property]) => {
64
70
  const example = getSchemaExample(property, walk);
65
- return example === undefined ? [] : [[name, example.value]];
71
+ return example === undefined ? [] : [{ name, example }];
66
72
  });
67
73
  walk.ancestors.delete(target);
68
74
  // Stops at schemas inside this walk have left the path, so the rest point above it.
@@ -70,7 +76,11 @@ const getSchemaExample = (input, walk = { ancestors: new Set(), withoutValues: n
70
76
  walk.stops = outerStops;
71
77
  stops.forEach((stop) => outerStops.add(stop));
72
78
  if (properties.length > 0) {
73
- return { value: Object.fromEntries(properties) };
79
+ const example = { value: Object.fromEntries(properties.map(({ name, example }) => [name, example.value])) };
80
+ if (properties.every(({ example }) => isGeneratedExample(example))) {
81
+ generatedExamples.add(example);
82
+ }
83
+ return example;
74
84
  }
75
85
  walk.withoutValues.set(target, { properties: schema.properties, stops });
76
86
  return undefined;
@@ -5,6 +5,7 @@ export { type SerializedFormProperty, serializeFormPropertyWithEncoding } from '
5
5
  export { serializeMultipartArray } from './body/serialize-multipart-array.js';
6
6
  export { BUILD_REQUEST_FAILED, type BuildRequestData, type BuildRequestFailureCode, type BuildRequestResult, type RequestPayload, buildRequest, resolveExecutableRequestUrl, } from './build-request.js';
7
7
  export { deSerializeParameter, deSerializeSchemaValue } from './header/de-serialize-parameter.js';
8
+ export { filterDisabledProperties } from './header/filter-disabled-properties.js';
8
9
  export { filterGlobalCookie } from './header/filter-global-cookies.js';
9
10
  export { isParamDisabled } from './header/is-param-disabled.js';
10
11
  export { serializeContentValue, serializeCookieStyle, serializeDeepObjectStyle, serializeFormStyle, serializeFormStyleForCookies, serializePipeDelimitedStyle, serializeSimpleStyle, serializeSpaceDelimitedStyle, } from './header/serialize-parameter.js';