@scalar/workspace-store 0.68.1 → 0.68.2

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 (49) hide show
  1. package/CHANGELOG.md +10 -0
  2. package/dist/client.d.ts.map +1 -1
  3. package/dist/client.js +8 -1
  4. package/dist/helpers/chunk-index.d.ts +2 -0
  5. package/dist/helpers/chunk-index.d.ts.map +1 -1
  6. package/dist/helpers/chunk-index.js +8 -1
  7. package/dist/helpers/encode-path-parameter.d.ts +20 -0
  8. package/dist/helpers/encode-path-parameter.d.ts.map +1 -0
  9. package/dist/helpers/encode-path-parameter.js +51 -0
  10. package/dist/helpers/get-tag-kind.d.ts +6 -0
  11. package/dist/helpers/get-tag-kind.d.ts.map +1 -0
  12. package/dist/helpers/get-tag-kind.js +7 -0
  13. package/dist/helpers/resolve-form-schema.d.ts +9 -0
  14. package/dist/helpers/resolve-form-schema.d.ts.map +1 -0
  15. package/dist/helpers/resolve-form-schema.js +143 -0
  16. package/dist/helpers/resolve-schema-with-annotations.d.ts +11 -0
  17. package/dist/helpers/resolve-schema-with-annotations.d.ts.map +1 -0
  18. package/dist/helpers/resolve-schema-with-annotations.js +57 -0
  19. package/dist/helpers/resolve-security-requirements.d.ts +15 -0
  20. package/dist/helpers/resolve-security-requirements.d.ts.map +1 -0
  21. package/dist/helpers/resolve-security-requirements.js +222 -0
  22. package/dist/navigation/helpers/get-navigation-tag-names.d.ts +5 -0
  23. package/dist/navigation/helpers/get-navigation-tag-names.d.ts.map +1 -0
  24. package/dist/navigation/helpers/get-navigation-tag-names.js +3 -0
  25. package/dist/navigation/helpers/traverse-paths.d.ts.map +1 -1
  26. package/dist/navigation/helpers/traverse-paths.js +4 -2
  27. package/dist/navigation/helpers/traverse-schemas.d.ts.map +1 -1
  28. package/dist/navigation/helpers/traverse-schemas.js +4 -2
  29. package/dist/navigation/helpers/traverse-tags.d.ts.map +1 -1
  30. package/dist/navigation/helpers/traverse-tags.js +8 -4
  31. package/dist/navigation/helpers/traverse-webhooks.d.ts.map +1 -1
  32. package/dist/navigation/helpers/traverse-webhooks.js +4 -2
  33. package/dist/request-example/builder/body/build-request-body.d.ts.map +1 -1
  34. package/dist/request-example/builder/body/build-request-body.js +3 -5
  35. package/dist/request-example/builder/body/schema-value-coercion.d.ts.map +1 -1
  36. package/dist/request-example/builder/body/schema-value-coercion.js +5 -7
  37. package/dist/request-example/builder/build-request.d.ts.map +1 -1
  38. package/dist/request-example/builder/build-request.js +3 -0
  39. package/dist/request-example/builder/header/build-request-parameters.d.ts +7 -1
  40. package/dist/request-example/builder/header/build-request-parameters.d.ts.map +1 -1
  41. package/dist/request-example/builder/header/build-request-parameters.js +22 -1
  42. package/dist/request-example/builder/request-factory.d.ts +6 -1
  43. package/dist/request-example/builder/request-factory.d.ts.map +1 -1
  44. package/dist/request-example/builder/request-factory.js +3 -1
  45. package/dist/request-example/builder/resolve-request-factory-url.d.ts.map +1 -1
  46. package/dist/request-example/builder/resolve-request-factory-url.js +22 -7
  47. package/dist/server.d.ts.map +1 -1
  48. package/dist/server.js +34 -7
  49. package/package.json +8 -8
@@ -0,0 +1,222 @@
1
+ import { isHttpMethod } from '@scalar/helpers/http/is-http-method';
2
+ import { isObject } from '@scalar/helpers/object/is-object';
3
+ import { isPollutionKey } from '@scalar/helpers/object/prevent-pollution';
4
+ import { isSchemaPath } from '@scalar/helpers/openapi/is-schema-path';
5
+ import { bundle, resolveReferencePath } from '@scalar/json-magic/bundle';
6
+ import { createMagicProxy } from '@scalar/json-magic/magic-proxy';
7
+ import { Value } from '@scalar/typebox/value';
8
+ import { generateUniqueValue } from '../helpers/generate-unique-value.js';
9
+ import { getResolvedRef } from '../helpers/get-resolved-ref.js';
10
+ import { normalizeAuthSchemes } from '../plugins/bundler/index.js';
11
+ import { resolveOpenApiDocument } from '../plugins/bundler/openapi-document.js';
12
+ import { SecuritySchemeObjectSchema } from '../schemas/v3.2/strict/openapi-document.js';
13
+ const ALIASES = 'x-scalar-security-uri-aliases';
14
+ const ORIGINAL_KEYS = 'x-scalar-original-security-keys';
15
+ /** Resolve the URI portion separately so filesystem origins do not interpret fragments as filenames. */
16
+ const absoluteReference = (reference, base) => {
17
+ const separator = reference.indexOf('#');
18
+ const resource = separator === -1 ? reference : reference.slice(0, separator);
19
+ const fragment = separator === -1 ? '' : reference.slice(separator);
20
+ return `${resource ? resolveReferencePath(base, resource) : base}${fragment}`;
21
+ };
22
+ /**
23
+ * Makes URI requirements available to the existing name-based auth consumers.
24
+ * Aliases live only in the working document; export removes them and restores authored keys.
25
+ * Relative keys in referenced documents become absolute to keep distinct document bases apart.
26
+ */
27
+ export const resolveSecurityRequirements = async (document, { origin = '/', loaders }) => {
28
+ if (typeof document.openapi !== 'string' || !/^3\.2\.\d+$/.test(document.openapi))
29
+ return;
30
+ const originalKeys = isObject(document[ORIGINAL_KEYS]) ? document[ORIGINAL_KEYS] : {};
31
+ const components = isObject(document.components) ? document.components : {};
32
+ const schemes = isObject(components.securitySchemes) ? components.securitySchemes : {};
33
+ const metadata = isObject(document[ALIASES])
34
+ ? document[ALIASES]
35
+ : {
36
+ hadComponents: isObject(document.components),
37
+ hadSecuritySchemes: isObject(components.securitySchemes),
38
+ schemes: {},
39
+ };
40
+ const aliases = isObject(metadata.schemes) ? metadata.schemes : {};
41
+ metadata.schemes = aliases;
42
+ const namedSchemes = new Set(Object.keys(schemes).filter((name) => !Object.hasOwn(aliases, name)));
43
+ const visited = new WeakSet();
44
+ const processedDocuments = new Set();
45
+ const cache = new Map();
46
+ const visit = async (node, path, base, external) => {
47
+ if (node === null || typeof node !== 'object' || visited.has(node) || isSchemaPath(path))
48
+ return;
49
+ visited.add(node);
50
+ // Security is a fixed field on document and operation objects, not arbitrary example payloads.
51
+ const operationKey = path.at(-1) ?? '';
52
+ const isOperation = isHttpMethod(operationKey) || path.at(-2) === 'additionalOperations';
53
+ const isDocument = path.length === 0 || (path[0] === 'x-ext' && path.length === 2);
54
+ if (isObject(node) && (isDocument || isOperation) && Array.isArray(node.security)) {
55
+ for (const [index, requirement] of node.security.entries()) {
56
+ if (!isObject(requirement))
57
+ continue;
58
+ for (const [name, scopes] of Object.entries(requirement)) {
59
+ if (namedSchemes.has(name) || !Array.isArray(scopes))
60
+ continue;
61
+ const uri = (() => {
62
+ try {
63
+ return Object.hasOwn(aliases, name) && typeof aliases[name] === 'string'
64
+ ? aliases[name]
65
+ : absoluteReference(name, base);
66
+ }
67
+ catch {
68
+ return undefined;
69
+ }
70
+ })();
71
+ if (uri === undefined)
72
+ continue;
73
+ const key = await generateUniqueValue({
74
+ defaultValue: external ? uri : name,
75
+ validation: (candidate) => !namedSchemes.has(candidate) &&
76
+ (!Object.hasOwn(aliases, candidate) || aliases[candidate] === uri) &&
77
+ (!external || candidate === name || !Object.hasOwn(requirement, candidate)),
78
+ maxRetries: Object.keys(schemes).length + 1,
79
+ });
80
+ if (key === undefined)
81
+ continue;
82
+ if (!Object.hasOwn(aliases, key)) {
83
+ const reference = { $ref: uri };
84
+ await bundle({ components: { securitySchemes: { target: reference } } }, {
85
+ root: document,
86
+ origin,
87
+ treeShake: false,
88
+ urlMap: true,
89
+ cache,
90
+ plugins: [...loaders, normalizeAuthSchemes()],
91
+ hooks: { resolveDocument: resolveOpenApiDocument },
92
+ });
93
+ // Validate the target before exposing an auth option; missing pointers and non-schemes
94
+ // keep their original requirement and never acquire a misleading working alias.
95
+ const proxy = createMagicProxy({ ...document, 'x-scalar-security-uri-target': reference }, {
96
+ documentUri: resolveOpenApiDocument(document, origin)?.baseUri,
97
+ });
98
+ const target = getResolvedRef(proxy['x-scalar-security-uri-target']);
99
+ // The strict runtime schema requires refreshUrl, while authored OAuth flows may omit it.
100
+ const validationTarget = isObject(target) && target.type === 'oauth2' && isObject(target.flows)
101
+ ? {
102
+ ...target,
103
+ flows: Object.fromEntries(Object.entries(target.flows).map(([flow, value]) => [
104
+ flow,
105
+ isObject(value) ? { refreshUrl: '', ...value } : value,
106
+ ])),
107
+ }
108
+ : target;
109
+ if (!Value.Check(SecuritySchemeObjectSchema, validationTarget))
110
+ continue;
111
+ Object.defineProperty(schemes, key, {
112
+ value: reference,
113
+ enumerable: true,
114
+ writable: true,
115
+ configurable: true,
116
+ });
117
+ Object.defineProperty(aliases, key, { value: uri, enumerable: true, writable: true, configurable: true });
118
+ components.securitySchemes = schemes;
119
+ document.components = components;
120
+ document[ALIASES] = metadata;
121
+ }
122
+ if (external) {
123
+ const location = JSON.stringify([...path, 'security', String(index)]);
124
+ const mapping = isObject(originalKeys[location]) ? originalKeys[location] : {};
125
+ Object.defineProperty(mapping, name, { value: key, enumerable: true, writable: true, configurable: true });
126
+ originalKeys[location] = mapping;
127
+ document[ORIGINAL_KEYS] = originalKeys;
128
+ if (key === name)
129
+ continue;
130
+ const previous = Object.hasOwn(requirement, key) ? requirement[key] : [];
131
+ Object.defineProperty(requirement, key, {
132
+ value: [...new Set([...(Array.isArray(previous) ? previous : []), ...scopes])],
133
+ enumerable: true,
134
+ writable: true,
135
+ configurable: true,
136
+ });
137
+ delete requirement[name];
138
+ }
139
+ }
140
+ }
141
+ }
142
+ for (const [key, child] of Object.entries(node)) {
143
+ if (key.startsWith('x-') || key === 'example' || key === 'examples' || key === 'security')
144
+ continue;
145
+ await visit(child, [...path, key], base, external);
146
+ }
147
+ };
148
+ const entryBase = resolveOpenApiDocument(document, origin)?.baseUri ?? origin;
149
+ await visit(document, [], entryBase, false);
150
+ // URI-only dependencies can load further documents, so process newly embedded documents too.
151
+ while (isObject(document['x-ext'])) {
152
+ const next = Object.entries(document['x-ext']).find(([key]) => !processedDocuments.has(key));
153
+ if (!next)
154
+ break;
155
+ const [key, external] = next;
156
+ processedDocuments.add(key);
157
+ if (!isObject(external))
158
+ continue;
159
+ if (typeof external.openapi === 'string' && !/^3\.2\.\d+$/.test(external.openapi))
160
+ continue;
161
+ const mappings = document['x-ext-urls'];
162
+ const retrieval = isObject(mappings) && typeof mappings[key] === 'string' ? mappings[key] : key;
163
+ const retrievalUri = resolveReferencePath(entryBase, retrieval);
164
+ await visit(external, ['x-ext', key], resolveOpenApiDocument(external, retrievalUri)?.baseUri ?? retrievalUri, true);
165
+ }
166
+ };
167
+ /** Remove runtime URI aliases while keeping edited scopes and authored requirement spellings. */
168
+ export const restoreSecurityRequirements = (document) => {
169
+ const originalKeys = Object.hasOwn(document, ORIGINAL_KEYS) ? document[ORIGINAL_KEYS] : undefined;
170
+ if (isObject(originalKeys)) {
171
+ for (const [location, mapping] of Object.entries(originalKeys)) {
172
+ const path = (() => {
173
+ try {
174
+ return JSON.parse(location);
175
+ }
176
+ catch {
177
+ return undefined;
178
+ }
179
+ })();
180
+ if (!Array.isArray(path) ||
181
+ !path.every((segment) => typeof segment === 'string' && !isPollutionKey(segment)) ||
182
+ !isObject(mapping))
183
+ continue;
184
+ const requirement = path.reduce((parent, segment) => {
185
+ if (parent === null || typeof parent !== 'object' || !Object.hasOwn(parent, segment))
186
+ return undefined;
187
+ return Reflect.get(parent, segment);
188
+ }, document);
189
+ if (!isObject(requirement))
190
+ continue;
191
+ const entries = Object.entries(mapping).flatMap(([original, rewritten]) => typeof rewritten === 'string' && Object.hasOwn(requirement, rewritten)
192
+ ? [{ original, rewritten, scopes: requirement[rewritten] }]
193
+ : []);
194
+ for (const { rewritten } of entries)
195
+ delete requirement[rewritten];
196
+ for (const { original, scopes } of entries) {
197
+ Object.defineProperty(requirement, original, {
198
+ value: scopes,
199
+ enumerable: true,
200
+ writable: true,
201
+ configurable: true,
202
+ });
203
+ }
204
+ }
205
+ }
206
+ const metadata = Object.hasOwn(document, ALIASES) ? document[ALIASES] : undefined;
207
+ const components = Object.hasOwn(document, 'components') ? document.components : undefined;
208
+ if (isObject(metadata) &&
209
+ isObject(metadata.schemes) &&
210
+ isObject(components) &&
211
+ Object.hasOwn(components, 'securitySchemes') &&
212
+ isObject(components.securitySchemes)) {
213
+ for (const key of Object.keys(metadata.schemes))
214
+ delete components.securitySchemes[key];
215
+ if (!metadata.hadSecuritySchemes && Object.keys(components.securitySchemes).length === 0)
216
+ delete components.securitySchemes;
217
+ if (!metadata.hadComponents && Object.keys(components).length === 0)
218
+ delete document.components;
219
+ }
220
+ delete document[ALIASES];
221
+ delete document[ORIGINAL_KEYS];
222
+ };
@@ -0,0 +1,5 @@
1
+ import type { TagsMap } from '../../navigation/types.js';
2
+ import type { OpenApiDocument } from '../../schemas/v3.2/strict/openapi-document.js';
3
+ /** Label tags must not create operation groups, but undeclared tags still do. */
4
+ export declare const getNavigationTagNames: (document: OpenApiDocument, names: string[] | undefined, tagsMap: TagsMap) => string[];
5
+ //# sourceMappingURL=get-navigation-tag-names.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"get-navigation-tag-names.d.ts","sourceRoot":"","sources":["../../../src/navigation/helpers/get-navigation-tag-names.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAA;AACjD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,wCAAwC,CAAA;AAE7E,iFAAiF;AACjF,eAAO,MAAM,qBAAqB,GAChC,UAAU,eAAe,EACzB,OAAO,MAAM,EAAE,GAAG,SAAS,EAC3B,SAAS,OAAO,KACf,MAAM,EAA2F,CAAA"}
@@ -0,0 +1,3 @@
1
+ import { getTagKind } from '../../helpers/get-tag-kind.js';
2
+ /** Label tags must not create operation groups, but undeclared tags still do. */
3
+ export const getNavigationTagNames = (document, names, tagsMap) => names?.filter((name) => getTagKind(document, tagsMap.get(name)?.tag) === 'nav') ?? [];
@@ -1 +1 @@
1
- {"version":3,"file":"traverse-paths.d.ts","sourceRoot":"","sources":["../../../src/navigation/helpers/traverse-paths.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,oBAAoB,EAAE,OAAO,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAA;AAE5F,OAAO,KAAK,EAA+B,kBAAkB,EAAE,MAAM,sBAAsB,CAAA;AAC3F,OAAO,KAAK,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,wCAAwC,CAAA;AAI9F,eAAO,MAAM,qBAAqB,GAAI,WAAW,eAAe,YAE/D,CAAA;AAsED;;;;;;;;;;;;;;;;GAgBG;AACH,eAAO,MAAM,aAAa,GAAI,sEAM3B;IACD,QAAQ,EAAE,eAAe,CAAA;IACzB,oCAAoC;IACpC,OAAO,EAAE,OAAO,CAAA;IAChB,0DAA0D;IAC1D,UAAU,EAAE,mBAAmB,CAAC,YAAY,CAAC,CAAA;IAC7C,kBAAkB;IAClB,UAAU,EAAE,MAAM,CAAA;IAClB,oFAAoF;IACpF,oBAAoB,CAAC,EAAE,oBAAoB,CAAA;CAC5C,KAAG;IAAE,kBAAkB,EAAE,kBAAkB,EAAE,CAAA;CA0D7C,CAAA"}
1
+ {"version":3,"file":"traverse-paths.d.ts","sourceRoot":"","sources":["../../../src/navigation/helpers/traverse-paths.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,oBAAoB,EAAE,OAAO,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAA;AAE5F,OAAO,KAAK,EAA+B,kBAAkB,EAAE,MAAM,sBAAsB,CAAA;AAC3F,OAAO,KAAK,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,wCAAwC,CAAA;AAK9F,eAAO,MAAM,qBAAqB,GAAI,WAAW,eAAe,YAE/D,CAAA;AAsED;;;;;;;;;;;;;;;;GAgBG;AACH,eAAO,MAAM,aAAa,GAAI,sEAM3B;IACD,QAAQ,EAAE,eAAe,CAAA;IACzB,oCAAoC;IACpC,OAAO,EAAE,OAAO,CAAA;IAChB,0DAA0D;IAC1D,UAAU,EAAE,mBAAmB,CAAC,YAAY,CAAC,CAAA;IAC7C,kBAAkB;IAClB,UAAU,EAAE,MAAM,CAAA;IAClB,oFAAoF;IACpF,oBAAoB,CAAC,EAAE,oBAAoB,CAAA;CAC5C,KAAG;IAAE,kBAAkB,EAAE,kBAAkB,EAAE,CAAA;CA2D7C,CAAA"}
@@ -4,6 +4,7 @@ import { getResolvedRef, mergeSiblingReferences } from '../../helpers/get-resolv
4
4
  import { isHidden } from '../../helpers/is-hidden.js';
5
5
  import { traverseOperationExamples } from '../../navigation/helpers/traverse-examples.js';
6
6
  import { XScalarStabilityValues } from '../../schemas/extensions/operation/index.js';
7
+ import { getNavigationTagNames } from './get-navigation-tag-names.js';
7
8
  import { getTag } from './get-tag.js';
8
9
  export const isDeprecatedOperation = (operation) => {
9
10
  return operation.deprecated || operation['x-scalar-stability'] === XScalarStabilityValues.Deprecated;
@@ -85,8 +86,9 @@ export const traversePaths = ({ document, tagsMap, generateId, documentId, opera
85
86
  }
86
87
  const ref = `#/paths/${escapeJsonPointer(path)}/${getPathItemOperationKey(method)}`;
87
88
  // Traverse tags
88
- if (operation.tags?.length) {
89
- operation.tags.forEach((tagName) => {
89
+ const navigationTags = getNavigationTagNames(document, operation.tags, tagsMap);
90
+ if (navigationTags.length) {
91
+ navigationTags.forEach((tagName) => {
90
92
  const { tag, id: tagId } = getTag({
91
93
  tagsMap,
92
94
  name: tagName,
@@ -1 +1 @@
1
- {"version":3,"file":"traverse-schemas.d.ts","sourceRoot":"","sources":["../../../src/navigation/helpers/traverse-schemas.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,OAAO,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAA;AACtE,OAAO,KAAK,EAAa,eAAe,EAAE,MAAM,sBAAsB,CAAA;AACtE,OAAO,KAAK,EAAE,eAAe,EAAgB,MAAM,wCAAwC,CAAA;AA2C3F;;;;;;GAMG;AACH,eAAO,MAAM,eAAe,GAAI,gDAK7B;IACD,QAAQ,EAAE,eAAe,CAAA;IACzB,wCAAwC;IACxC,OAAO,EAAE,OAAO,CAAA;IAChB,UAAU,EAAE,mBAAmB,CAAC,YAAY,CAAC,CAAA;IAC7C,UAAU,EAAE,MAAM,CAAA;CACnB,KAAG,eAAe,EAkDlB,CAAA"}
1
+ {"version":3,"file":"traverse-schemas.d.ts","sourceRoot":"","sources":["../../../src/navigation/helpers/traverse-schemas.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,OAAO,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAA;AACtE,OAAO,KAAK,EAAa,eAAe,EAAE,MAAM,sBAAsB,CAAA;AACtE,OAAO,KAAK,EAAE,eAAe,EAAgB,MAAM,wCAAwC,CAAA;AA2C3F;;;;;;GAMG;AACH,eAAO,MAAM,eAAe,GAAI,gDAK7B;IACD,QAAQ,EAAE,eAAe,CAAA;IACzB,wCAAwC;IACxC,OAAO,EAAE,OAAO,CAAA;IAChB,UAAU,EAAE,mBAAmB,CAAC,YAAY,CAAC,CAAA;IAC7C,UAAU,EAAE,MAAM,CAAA;CACnB,KAAG,eAAe,EAmDlB,CAAA"}
@@ -1,5 +1,6 @@
1
1
  import { getResolvedRef, mergeSiblingReferences } from '../../helpers/get-resolved-ref.js';
2
2
  import { isHidden } from '../../helpers/is-hidden.js';
3
+ import { getNavigationTagNames } from '../../navigation/helpers/get-navigation-tag-names.js';
3
4
  import { getTag } from '../../navigation/helpers/get-tag.js';
4
5
  /** Creates a traversed schema entry from an OpenAPI schema object.
5
6
  *
@@ -46,8 +47,9 @@ export const traverseSchemas = ({ document, tagsMap, generateId, documentId, })
46
47
  }
47
48
  const ref = `#/components/schemas/${name}`;
48
49
  // Add to tags
49
- if (schema?.['x-tags']) {
50
- schema['x-tags'].forEach((tagName) => {
50
+ const navigationTags = getNavigationTagNames(document, schema?.['x-tags'], tagsMap);
51
+ if (navigationTags.length) {
52
+ navigationTags.forEach((tagName) => {
51
53
  const { tag, id: tagId } = getTag({ tagsMap, name: tagName, documentId, generateId });
52
54
  tagsMap.get(tagName)?.entries.push(createSchemaEntry({
53
55
  ref,
@@ -1 +1 @@
1
- {"version":3,"file":"traverse-tags.d.ts","sourceRoot":"","sources":["../../../src/navigation/helpers/traverse-tags.ts"],"names":[],"mappings":"AAKA,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;AAiS1F;;;;;;;;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,EAoEjB,CAAA"}
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,4 +1,5 @@
1
1
  import { sortByOrder } from '@scalar/helpers/array/sort-by-order';
2
+ import { getTagKind } from '../../helpers/get-tag-kind.js';
2
3
  import { isHidden } from '../../helpers/is-hidden.js';
3
4
  import { unpackProxyObject } from '../../helpers/unpack-proxy.js';
4
5
  import { getXKeysFromObject } from '../../navigation/helpers/get-x-keys.js';
@@ -57,7 +58,7 @@ const createTagEntry = ({ tag, generateId, children, isGroup = false, isTagGroup
57
58
  * @returns Array of processed and sorted tag entries
58
59
  */
59
60
  /** Sorts tags and returns entries */
60
- const getSortedTagEntries = ({ _keys, tagsMap, options: { tagsSorter, operationsSorter, generateId }, documentId, sortOrder, }) => {
61
+ const getSortedTagEntries = ({ _keys, document, tagsMap, options: { tagsSorter, operationsSorter, generateId }, documentId, sortOrder, }) => {
61
62
  /**
62
63
  * Process each tag and its entries:
63
64
  * - Skip internal and ignored tags
@@ -67,7 +68,7 @@ const getSortedTagEntries = ({ _keys, tagsMap, options: { tagsSorter, operations
67
68
  const entries = _keys.flatMap((key) => {
68
69
  const { tag, entries } = getTag({ tagsMap, name: key, documentId, generateId });
69
70
  // Skip if the tag is internal or scalar-ignore
70
- if (isHidden(tag)) {
71
+ if (isHidden(tag) || getTagKind(document, tag) !== 'nav') {
71
72
  return [];
72
73
  }
73
74
  const sortOrder = tag['x-scalar-order'];
@@ -167,7 +168,7 @@ const nestTagsByParent = ({ flatEntries, document, originalOrders, }) => {
167
168
  hadOwnOperations.set(entry.name, (entry.children?.length ?? 0) > 0);
168
169
  }
169
170
  }
170
- const parentOf = getParentMap(document.tags ?? []);
171
+ const parentOf = getParentMap((document.tags ?? []).filter((tag) => getTagKind(document, tag) === 'nav'));
171
172
  // Re-parent entries by reference, tracking which ones leave the top level.
172
173
  const nested = new Set();
173
174
  const gainedNestedTags = new Set();
@@ -232,7 +233,7 @@ export const traverseTags = ({ document, tagsMap, documentId, options: { generat
232
233
  // Native OpenAPI 3.2 tag nesting via `parent` takes precedence over x-tagGroups, but only
233
234
  // when at least one `parent` resolves to another declared tag outside a circular reference.
234
235
  // A stray or misspelled `parent` value must not disable the legacy `x-tagGroups` handling.
235
- const parentOf = getParentMap(document.tags ?? []);
236
+ const parentOf = getParentMap((document.tags ?? []).filter((tag) => getTagKind(document, tag) === 'nav'));
236
237
  const hasNestedTags = Array.from(parentOf.keys()).some((name) => !isCyclic(parentOf, name));
237
238
  if (hasNestedTags) {
238
239
  // The flat traversal rewrites tag-level `x-scalar-order`, so capture the original values
@@ -244,6 +245,7 @@ export const traverseTags = ({ document, tagsMap, documentId, options: { generat
244
245
  }
245
246
  }
246
247
  const flatEntries = getSortedTagEntries({
248
+ document,
247
249
  _keys: Array.from(tagsMap.keys()),
248
250
  tagsMap,
249
251
  options: { generateId, tagsSorter, operationsSorter },
@@ -257,6 +259,7 @@ export const traverseTags = ({ document, tagsMap, documentId, options: { generat
257
259
  const tagGroups = document['x-tagGroups'];
258
260
  return tagGroups.flatMap((tagGroup) => {
259
261
  const entries = getSortedTagEntries({
262
+ document,
260
263
  _keys: tagGroup.tags,
261
264
  tagsMap,
262
265
  options: { tagsSorter, operationsSorter, generateId },
@@ -280,6 +283,7 @@ export const traverseTags = ({ document, tagsMap, documentId, options: { generat
280
283
  // Ungrouped regular tags
281
284
  const keys = Array.from(tagsMap.keys());
282
285
  const tags = getSortedTagEntries({
286
+ document,
283
287
  _keys: keys,
284
288
  tagsMap,
285
289
  options: { generateId, tagsSorter, operationsSorter },
@@ -1 +1 @@
1
- {"version":3,"file":"traverse-webhooks.d.ts","sourceRoot":"","sources":["../../../src/navigation/helpers/traverse-webhooks.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,OAAO,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAA;AACtE,OAAO,KAAK,EAAa,gBAAgB,EAAE,MAAM,sBAAsB,CAAA;AACvE,OAAO,KAAK,EAAE,eAAe,EAA8B,MAAM,wCAAwC,CAAA;AA2DzG;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,gBAAgB,GAAI,0EAM9B;IACD,uBAAuB;IACvB,QAAQ,EAAE,eAAe,CAAA;IACzB,6CAA6C;IAC7C,OAAO,EAAE,OAAO,CAAA;IAChB,UAAU,EAAE,mBAAmB,CAAC,YAAY,CAAC,CAAA;IAC7C,wBAAwB,EAAE,MAAM,CAAA;IAChC,UAAU,EAAE,MAAM,CAAA;CACnB,KAAG,gBAAgB,EAuDnB,CAAA"}
1
+ {"version":3,"file":"traverse-webhooks.d.ts","sourceRoot":"","sources":["../../../src/navigation/helpers/traverse-webhooks.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,OAAO,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAA;AACtE,OAAO,KAAK,EAAa,gBAAgB,EAAE,MAAM,sBAAsB,CAAA;AACvE,OAAO,KAAK,EAAE,eAAe,EAA8B,MAAM,wCAAwC,CAAA;AA4DzG;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,gBAAgB,GAAI,0EAM9B;IACD,uBAAuB;IACvB,QAAQ,EAAE,eAAe,CAAA;IACzB,6CAA6C;IAC7C,OAAO,EAAE,OAAO,CAAA;IAChB,UAAU,EAAE,mBAAmB,CAAC,YAAY,CAAC,CAAA;IAC7C,wBAAwB,EAAE,MAAM,CAAA;IAChC,UAAU,EAAE,MAAM,CAAA;CACnB,KAAG,gBAAgB,EAwDnB,CAAA"}
@@ -2,6 +2,7 @@ import { forEachPathItemOperation, getPathItemOperationKey } from '../../helpers
2
2
  import { getResolvedRef, mergeSiblingReferences } from '../../helpers/get-resolved-ref.js';
3
3
  import { isHidden } from '../../helpers/is-hidden.js';
4
4
  import { isDeprecatedOperation } from '../../navigation/helpers/traverse-paths.js';
5
+ import { getNavigationTagNames } from './get-navigation-tag-names.js';
5
6
  import { getTag } from './get-tag.js';
6
7
  /** Creates a traversed webhook entry from an OpenAPI webhook object.
7
8
  *
@@ -63,8 +64,9 @@ export const traverseWebhooks = ({ document, tagsMap, generateId, untaggedWebhoo
63
64
  return;
64
65
  }
65
66
  const ref = `#/webhooks/${name}/${getPathItemOperationKey(method)}`;
66
- if (operation.tags?.length) {
67
- operation.tags.forEach((tagName) => {
67
+ const navigationTags = getNavigationTagNames(document, operation.tags, tagsMap);
68
+ if (navigationTags.length) {
69
+ navigationTags.forEach((tagName) => {
68
70
  const { tag, id: tagId } = getTag({ tagsMap, name: tagName, documentId, generateId });
69
71
  tagsMap.get(tagName)?.entries.push(createWebhookEntry({
70
72
  ref,
@@ -1 +1 @@
1
- {"version":3,"file":"build-request-body.d.ts","sourceRoot":"","sources":["../../../../src/request-example/builder/body/build-request-body.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,0DAA0D,CAAA;AAKjG,OAAO,EACL,KAAK,aAAa,EAKnB,MAAM,mBAAmB,CAAA;AAO1B,KAAK,QAAQ,GAAG;IACd,IAAI,EAAE,UAAU,CAAA;IAChB,KAAK,EAAE,CACH;QACE,IAAI,EAAE,MAAM,CAAA;QACZ,GAAG,EAAE,MAAM,CAAA;QACX,KAAK,EAAE,MAAM,CAAA;QACb,WAAW,CAAC,EAAE,MAAM,CAAA;KACrB,GACD;QACE,IAAI,EAAE,MAAM,CAAA;QACZ,GAAG,EAAE,MAAM,CAAA;QACX,KAAK,EAAE,IAAI,CAAA;QACX,WAAW,CAAC,EAAE,MAAM,CAAA;KACrB,GACD;QACE,IAAI,EAAE,MAAM,CAAA;QACZ,GAAG,EAAE,MAAM,CAAA;QACX,KAAK,EAAE,IAAI,CAAA;QACX,WAAW,CAAC,EAAE,MAAM,CAAA;KACrB,CACJ,EAAE,CAAA;CACJ,CAAA;AAwBD,KAAK,UAAU,GAAG;IAChB,IAAI,EAAE,YAAY,CAAA;IAClB,KAAK,EAAE;QACL,GAAG,EAAE,MAAM,CAAA;QACX,KAAK,EAAE,MAAM,CAAA;KACd,EAAE,CAAA;CACJ,CAAA;AAED,KAAK,GAAG,GAAG;IACT,IAAI,EAAE,KAAK,CAAA;IACX,KAAK,EAAE,MAAM,GAAG,IAAI,GAAG,IAAI,CAAA;IAC3B,WAAW,CAAC,EAAE,MAAM,CAAA;CACrB,CAAA;AAED,MAAM,MAAM,WAAW,GACnB,QAAQ,GACR,UAAU,GACV,GAAG,GACH;IAAE,IAAI,EAAE,WAAW,CAAC;IAAC,WAAW,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,aAAa,EAAE,CAAA;CAAE,CAAA;AA2CtE;;GAEG;AACH,eAAO,MAAM,gBAAgB,GAC3B,aAAa,iBAAiB,GAAG,SAAS;AAC1C,qCAAqC;AACrC,oBAAuB;AACvB,sEAAsE;AACtE,kCAAkC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,EACxD,iBAAiB,MAAM,KACtB,WAAW,GAAG,IAoXhB,CAAA"}
1
+ {"version":3,"file":"build-request-body.d.ts","sourceRoot":"","sources":["../../../../src/request-example/builder/body/build-request-body.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,0DAA0D,CAAA;AAMjG,OAAO,EACL,KAAK,aAAa,EAKnB,MAAM,mBAAmB,CAAA;AAO1B,KAAK,QAAQ,GAAG;IACd,IAAI,EAAE,UAAU,CAAA;IAChB,KAAK,EAAE,CACH;QACE,IAAI,EAAE,MAAM,CAAA;QACZ,GAAG,EAAE,MAAM,CAAA;QACX,KAAK,EAAE,MAAM,CAAA;QACb,WAAW,CAAC,EAAE,MAAM,CAAA;KACrB,GACD;QACE,IAAI,EAAE,MAAM,CAAA;QACZ,GAAG,EAAE,MAAM,CAAA;QACX,KAAK,EAAE,IAAI,CAAA;QACX,WAAW,CAAC,EAAE,MAAM,CAAA;KACrB,GACD;QACE,IAAI,EAAE,MAAM,CAAA;QACZ,GAAG,EAAE,MAAM,CAAA;QACX,KAAK,EAAE,IAAI,CAAA;QACX,WAAW,CAAC,EAAE,MAAM,CAAA;KACrB,CACJ,EAAE,CAAA;CACJ,CAAA;AAwBD,KAAK,UAAU,GAAG;IAChB,IAAI,EAAE,YAAY,CAAA;IAClB,KAAK,EAAE;QACL,GAAG,EAAE,MAAM,CAAA;QACX,KAAK,EAAE,MAAM,CAAA;KACd,EAAE,CAAA;CACJ,CAAA;AAED,KAAK,GAAG,GAAG;IACT,IAAI,EAAE,KAAK,CAAA;IACX,KAAK,EAAE,MAAM,GAAG,IAAI,GAAG,IAAI,CAAA;IAC3B,WAAW,CAAC,EAAE,MAAM,CAAA;CACrB,CAAA;AAED,MAAM,MAAM,WAAW,GACnB,QAAQ,GACR,UAAU,GACV,GAAG,GACH;IAAE,IAAI,EAAE,WAAW,CAAC;IAAC,WAAW,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,aAAa,EAAE,CAAA;CAAE,CAAA;AA2CtE;;GAEG;AACH,eAAO,MAAM,gBAAgB,GAC3B,aAAa,iBAAiB,GAAG,SAAS;AAC1C,qCAAqC;AACrC,oBAAuB;AACvB,sEAAsE;AACtE,kCAAkC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,EACxD,iBAAiB,MAAM,KACtB,WAAW,GAAG,IAiXhB,CAAA"}
@@ -2,10 +2,10 @@
2
2
  import { parseMimeType } from '@scalar/helpers/http/mime-type';
3
3
  import { isObject } from '@scalar/helpers/object/is-object';
4
4
  import { setValueAtPath } from '@scalar/helpers/object/set-value-at-path';
5
- import { getResolvedRef, mergeSiblingReferences } from '@scalar/workspace-store/helpers/get-resolved-ref';
6
5
  import { unpackProxyObject } from '@scalar/workspace-store/helpers/unpack-proxy';
7
6
  import { isObjectSchema } from '@scalar/workspace-store/schemas/v3.2/strict/type-guards';
8
7
  import { getExampleValue, getExplicitExampleText } from '../../../helpers/get-example-value.js';
8
+ import { resolveFormSchema } from '../../../helpers/resolve-form-schema.js';
9
9
  import { buildMultipart, getMultipartItemSchema, isPositionalMultipart, needsMultipartEncoding, } from './build-multipart.js';
10
10
  import { getExampleFromBody } from './get-request-body-example.js';
11
11
  import { getSelectedBodyContentType } from './get-selected-body-content-type.js';
@@ -90,7 +90,7 @@ requestBodyCompositionSelection, openapiVersion) => {
90
90
  // object schema that declares it outside `required`, so undeclared and required keys are
91
91
  // always kept. This mirrors the unchecked-by-default checkbox in the Test Request panel.
92
92
  // The array (edited) form path is unaffected: it carries its own per-row `isDisabled`.
93
- const resolvedBodySchema = getResolvedRef(requestBody.content[bodyContentType]?.schema, mergeSiblingReferences);
93
+ const resolvedBodySchema = resolveFormSchema(requestBody.content[bodyContentType]?.schema, requestBodyCompositionSelection);
94
94
  const objectBodySchema = resolvedBodySchema && isObjectSchema(resolvedBodySchema) ? resolvedBodySchema : undefined;
95
95
  // Composition (allOf/oneOf/anyOf) can mark a property required inside a subschema we do not
96
96
  // merge here, so skip dropping entirely for composed schemas rather than risk removing an
@@ -171,9 +171,7 @@ requestBodyCompositionSelection, openapiVersion) => {
171
171
  // lazily allocate the regrouped object for its top-level key and push it into
172
172
  // `entries` at the position of the *first* matching row, then keep folding leaves
173
173
  // into the same live object reference so interleaved flat rows keep their order.
174
- const multipartSchema = result.mode === 'formdata'
175
- ? getResolvedRef(requestBody.content[bodyContentType]?.schema, mergeSiblingReferences)
176
- : undefined;
174
+ const multipartSchema = result.mode === 'formdata' ? resolvedBodySchema : undefined;
177
175
  const entries = result.mode === 'formdata' ? regroupMultipartRows(exampleValue, multipartSchema) : exampleValue;
178
176
  // Loop over all entries and add them to the form
179
177
  entries.forEach(({ name, value }) => {
@@ -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,YAkBzC,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;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,4 +1,4 @@
1
- import { getResolvedRef, mergeSiblingReferences } from '@scalar/workspace-store/helpers/get-resolved-ref';
1
+ import { resolveSchemaWithAnnotations } from '@scalar/workspace-store/helpers/resolve-schema-with-annotations';
2
2
  import { isObjectSchema } from '@scalar/workspace-store/schemas/v3.2/strict/type-guards';
3
3
  /** Normalize a schema's `type` (string | string[] | absent) into a plain string array. */
4
4
  const normalizeSchemaTypes = (schema) => {
@@ -10,12 +10,12 @@ const normalizeSchemaTypes = (schema) => {
10
10
  * or undefined when any segment is not a declared object property.
11
11
  */
12
12
  export const resolveLeafSchema = (schema, segments) => {
13
- let current = schema;
13
+ let current = resolveSchemaWithAnnotations(schema);
14
14
  for (const segment of segments) {
15
15
  if (!current || !isObjectSchema(current) || !current.properties) {
16
16
  return undefined;
17
17
  }
18
- current = getResolvedRef(current.properties[segment], mergeSiblingReferences);
18
+ current = resolveSchemaWithAnnotations(current.properties[segment]);
19
19
  }
20
20
  return current;
21
21
  };
@@ -97,15 +97,13 @@ export const coerceUntypedValue = (value) => {
97
97
  * back into nested objects.
98
98
  */
99
99
  export const buildDottedNestedRowPredicate = (schema) => {
100
- const resolved = schema ? getResolvedRef(schema, mergeSiblingReferences) : undefined;
100
+ const resolved = schema ? resolveSchemaWithAnnotations(schema) : undefined;
101
101
  if (!resolved || !isObjectSchema(resolved) || !resolved.properties) {
102
102
  return (_name, _value) => false;
103
103
  }
104
104
  const nestedTopKeys = new Set();
105
105
  for (const [key, child] of Object.entries(resolved.properties)) {
106
- const childResolved = child
107
- ? getResolvedRef(child, mergeSiblingReferences)
108
- : undefined;
106
+ const childResolved = child ? resolveSchemaWithAnnotations(child) : undefined;
109
107
  if (childResolved && isObjectSchema(childResolved) && childResolved.properties) {
110
108
  nestedTopKeys.add(key);
111
109
  }
@@ -1 +1 @@
1
- {"version":3,"file":"build-request.d.ts","sourceRoot":"","sources":["../../../src/request-example/builder/build-request.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,KAAK,MAAM,EAAW,MAAM,8BAA8B,CAAA;AAQnE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,2CAA2C,CAAA;AAC/E,OAAO,EACL,KAAK,6BAA6B,EAEnC,MAAM,uDAAuD,CAAA;AAK9D;;GAEG;AACH,MAAM,MAAM,cAAc,GAAG,CAAC,MAAM,EAAE,WAAW,CAAC,CAAA;AAwClD;;;;;;;GAOG;AACH,eAAO,MAAM,2BAA2B,GACtC,SAAS,cAAc,EACvB,cAAc,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,EACpC,iBAAiB;IAAE,6BAA6B,CAAC,EAAE,OAAO,CAAA;CAAE,KAC3D,MAyBF,CAAA;AAED;;;;;KAKK;AACL,MAAM,MAAM,gBAAgB,GAAG;IAC7B,kGAAkG;IAClG,cAAc,EAAE,cAAc,CAAA;IAC9B,2BAA2B;IAC3B,UAAU,EAAE,eAAe,CAAA;IAC3B,0DAA0D;IAC1D,YAAY,EAAE,OAAO,CAAA;CACtB,CAAA;AAED,wGAAwG;AACxG,eAAO,MAAM,oBAAoB,EAAG,sBAA+B,CAAA;AAEnE,MAAM,MAAM,uBAAuB,GAAG,6BAA6B,GAAG,OAAO,oBAAoB,CAAA;AAEjG,MAAM,MAAM,kBAAkB,GAAG,MAAM,CAAC,gBAAgB,EAAE,uBAAuB,CAAC,CAAA;AAElF,eAAO,MAAM,YAAY,GACvB,SAAS,cAAc,EACvB,SAAS;IACP,YAAY,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;IACpC;;;OAGG;IACH,6BAA6B,CAAC,EAAE,OAAO,CAAA;CACxC,KACA,kBAMF,CAAA"}
1
+ {"version":3,"file":"build-request.d.ts","sourceRoot":"","sources":["../../../src/request-example/builder/build-request.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,KAAK,MAAM,EAAW,MAAM,8BAA8B,CAAA;AAQnE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,2CAA2C,CAAA;AAC/E,OAAO,EACL,KAAK,6BAA6B,EAEnC,MAAM,uDAAuD,CAAA;AAK9D;;GAEG;AACH,MAAM,MAAM,cAAc,GAAG,CAAC,MAAM,EAAE,WAAW,CAAC,CAAA;AAwClD;;;;;;;GAOG;AACH,eAAO,MAAM,2BAA2B,GACtC,SAAS,cAAc,EACvB,cAAc,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,EACpC,iBAAiB;IAAE,6BAA6B,CAAC,EAAE,OAAO,CAAA;CAAE,KAC3D,MAyBF,CAAA;AAED;;;;;KAKK;AACL,MAAM,MAAM,gBAAgB,GAAG;IAC7B,kGAAkG;IAClG,cAAc,EAAE,cAAc,CAAA;IAC9B,2BAA2B;IAC3B,UAAU,EAAE,eAAe,CAAA;IAC3B,0DAA0D;IAC1D,YAAY,EAAE,OAAO,CAAA;CACtB,CAAA;AAED,wGAAwG;AACxG,eAAO,MAAM,oBAAoB,EAAG,sBAA+B,CAAA;AAEnE,MAAM,MAAM,uBAAuB,GAAG,6BAA6B,GAAG,OAAO,oBAAoB,CAAA;AAEjG,MAAM,MAAM,kBAAkB,GAAG,MAAM,CAAC,gBAAgB,EAAE,uBAAuB,CAAC,CAAA;AAElF,eAAO,MAAM,YAAY,GACvB,SAAS,cAAc,EACvB,SAAS;IACP,YAAY,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;IACpC;;;OAGG;IACH,6BAA6B,CAAC,EAAE,OAAO,CAAA;CACxC,KACA,kBASF,CAAA"}
@@ -68,6 +68,9 @@ export const resolveExecutableRequestUrl = (request, envVariables, resolveOption
68
68
  /** Catch-all code when an unexpected synchronous error escapes a helper during request construction. */
69
69
  export const BUILD_REQUEST_FAILED = 'BUILD_REQUEST_FAILED';
70
70
  export const buildRequest = (request, options) => {
71
+ if (request.cookieErrors?.length) {
72
+ return err(BUILD_REQUEST_FAILED, request.cookieErrors[0]);
73
+ }
71
74
  const guarded = safeRun(() => buildRequestInner(request, options));
72
75
  if (!guarded.ok) {
73
76
  return err(BUILD_REQUEST_FAILED, guarded.error);
@@ -1,5 +1,6 @@
1
1
  import { type XScalarCookie } from '@scalar/workspace-store/schemas/extensions/general/x-scalar-cookies';
2
2
  import type { ParameterObject, ReferenceType } from '@scalar/workspace-store/schemas/v3.2/strict/openapi-document';
3
+ import type { ReservedPathParameter } from '../../../helpers/encode-path-parameter.js';
3
4
  /**
4
5
  * Converts the parameters into a set of headers, cookies and url params while
5
6
  * replacing environment variables and extracting example values. Also builds up a record of the path
@@ -14,10 +15,15 @@ export declare const buildRequestParameters: (
14
15
  /** All parameters */
15
16
  parameters?: ReferenceType<ParameterObject>[],
16
17
  /** The key of the current example */
17
- exampleName?: string) => {
18
+ exampleName?: string,
19
+ /** Reserved path expansion was introduced in OpenAPI 3.2. */
20
+ openapiVersion?: string) => {
18
21
  cookies: XScalarCookie[];
22
+ /** Invalid active cookie parameters that prevent sending this request. */
23
+ cookieErrors?: string[];
19
24
  headers: Record<string, string>;
20
25
  pathVariables: Record<string, string>;
26
+ reservedPathParameters?: Record<string, ReservedPathParameter>;
21
27
  allowReservedQueryParameters: Set<string>;
22
28
  urlParams: URLSearchParams;
23
29
  serializedQuery?: string[];
@@ -1 +1 @@
1
- {"version":3,"file":"build-request-parameters.d.ts","sourceRoot":"","sources":["../../../../src/request-example/builder/header/build-request-parameters.ts"],"names":[],"mappings":"AAGA,OAAO,EACL,KAAK,aAAa,EAEnB,MAAM,qEAAqE,CAAA;AAE5E,OAAO,KAAK,EAAE,eAAe,EAAE,aAAa,EAAE,MAAM,8DAA8D,CAAA;AAqBlH;;;;;;;;;GASG;AACH,eAAO,MAAM,sBAAsB;AACjC,qBAAqB;AACrB,aAAY,aAAa,CAAC,eAAe,CAAC,EAAO;AACjD,qCAAqC;AACrC,cAAa,MAAkB,KAC9B;IACD,OAAO,EAAE,aAAa,EAAE,CAAA;IACxB,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;IAC/B,aAAa,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;IACrC,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;CA8IvC,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;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,4 +1,5 @@
1
1
  import { isDefined } from '@scalar/helpers/array/is-defined';
2
+ import { getCookieSerializationError } from '@scalar/helpers/http/get-cookie-serialization-error';
2
3
  import { isObject } from '@scalar/helpers/object/is-object';
3
4
  import { getResolvedRef } from '@scalar/workspace-store/helpers/get-resolved-ref';
4
5
  import { xScalarCookieSchema, } from '@scalar/workspace-store/schemas/extensions/general/x-scalar-cookies';
@@ -23,7 +24,9 @@ export const buildRequestParameters = (
23
24
  /** All parameters */
24
25
  parameters = [],
25
26
  /** The key of the current example */
26
- exampleName = 'default') => {
27
+ exampleName = 'default',
28
+ /** Reserved path expansion was introduced in OpenAPI 3.2. */
29
+ openapiVersion) => {
27
30
  const result = {
28
31
  cookies: [],
29
32
  headers: {},
@@ -123,6 +126,15 @@ exampleName = 'default') => {
123
126
  // Path parameters use simple style by default
124
127
  const serialized = serializeSimpleStyle(deSerializedValue, getExplode(param, false));
125
128
  result.pathVariables[paramName] = String(serialized);
129
+ if (openapiVersion?.startsWith('3.2.') && 'schema' in param && param.allowReserved === true) {
130
+ ;
131
+ (result.reservedPathParameters ??= {})[paramName] = {
132
+ value: deSerializedValue,
133
+ originalValue: String(serialized),
134
+ style: param.style ?? 'simple',
135
+ explode: getExplode(param, false),
136
+ };
137
+ }
126
138
  break;
127
139
  }
128
140
  case 'query': {
@@ -130,6 +142,15 @@ exampleName = 'default') => {
130
142
  break;
131
143
  }
132
144
  case 'cookie': {
145
+ const [major, minor] = (openapiVersion ?? '').split('.');
146
+ const error = major === '3' && minor === '2' && !('content' in param)
147
+ ? getCookieSerializationError(param, deSerializedValue)
148
+ : undefined;
149
+ if (error) {
150
+ ;
151
+ (result.cookieErrors ??= []).push(error);
152
+ break;
153
+ }
133
154
  if ('style' in param && param.style === 'cookie') {
134
155
  result.cookies.push(...serializeCookieStyle(paramName, deSerializedValue, getExplode(param, true)).map((cookie) => coerceValue(xScalarCookieSchema, { ...cookie, path: '/' })));
135
156
  break;
@@ -2,6 +2,7 @@ import type { XScalarEnvironment } from '@scalar/workspace-store/schemas/extensi
2
2
  import type { XScalarCookie } from '@scalar/workspace-store/schemas/extensions/general/x-scalar-cookies';
3
3
  import type { ServerObject } from '@scalar/workspace-store/schemas/v3.2/strict/openapi-document';
4
4
  import type { OperationObject } from '@scalar/workspace-store/schemas/v3.2/strict/operation';
5
+ import type { ReservedPathParameter } from '../../helpers/encode-path-parameter.js';
5
6
  import { type QuerystringParameter } from '../../helpers/querystring-parameter.js';
6
7
  import { type BuildRequestSecurityResult } from '../../request-example/builder/security/build-request-security.js';
7
8
  import type { SecuritySchemeObjectSecret } from '../../request-example/builder/security/secret-types.js';
@@ -74,6 +75,8 @@ import { type RequestBody } from './body/build-request-body.js';
74
75
  * ```
75
76
  */
76
77
  export type RequestFactory = {
78
+ /** Invalid active cookie declarations, retained for previews and reported before sending. */
79
+ cookieErrors?: string[];
77
80
  /**
78
81
  * The base API server URL prior to environment or server variable substitution.
79
82
  * May still contain placeholders such as `{version}` or `{region}`.
@@ -94,6 +97,8 @@ export type RequestFactory = {
94
97
  variables: Record<string, string>;
95
98
  /** Names whose example is already URI-encoded. */
96
99
  serializedParameters?: Set<string>;
100
+ /** Schema-based values using OpenAPI 3.2 reserved expansion. */
101
+ reservedParameters?: Record<string, ReservedPathParameter>;
97
102
  /**
98
103
  * The raw request path string, as entered by the user or read from the OpenAPI schema.
99
104
  * Placeholders are not yet substituted.
@@ -198,7 +203,7 @@ export declare const requestFactory: ({ exampleName, globalCookies, method, oper
198
203
  /** The selected security schemes for the current operation */
199
204
  selectedSecuritySchemes: SecuritySchemeObjectSecret[];
200
205
  /** Selected anyOf/oneOf request-body variants keyed by schema path */
201
- /** Originating OpenAPI version, used for XML mapping rules. */
206
+ /** Originating OpenAPI version, used for version-specific serialization. */
202
207
  openapiVersion?: string;
203
208
  requestBodyCompositionSelection?: Record<string, number>;
204
209
  }) => {