@scalar/oas-utils 0.4.20 → 0.4.22

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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,26 @@
1
1
  # @scalar/oas-utils
2
2
 
3
+ ## 0.4.22
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies [443c507]
8
+ - Updated dependencies [88385b1]
9
+ - Updated dependencies [50032be]
10
+ - @scalar/workspace-store@0.14.2
11
+ - @scalar/json-magic@0.3.1
12
+ - @scalar/types@0.2.13
13
+ - @scalar/themes@0.13.14
14
+
15
+ ## 0.4.21
16
+
17
+ ### Patch Changes
18
+
19
+ - e2272a1: fix(oas-utils): use const value as example
20
+ - b6f4b60: fix: skip readOnly properties in request examples
21
+ - Updated dependencies [b8776fc]
22
+ - @scalar/workspace-store@0.14.1
23
+
3
24
  ## 0.4.20
4
25
 
5
26
  ### Patch Changes
@@ -38,7 +38,7 @@ const processBody = ({ content, contentType, example }) => {
38
38
  }
39
39
  const contentSchema = getResolvedRef(content[_contentType]?.schema);
40
40
  if (contentSchema) {
41
- const extractedExample = getExampleFromSchema(contentSchema);
41
+ const extractedExample = getExampleFromSchema(contentSchema, { mode: "write" });
42
42
  if (extractedExample !== void 0) {
43
43
  if (isFormData && typeof extractedExample === "object" && extractedExample !== null) {
44
44
  return {
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/helpers/operation-to-har/process-body.ts"],
4
- "sourcesContent": ["import type { OperationToHarProps } from './operation-to-har'\nimport { getExampleFromSchema } from '@/spec-getters/get-example-from-schema'\nimport { getResolvedRef } from '@scalar/workspace-store/helpers/get-resolved-ref'\nimport type { RequestBodyObject } from '@scalar/workspace-store/schemas/v3.1/strict/request-body'\nimport type { Param, PostData } from 'har-format'\n\ntype ProcessBodyProps = Pick<OperationToHarProps, 'contentType' | 'example'> & {\n content: RequestBodyObject['content']\n}\n\n/**\n * Converts an object to an array of form parameters\n * @param obj - The object to convert\n * @returns Array of form parameters with name and value properties\n */\nconst objectToFormParams = (obj: Record<string, unknown>): Param[] => {\n const params: Param[] = []\n\n for (const [key, value] of Object.entries(obj)) {\n if (value === undefined || value === null) {\n continue\n }\n\n // Handle arrays by adding each item with the same key\n if (Array.isArray(value)) {\n for (const item of value) {\n params.push({ name: key, value: String(item) })\n }\n }\n // Handle nested objects by flattening them\n else if (typeof value === 'object') {\n const nestedParams = objectToFormParams(value as Record<string, unknown>)\n\n for (const param of nestedParams) {\n params.push({ name: `${key}.${param.name}`, value: param.value })\n }\n } else {\n params.push({ name: key, value: String(value) })\n }\n }\n\n return params\n}\n\n/**\n * Processes the request body and returns the processed data\n */\nexport const processBody = ({ content, contentType, example }: ProcessBodyProps): PostData => {\n const _contentType = (contentType || Object.keys(content)[0]) ?? ''\n\n // Check if this is a form data content type\n const isFormData = _contentType === 'multipart/form-data' || _contentType === 'application/x-www-form-urlencoded'\n\n // Return the provided top level example\n if (example) {\n if (isFormData && typeof example === 'object' && example !== null) {\n return {\n mimeType: _contentType,\n params: objectToFormParams(example as Record<string, unknown>),\n }\n }\n return {\n mimeType: _contentType,\n text: JSON.stringify(example),\n }\n }\n\n // Try to extract examples from the schema\n const contentSchema = getResolvedRef(content[_contentType]?.schema)\n if (contentSchema) {\n const extractedExample = getExampleFromSchema(contentSchema)\n\n if (extractedExample !== undefined) {\n if (isFormData && typeof extractedExample === 'object' && extractedExample !== null) {\n return {\n mimeType: _contentType,\n params: objectToFormParams(extractedExample as Record<string, unknown>),\n }\n }\n return {\n mimeType: _contentType,\n text: JSON.stringify(extractedExample),\n }\n }\n }\n\n return {\n mimeType: _contentType,\n text: 'null',\n }\n}\n"],
5
- "mappings": "AACA,SAAS,4BAA4B;AACrC,SAAS,sBAAsB;AAa/B,MAAM,qBAAqB,CAAC,QAA0C;AACpE,QAAM,SAAkB,CAAC;AAEzB,aAAW,CAAC,KAAK,KAAK,KAAK,OAAO,QAAQ,GAAG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V,MAAM,KAAK,UAAU,gBAAgB;AAAA,MACvC;AAAA,IACF;AAAA,EACF;AAEA,SAAO;AAAA,IACL,UAAU;AAAA,IACV,MAAM;AAAA,EACR;AACF;",
4
+ "sourcesContent": ["import type { OperationToHarProps } from './operation-to-har'\nimport { getExampleFromSchema } from '@/spec-getters/get-example-from-schema'\nimport { getResolvedRef } from '@scalar/workspace-store/helpers/get-resolved-ref'\nimport type { RequestBodyObject } from '@scalar/workspace-store/schemas/v3.1/strict/request-body'\nimport type { Param, PostData } from 'har-format'\n\ntype ProcessBodyProps = Pick<OperationToHarProps, 'contentType' | 'example'> & {\n content: RequestBodyObject['content']\n}\n\n/**\n * Converts an object to an array of form parameters\n * @param obj - The object to convert\n * @returns Array of form parameters with name and value properties\n */\nconst objectToFormParams = (obj: Record<string, unknown>): Param[] => {\n const params: Param[] = []\n\n for (const [key, value] of Object.entries(obj)) {\n if (value === undefined || value === null) {\n continue\n }\n\n // Handle arrays by adding each item with the same key\n if (Array.isArray(value)) {\n for (const item of value) {\n params.push({ name: key, value: String(item) })\n }\n }\n // Handle nested objects by flattening them\n else if (typeof value === 'object') {\n const nestedParams = objectToFormParams(value as Record<string, unknown>)\n\n for (const param of nestedParams) {\n params.push({ name: `${key}.${param.name}`, value: param.value })\n }\n } else {\n params.push({ name: key, value: String(value) })\n }\n }\n\n return params\n}\n\n/**\n * Processes the request body and returns the processed data\n */\nexport const processBody = ({ content, contentType, example }: ProcessBodyProps): PostData => {\n const _contentType = (contentType || Object.keys(content)[0]) ?? ''\n\n // Check if this is a form data content type\n const isFormData = _contentType === 'multipart/form-data' || _contentType === 'application/x-www-form-urlencoded'\n\n // Return the provided top level example\n if (example) {\n if (isFormData && typeof example === 'object' && example !== null) {\n return {\n mimeType: _contentType,\n params: objectToFormParams(example as Record<string, unknown>),\n }\n }\n return {\n mimeType: _contentType,\n text: JSON.stringify(example),\n }\n }\n\n // Try to extract examples from the schema\n const contentSchema = getResolvedRef(content[_contentType]?.schema)\n if (contentSchema) {\n const extractedExample = getExampleFromSchema(contentSchema, { mode: 'write' })\n\n if (extractedExample !== undefined) {\n if (isFormData && typeof extractedExample === 'object' && extractedExample !== null) {\n return {\n mimeType: _contentType,\n params: objectToFormParams(extractedExample as Record<string, unknown>),\n }\n }\n return {\n mimeType: _contentType,\n text: JSON.stringify(extractedExample),\n }\n }\n }\n\n return {\n mimeType: _contentType,\n text: 'null',\n }\n}\n"],
5
+ "mappings": "AACA,SAAS,4BAA4B;AACrC,SAAS,sBAAsB;AAa/B,MAAM,qBAAqB,CAAC,QAA0C;AACpE,QAAM,SAAkB,CAAC;AAEzB,aAAW,CAAC,KAAK,KAAK,KAAK,OAAO,QAAQ,GAAG,GAAG;AAC9C,QAAI,UAAU,UAAa,UAAU,MAAM;AACzC;AAAA,IACF;AAGA,QAAI,MAAM,QAAQ,KAAK,GAAG;AACxB,iBAAW,QAAQ,OAAO;AACxB,eAAO,KAAK,EAAE,MAAM,KAAK,OAAO,OAAO,IAAI,EAAE,CAAC;AAAA,MAChD;AAAA,IACF,WAES,OAAO,UAAU,UAAU;AAClC,YAAM,eAAe,mBAAmB,KAAgC;AAExE,iBAAW,SAAS,cAAc;AAChC,eAAO,KAAK,EAAE,MAAM,GAAG,GAAG,IAAI,MAAM,IAAI,IAAI,OAAO,MAAM,MAAM,CAAC;AAAA,MAClE;AAAA,IACF,OAAO;AACL,aAAO,KAAK,EAAE,MAAM,KAAK,OAAO,OAAO,KAAK,EAAE,CAAC;AAAA,IACjD;AAAA,EACF;AAEA,SAAO;AACT;AAKO,MAAM,cAAc,CAAC,EAAE,SAAS,aAAa,QAAQ,MAAkC;AAC5F,QAAM,gBAAgB,eAAe,OAAO,KAAK,OAAO,EAAE,CAAC,MAAM;AAGjE,QAAM,aAAa,iBAAiB,yBAAyB,iBAAiB;AAG9E,MAAI,SAAS;AACX,QAAI,cAAc,OAAO,YAAY,YAAY,YAAY,MAAM;AACjE,aAAO;AAAA,QACL,UAAU;AAAA,QACV,QAAQ,mBAAmB,OAAkC;AAAA,MAC/D;AAAA,IACF;AACA,WAAO;AAAA,MACL,UAAU;AAAA,MACV,MAAM,KAAK,UAAU,OAAO;AAAA,IAC9B;AAAA,EACF;AAGA,QAAM,gBAAgB,eAAe,QAAQ,YAAY,GAAG,MAAM;AAClE,MAAI,eAAe;AACjB,UAAM,mBAAmB,qBAAqB,eAAe,EAAE,MAAM,QAAQ,CAAC;AAE9E,QAAI,qBAAqB,QAAW;AAClC,UAAI,cAAc,OAAO,qBAAqB,YAAY,qBAAqB,MAAM;AACnF,eAAO;AAAA,UACL,UAAU;AAAA,UACV,QAAQ,mBAAmB,gBAA2C;AAAA,QACxE;AAAA,MACF;AACA,aAAO;AAAA,QACL,UAAU;AAAA,QACV,MAAM,KAAK,UAAU,gBAAgB;AAAA,MACvC;AAAA,IACF;AAAA,EACF;AAEA,SAAO;AAAA,IACL,UAAU;AAAA,IACV,MAAM;AAAA,EACR;AACF;",
6
6
  "names": []
7
7
  }
@@ -1 +1 @@
1
- {"version":3,"file":"get-example-from-schema.d.ts","sourceRoot":"","sources":["../../src/spec-getters/get-example-from-schema.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oDAAoD,CAAA;AAkEtF;;GAEG;AACH,eAAO,MAAM,oBAAoB,YACtB,YAAY,YACX;IACR;;;OAGG;IACH,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB;;;OAGG;IACH,GAAG,CAAC,EAAE,OAAO,CAAA;IACb;;;OAGG;IACH,IAAI,CAAC,EAAE,MAAM,GAAG,OAAO,CAAA;IACvB;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAA;IAC/B;;;OAGG;IACH,8BAA8B,CAAC,EAAE,OAAO,CAAA;CACzC,UACM,MAAM,iBACE,YAAY,SACpB,MAAM,KACZ,GAoTF,CAAA"}
1
+ {"version":3,"file":"get-example-from-schema.d.ts","sourceRoot":"","sources":["../../src/spec-getters/get-example-from-schema.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oDAAoD,CAAA;AAkEtF;;GAEG;AACH,eAAO,MAAM,oBAAoB,YACtB,YAAY,YACX;IACR;;;OAGG;IACH,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB;;;OAGG;IACH,GAAG,CAAC,EAAE,OAAO,CAAA;IACb;;;OAGG;IACH,IAAI,CAAC,EAAE,MAAM,GAAG,OAAO,CAAA;IACvB;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAA;IAC/B;;;OAGG;IACH,8BAA8B,CAAC,EAAE,OAAO,CAAA;CACzC,UACM,MAAM,iBACE,YAAY,SACpB,MAAM,KACZ,GAyTF,CAAA"}
@@ -85,6 +85,9 @@ const getExampleFromSchema = (_schema, options, level = 0, parentSchema, name) =
85
85
  if (schema.default !== void 0) {
86
86
  return cache(schema, schema.default);
87
87
  }
88
+ if (schema.const !== void 0) {
89
+ return cache(schema, schema.const);
90
+ }
88
91
  if (Array.isArray(schema.enum) && schema.enum.length > 0) {
89
92
  return cache(schema, schema.enum[0]);
90
93
  }
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/spec-getters/get-example-from-schema.ts"],
4
- "sourcesContent": ["import { isDefined } from '@scalar/helpers/array/is-defined'\nimport { getResolvedRef } from '@scalar/workspace-store/helpers/get-resolved-ref'\nimport type { SchemaObject } from '@scalar/workspace-store/schemas/v3.1/strict/schema'\n\nconst MAX_LEVELS_DEEP = 5\n/** Sets the max number of properties after the third level to prevent exponential horizontal growth */\nconst MAX_PROPERTIES = 10\n\n/** The default name for additional properties. */\nconst DEFAULT_ADDITIONAL_PROPERTIES_NAME = 'propertyName*'\n\nconst genericExampleValues: Record<string, string> = {\n // 'date-time': '1970-01-01T00:00:00Z',\n 'date-time': new Date().toISOString(),\n // 'date': '1970-01-01',\n 'date': new Date().toISOString().split('T')[0]!,\n 'email': 'hello@example.com',\n 'hostname': 'example.com',\n // https://tools.ietf.org/html/rfc6531#section-3.3\n 'idn-email': 'jane.doe@example.com',\n // https://tools.ietf.org/html/rfc5890#section-2.3.2.3\n 'idn-hostname': 'example.com',\n 'ipv4': '127.0.0.1',\n 'ipv6': '51d4:7fab:bfbf:b7d7:b2cb:d4b4:3dad:d998',\n 'iri-reference': '/entitiy/1',\n // https://tools.ietf.org/html/rfc3987\n 'iri': 'https://example.com/entity/123',\n 'json-pointer': '/nested/objects',\n 'password': 'super-secret',\n 'regex': '/[a-z]/',\n // https://tools.ietf.org/html/draft-handrews-relative-json-pointer-01\n 'relative-json-pointer': '1/nested/objects',\n // full-time in https://tools.ietf.org/html/rfc3339#section-5.6\n // 'time': '00:00:00Z',\n 'time': new Date().toISOString().split('T')[1]!.split('.')[0]!,\n // either a URI or relative-reference https://tools.ietf.org/html/rfc3986#section-4.1\n 'uri-reference': '../folder',\n 'uri-template': 'https://example.com/{id}',\n 'uri': 'https://example.com',\n 'uuid': '123e4567-e89b-12d3-a456-426614174000',\n 'object-id': '6592008029c8c3e4dc76256c',\n}\n\n/**\n * We can use the `format` to generate some random values.\n */\nfunction guessFromFormat(schema: SchemaObject, makeUpRandomData: boolean = false, fallback: string = '') {\n if (schema.format === 'binary') {\n return new File([''], 'filename')\n }\n return makeUpRandomData ? (genericExampleValues[schema.format ?? ''] ?? fallback) : ''\n}\n\n/** Map of all the results */\nconst resultCache = new WeakMap<Record<string, any>, any>()\n\n/** Store result in the cache, and return the result */\nfunction cache(schema: SchemaObject, result: unknown) {\n // Avoid unnecessary WeakMap operations for primitive values\n if (typeof result !== 'object' || result === null) {\n return result\n }\n\n resultCache.set(schema, result)\n\n return result\n}\n\n/**\n * This function takes an OpenAPI schema and generates an example from it\n */\nexport const getExampleFromSchema = (\n _schema: SchemaObject,\n options?: {\n /**\n * The fallback string for empty string values.\n * @default ''\n */\n emptyString?: string\n /**\n * Whether to use the XML tag names as keys\n * @default false\n */\n xml?: boolean\n /**\n * Whether to show read-only/write-only properties. Otherwise all properties are shown.\n * @default undefined\n */\n mode?: 'read' | 'write'\n /**\n * Dynamic values to add to the example.\n */\n variables?: Record<string, any>\n /**\n * Whether to omit empty and optional properties.\n * @default false\n */\n omitEmptyAndOptionalProperties?: boolean\n },\n level: number = 0,\n parentSchema?: SchemaObject,\n name?: string,\n): any => {\n const schema = getResolvedRef(_schema)\n\n // Check if the result is already cached\n if (resultCache.has(schema)) {\n return resultCache.get(schema)\n }\n\n // Check whether it's a circular reference\n if (level === MAX_LEVELS_DEEP + 1) {\n try {\n // Fails if it contains a circular reference\n JSON.stringify(schema)\n } catch {\n return '[Circular Reference]'\n }\n }\n\n // Sometimes, we just want the structure and no values.\n // But if `emptyString` is set, we do want to see some values.\n const makeUpRandomData = !!options?.emptyString\n\n // If the property is deprecated anyway, we don't want to show it.\n if (schema.deprecated) {\n return undefined\n }\n\n // Check if the property is read-only/write-only\n if ((options?.mode === 'write' && schema.readOnly) || (options?.mode === 'read' && schema.writeOnly)) {\n return undefined\n }\n\n // Use given variables as values\n if (schema['x-variable']) {\n const value = options?.variables?.[schema['x-variable']]\n\n // Return the value if it's defined\n if (value !== undefined) {\n // Type-casting\n if (schema.type === 'number' || schema.type === 'integer') {\n return Number.parseInt(value, 10)\n }\n\n return cache(schema, value)\n }\n }\n\n // Use the first example, if there's an array\n if (Array.isArray(schema.examples) && schema.examples.length > 0) {\n return cache(schema, schema.examples[0])\n }\n\n // Use an example, if there's one\n if (schema.example !== undefined) {\n return cache(schema, schema.example)\n }\n\n // Use a default value, if there's one\n if (schema.default !== undefined) {\n return cache(schema, schema.default)\n }\n\n // enum: [ 'available', 'pending', 'sold' ]\n if (Array.isArray(schema.enum) && schema.enum.length > 0) {\n return cache(schema, schema.enum[0])\n }\n\n // Check if the property is required\n const isObjectOrArray =\n schema.type === 'object' ||\n schema.type === 'array' ||\n !!schema.allOf?.at?.(0) ||\n !!schema.anyOf?.at?.(0) ||\n !!schema.oneOf?.at?.(0)\n if (!isObjectOrArray && options?.omitEmptyAndOptionalProperties === true) {\n const isRequired =\n // @ts-expect-error - I suppose old schema used to allow `required: true` remove when moving to new store\n schema.required === true ||\n // @ts-expect-error - I suppose old schema used to allow `required: true` remove when moving to new store\n parentSchema?.required === true ||\n parentSchema?.required?.includes(name ?? schema.title ?? '')\n\n if (!isRequired) {\n return undefined\n }\n }\n\n // Object\n if (schema.type === 'object' || schema.properties !== undefined) {\n const response: Record<string, any> = {}\n let propertyCount = 0\n\n // Regular properties\n if (schema.properties !== undefined) {\n for (const propertyName in schema.properties) {\n if (Object.prototype.hasOwnProperty.call(schema.properties, propertyName)) {\n // Only apply property limit for nested levels (level > 0)\n if (level > 3 && propertyCount >= MAX_PROPERTIES) {\n response['...'] = '[Additional Properties Truncated]'\n break\n }\n\n const property = getResolvedRef(schema.properties[propertyName])\n const propertyXmlTagName = options?.xml ? property?.xml?.name : undefined\n if (!property) {\n continue\n }\n\n const value = getExampleFromSchema(property, options, level + 1, schema, propertyName)\n\n if (typeof value !== 'undefined') {\n response[propertyXmlTagName ?? propertyName] = value\n propertyCount++\n }\n }\n }\n }\n\n // Pattern properties (regex)\n if (schema.patternProperties !== undefined) {\n for (const pattern in schema.patternProperties) {\n if (Object.prototype.hasOwnProperty.call(schema.patternProperties, pattern)) {\n const property = getResolvedRef(schema.patternProperties[pattern])\n if (!property) {\n continue\n }\n\n // Use the regex pattern as an example key\n const exampleKey = pattern\n\n response[exampleKey] = getExampleFromSchema(property, options, level + 1, schema, exampleKey)\n }\n }\n }\n\n // Additional properties\n if (schema.additionalProperties !== undefined) {\n const anyTypeIsValid =\n // true\n schema.additionalProperties === true ||\n // or an empty object {}\n (typeof schema.additionalProperties === 'object' && !Object.keys(schema.additionalProperties).length)\n\n const additionalProperties = getResolvedRef(schema.additionalProperties)\n\n // Get the custom name for additional properties if available\n const additionalPropertiesName =\n typeof additionalProperties === 'object' &&\n additionalProperties['x-additionalPropertiesName'] &&\n typeof additionalProperties['x-additionalPropertiesName'] === 'string' &&\n additionalProperties['x-additionalPropertiesName'].trim().length > 0\n ? `${additionalProperties['x-additionalPropertiesName'].trim()}*`\n : DEFAULT_ADDITIONAL_PROPERTIES_NAME\n\n if (anyTypeIsValid) {\n response[additionalPropertiesName] = 'anything'\n } else if (typeof additionalProperties === 'object') {\n response[additionalPropertiesName] = getExampleFromSchema(additionalProperties, options, level + 1)\n }\n }\n\n if (schema.anyOf?.[0]) {\n Object.assign(response, getExampleFromSchema(getResolvedRef(schema.anyOf[0]), options, level + 1))\n } else if (schema.oneOf?.[0] !== undefined) {\n Object.assign(response, getExampleFromSchema(getResolvedRef(schema.oneOf[0]), options, level + 1))\n } else if (schema.allOf?.[0]) {\n Object.assign(\n response,\n ...schema.allOf\n .filter(isDefined)\n .map((item) => getExampleFromSchema(getResolvedRef(item), options, level + 1, schema)),\n )\n }\n\n return cache(schema, response)\n }\n\n // Array\n if (schema.type === 'array' || schema.items !== undefined) {\n const items = getResolvedRef(schema.items)\n const itemsXmlTagName = items?.xml?.name\n const wrapItems = !!(options?.xml && schema.xml?.wrapped && itemsXmlTagName)\n\n if (schema.example !== undefined) {\n return cache(schema, wrapItems ? { [itemsXmlTagName]: schema.example } : schema.example)\n }\n\n // Check whether the array has a anyOf, oneOf, or allOf rule\n if (items) {\n // First handle allOf separately since it needs special handling\n if (items.allOf) {\n const allOf = items.allOf.filter(isDefined)\n const firstItem = getResolvedRef(allOf[0])\n\n // IfirstItemem is an object type, merge all schemas\n if (firstItem?.type === 'object') {\n const combined = { type: 'object', allOf } as SchemaObject\n\n const mergedExample = getExampleFromSchema(combined, options, level + 1, schema)\n\n return cache(schema, wrapItems ? [{ [itemsXmlTagName]: mergedExample }] : [mergedExample])\n }\n // For non-objects (like strings), collect all examples\n const examples = allOf\n .map((item) => getExampleFromSchema(getResolvedRef(item), options, level + 1, schema))\n .filter(isDefined)\n\n return cache(schema, wrapItems ? examples.map((example: any) => ({ [itemsXmlTagName]: example })) : examples)\n }\n\n // Handle other rules (anyOf, oneOf)\n const rules = ['anyOf', 'oneOf'] as const\n for (const rule of rules) {\n if (!items[rule]) {\n continue\n }\n\n const schemas = items[rule].slice(0, 1)\n const exampleFromRule = schemas\n .map((item) => getExampleFromSchema(getResolvedRef(item), options, level + 1, schema))\n .filter(isDefined)\n\n return cache(schema, wrapItems ? [{ [itemsXmlTagName]: exampleFromRule }] : exampleFromRule)\n }\n }\n\n // if it has type: 'object', or properties, it's an object\n const isObject = items?.type === 'object' || items?.properties !== undefined\n // if it has type: 'array', or items, it's an array\n const isArray = items?.type === 'array' || items?.items !== undefined\n\n if (items?.type || isObject || isArray) {\n const exampleFromSchema = getExampleFromSchema(items, options, level + 1)\n\n return wrapItems ? [{ [itemsXmlTagName]: exampleFromSchema }] : [exampleFromSchema]\n }\n\n return []\n }\n\n const exampleValues: Record<any, any> = {\n string: guessFromFormat(schema, makeUpRandomData, options?.emptyString),\n boolean: true,\n integer: schema.minimum ?? 1,\n number: schema.minimum ?? 1,\n array: [],\n }\n if (schema.type && !Array.isArray(schema.type) && exampleValues[schema.type] !== undefined) {\n return cache(schema, exampleValues[schema.type])\n }\n\n const discriminateSchema = schema.oneOf || schema.anyOf\n // Check if property has the `oneOf` | `anyOf` key\n if (Array.isArray(discriminateSchema) && discriminateSchema.length > 0) {\n // Find the first non-null type in the oneOf/anyOf array\n const firstNonNullItem = discriminateSchema.map((item) => getResolvedRef(item)).find((item) => item.type !== 'null')\n\n if (firstNonNullItem) {\n // Return an example for the first non-null item\n return getExampleFromSchema(firstNonNullItem, options, level + 1)\n }\n\n // If all items are null, return null\n return null\n }\n\n // Check if schema has the `allOf` key\n if (Array.isArray(schema.allOf)) {\n let example: any = null\n\n // Loop through all `allOf` schemas\n schema.allOf.forEach((allOfItem) => {\n // Return an example from the schema\n const newExample = getExampleFromSchema(getResolvedRef(allOfItem), options, level + 1)\n\n // Merge or overwrite the example\n example =\n typeof newExample === 'object' && typeof example === 'object'\n ? {\n ...(example ?? {}),\n ...newExample,\n }\n : Array.isArray(newExample) && Array.isArray(example)\n ? [...(example ?? {}), ...newExample]\n : newExample\n })\n\n return cache(schema, example)\n }\n\n // Check if schema is a union type\n if (Array.isArray(schema.type)) {\n // Return null if the type is nullable\n if (schema.type.includes('null')) {\n return null\n }\n // Return an example for the first type in the union\n const exampleValue = exampleValues[schema.type[0] ?? '']\n if (exampleValue !== undefined) {\n return cache(schema, exampleValue)\n }\n }\n\n // Warn if the type is unknown \u2026\n // console.warn(`[getExampleFromSchema] Unknown property type \"${schema.type}\".`)\n\n // \u2026 and just return null for now.\n return null\n}\n"],
5
- "mappings": "AAAA,SAAS,iBAAiB;AAC1B,SAAS,sBAAsB;AAG/B,MAAM,kBAAkB;AAExB,MAAM,iBAAiB;AAGvB,MAAM,qCAAqC;AAE3C,MAAM,uBAA+C;AAAA;AAAA,EAEnD,cAAa,oBAAI,KAAK,GAAE,YAAY;AAAA;AAAA,EAEpC,SAAQ,oBAAI,KAAK,GAAE,YAAY,EAAE,MAAM,GAAG,EAAE,CAAC;AAAA,EAC7C,SAAS;AAAA,EACT,YAAY;AAAA;AAAA,EAEZ,aAAa;AAAA;AAAA,EAEb,gBAAgB;AAAA,EAChB,QAAQ;AAAA,EACR,QAAQ;AAAA,EACR,iBAAiB;AAAA;AAAA,EAEjB,OAAO;AAAA,EACP,gBAAgB;AAAA,EAChB,YAAY;AAAA,EACZ,SAAS;AAAA;AAAA,EAET,yBAAyB;AAAA;AAAA;AAAA,EAGzB,SAAQ,oBAAI,KAAK,GAAE,YAAY,EAAE,MAAM,GAAG,EAAE,CAAC,EAAG,MAAM,GAAG,EAAE,CAAC;AAAA;AAAA,EAE5D,iBAAiB;AAAA,EACjB,gBAAgB;AAAA,EAChB,OAAO;AAAA,EACP,QAAQ;AAAA,EACR,aAAa;AACf;AAKA,SAAS,gBAAgB,QAAsB,mBAA4B,OAAO,WAAmB,IAAI;AACvG,MAAI,OAAO,WAAW,UAAU;AAC9B,WAAO,IAAI,KAAK,C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qB,kBAAkB,SAAS,QAAQ,CAAC;AAAA,IAClE;AAGA,WAAO;AAAA,EACT;AAGA,MAAI,MAAM,QAAQ,OAAO,KAAK,GAAG;AAC/B,QAAI,UAAe;AAGnB,WAAO,MAAM,QAAQ,CAAC,cAAc;AAElC,YAAM,aAAa,qBAAqB,eAAe,SAAS,GAAG,SAAS,QAAQ,CAAC;AAGrF,gBACE,OAAO,eAAe,YAAY,OAAO,YAAY,WACjD;AAAA,QACE,GAAI,WAAW,CAAC;AAAA,QAChB,GAAG;AAAA,MACL,IACA,MAAM,QAAQ,UAAU,KAAK,MAAM,QAAQ,OAAO,IAChD,CAAC,GAAI,WAAW,CAAC,GAAI,GAAG,UAAU,IAClC;AAAA,IACV,CAAC;AAED,WAAO,MAAM,QAAQ,OAAO;AAAA,EAC9B;AAGA,MAAI,MAAM,QAAQ,OAAO,IAAI,GAAG;AAE9B,QAAI,OAAO,KAAK,SAAS,MAAM,GAAG;AAChC,aAAO;AAAA,IACT;AAEA,UAAM,eAAe,cAAc,OAAO,KAAK,CAAC,KAAK,EAAE;AACvD,QAAI,iBAAiB,QAAW;AAC9B,aAAO,MAAM,QAAQ,YAAY;AAAA,IACnC;AAAA,EACF;AAMA,SAAO;AACT;",
4
+ "sourcesContent": ["import { isDefined } from '@scalar/helpers/array/is-defined'\nimport { getResolvedRef } from '@scalar/workspace-store/helpers/get-resolved-ref'\nimport type { SchemaObject } from '@scalar/workspace-store/schemas/v3.1/strict/schema'\n\nconst MAX_LEVELS_DEEP = 5\n/** Sets the max number of properties after the third level to prevent exponential horizontal growth */\nconst MAX_PROPERTIES = 10\n\n/** The default name for additional properties. */\nconst DEFAULT_ADDITIONAL_PROPERTIES_NAME = 'propertyName*'\n\nconst genericExampleValues: Record<string, string> = {\n // 'date-time': '1970-01-01T00:00:00Z',\n 'date-time': new Date().toISOString(),\n // 'date': '1970-01-01',\n 'date': new Date().toISOString().split('T')[0]!,\n 'email': 'hello@example.com',\n 'hostname': 'example.com',\n // https://tools.ietf.org/html/rfc6531#section-3.3\n 'idn-email': 'jane.doe@example.com',\n // https://tools.ietf.org/html/rfc5890#section-2.3.2.3\n 'idn-hostname': 'example.com',\n 'ipv4': '127.0.0.1',\n 'ipv6': '51d4:7fab:bfbf:b7d7:b2cb:d4b4:3dad:d998',\n 'iri-reference': '/entitiy/1',\n // https://tools.ietf.org/html/rfc3987\n 'iri': 'https://example.com/entity/123',\n 'json-pointer': '/nested/objects',\n 'password': 'super-secret',\n 'regex': '/[a-z]/',\n // https://tools.ietf.org/html/draft-handrews-relative-json-pointer-01\n 'relative-json-pointer': '1/nested/objects',\n // full-time in https://tools.ietf.org/html/rfc3339#section-5.6\n // 'time': '00:00:00Z',\n 'time': new Date().toISOString().split('T')[1]!.split('.')[0]!,\n // either a URI or relative-reference https://tools.ietf.org/html/rfc3986#section-4.1\n 'uri-reference': '../folder',\n 'uri-template': 'https://example.com/{id}',\n 'uri': 'https://example.com',\n 'uuid': '123e4567-e89b-12d3-a456-426614174000',\n 'object-id': '6592008029c8c3e4dc76256c',\n}\n\n/**\n * We can use the `format` to generate some random values.\n */\nfunction guessFromFormat(schema: SchemaObject, makeUpRandomData: boolean = false, fallback: string = '') {\n if (schema.format === 'binary') {\n return new File([''], 'filename')\n }\n return makeUpRandomData ? (genericExampleValues[schema.format ?? ''] ?? fallback) : ''\n}\n\n/** Map of all the results */\nconst resultCache = new WeakMap<Record<string, any>, any>()\n\n/** Store result in the cache, and return the result */\nfunction cache(schema: SchemaObject, result: unknown) {\n // Avoid unnecessary WeakMap operations for primitive values\n if (typeof result !== 'object' || result === null) {\n return result\n }\n\n resultCache.set(schema, result)\n\n return result\n}\n\n/**\n * This function takes an OpenAPI schema and generates an example from it\n */\nexport const getExampleFromSchema = (\n _schema: SchemaObject,\n options?: {\n /**\n * The fallback string for empty string values.\n * @default ''\n */\n emptyString?: string\n /**\n * Whether to use the XML tag names as keys\n * @default false\n */\n xml?: boolean\n /**\n * Whether to show read-only/write-only properties. Otherwise all properties are shown.\n * @default undefined\n */\n mode?: 'read' | 'write'\n /**\n * Dynamic values to add to the example.\n */\n variables?: Record<string, any>\n /**\n * Whether to omit empty and optional properties.\n * @default false\n */\n omitEmptyAndOptionalProperties?: boolean\n },\n level: number = 0,\n parentSchema?: SchemaObject,\n name?: string,\n): any => {\n const schema = getResolvedRef(_schema)\n\n // Check if the result is already cached\n if (resultCache.has(schema)) {\n return resultCache.get(schema)\n }\n\n // Check whether it's a circular reference\n if (level === MAX_LEVELS_DEEP + 1) {\n try {\n // Fails if it contains a circular reference\n JSON.stringify(schema)\n } catch {\n return '[Circular Reference]'\n }\n }\n\n // Sometimes, we just want the structure and no values.\n // But if `emptyString` is set, we do want to see some values.\n const makeUpRandomData = !!options?.emptyString\n\n // If the property is deprecated anyway, we don't want to show it.\n if (schema.deprecated) {\n return undefined\n }\n\n // Check if the property is read-only/write-only\n if ((options?.mode === 'write' && schema.readOnly) || (options?.mode === 'read' && schema.writeOnly)) {\n return undefined\n }\n\n // Use given variables as values\n if (schema['x-variable']) {\n const value = options?.variables?.[schema['x-variable']]\n\n // Return the value if it's defined\n if (value !== undefined) {\n // Type-casting\n if (schema.type === 'number' || schema.type === 'integer') {\n return Number.parseInt(value, 10)\n }\n\n return cache(schema, value)\n }\n }\n\n // Use the first example, if there's an array\n if (Array.isArray(schema.examples) && schema.examples.length > 0) {\n return cache(schema, schema.examples[0])\n }\n\n // Use an example, if there's one\n if (schema.example !== undefined) {\n return cache(schema, schema.example)\n }\n\n // Use a default value, if there's one\n if (schema.default !== undefined) {\n return cache(schema, schema.default)\n }\n\n // Use a const value, if there's one\n if (schema.const !== undefined) {\n return cache(schema, schema.const)\n }\n\n // enum: [ 'available', 'pending', 'sold' ]\n if (Array.isArray(schema.enum) && schema.enum.length > 0) {\n return cache(schema, schema.enum[0])\n }\n\n // Check if the property is required\n const isObjectOrArray =\n schema.type === 'object' ||\n schema.type === 'array' ||\n !!schema.allOf?.at?.(0) ||\n !!schema.anyOf?.at?.(0) ||\n !!schema.oneOf?.at?.(0)\n if (!isObjectOrArray && options?.omitEmptyAndOptionalProperties === true) {\n const isRequired =\n // @ts-expect-error - I suppose old schema used to allow `required: true` remove when moving to new store\n schema.required === true ||\n // @ts-expect-error - I suppose old schema used to allow `required: true` remove when moving to new store\n parentSchema?.required === true ||\n parentSchema?.required?.includes(name ?? schema.title ?? '')\n\n if (!isRequired) {\n return undefined\n }\n }\n\n // Object\n if (schema.type === 'object' || schema.properties !== undefined) {\n const response: Record<string, any> = {}\n let propertyCount = 0\n\n // Regular properties\n if (schema.properties !== undefined) {\n for (const propertyName in schema.properties) {\n if (Object.prototype.hasOwnProperty.call(schema.properties, propertyName)) {\n // Only apply property limit for nested levels (level > 0)\n if (level > 3 && propertyCount >= MAX_PROPERTIES) {\n response['...'] = '[Additional Properties Truncated]'\n break\n }\n\n const property = getResolvedRef(schema.properties[propertyName])\n const propertyXmlTagName = options?.xml ? property?.xml?.name : undefined\n if (!property) {\n continue\n }\n\n const value = getExampleFromSchema(property, options, level + 1, schema, propertyName)\n\n if (typeof value !== 'undefined') {\n response[propertyXmlTagName ?? propertyName] = value\n propertyCount++\n }\n }\n }\n }\n\n // Pattern properties (regex)\n if (schema.patternProperties !== undefined) {\n for (const pattern in schema.patternProperties) {\n if (Object.prototype.hasOwnProperty.call(schema.patternProperties, pattern)) {\n const property = getResolvedRef(schema.patternProperties[pattern])\n if (!property) {\n continue\n }\n\n // Use the regex pattern as an example key\n const exampleKey = pattern\n\n response[exampleKey] = getExampleFromSchema(property, options, level + 1, schema, exampleKey)\n }\n }\n }\n\n // Additional properties\n if (schema.additionalProperties !== undefined) {\n const anyTypeIsValid =\n // true\n schema.additionalProperties === true ||\n // or an empty object {}\n (typeof schema.additionalProperties === 'object' && !Object.keys(schema.additionalProperties).length)\n\n const additionalProperties = getResolvedRef(schema.additionalProperties)\n\n // Get the custom name for additional properties if available\n const additionalPropertiesName =\n typeof additionalProperties === 'object' &&\n additionalProperties['x-additionalPropertiesName'] &&\n typeof additionalProperties['x-additionalPropertiesName'] === 'string' &&\n additionalProperties['x-additionalPropertiesName'].trim().length > 0\n ? `${additionalProperties['x-additionalPropertiesName'].trim()}*`\n : DEFAULT_ADDITIONAL_PROPERTIES_NAME\n\n if (anyTypeIsValid) {\n response[additionalPropertiesName] = 'anything'\n } else if (typeof additionalProperties === 'object') {\n response[additionalPropertiesName] = getExampleFromSchema(additionalProperties, options, level + 1)\n }\n }\n\n if (schema.anyOf?.[0]) {\n Object.assign(response, getExampleFromSchema(getResolvedRef(schema.anyOf[0]), options, level + 1))\n } else if (schema.oneOf?.[0] !== undefined) {\n Object.assign(response, getExampleFromSchema(getResolvedRef(schema.oneOf[0]), options, level + 1))\n } else if (schema.allOf?.[0]) {\n Object.assign(\n response,\n ...schema.allOf\n .filter(isDefined)\n .map((item) => getExampleFromSchema(getResolvedRef(item), options, level + 1, schema)),\n )\n }\n\n return cache(schema, response)\n }\n\n // Array\n if (schema.type === 'array' || schema.items !== undefined) {\n const items = getResolvedRef(schema.items)\n const itemsXmlTagName = items?.xml?.name\n const wrapItems = !!(options?.xml && schema.xml?.wrapped && itemsXmlTagName)\n\n if (schema.example !== undefined) {\n return cache(schema, wrapItems ? { [itemsXmlTagName]: schema.example } : schema.example)\n }\n\n // Check whether the array has a anyOf, oneOf, or allOf rule\n if (items) {\n // First handle allOf separately since it needs special handling\n if (items.allOf) {\n const allOf = items.allOf.filter(isDefined)\n const firstItem = getResolvedRef(allOf[0])\n\n // IfirstItemem is an object type, merge all schemas\n if (firstItem?.type === 'object') {\n const combined = { type: 'object', allOf } as SchemaObject\n\n const mergedExample = getExampleFromSchema(combined, options, level + 1, schema)\n\n return cache(schema, wrapItems ? [{ [itemsXmlTagName]: mergedExample }] : [mergedExample])\n }\n // For non-objects (like strings), collect all examples\n const examples = allOf\n .map((item) => getExampleFromSchema(getResolvedRef(item), options, level + 1, schema))\n .filter(isDefined)\n\n return cache(schema, wrapItems ? examples.map((example: any) => ({ [itemsXmlTagName]: example })) : examples)\n }\n\n // Handle other rules (anyOf, oneOf)\n const rules = ['anyOf', 'oneOf'] as const\n for (const rule of rules) {\n if (!items[rule]) {\n continue\n }\n\n const schemas = items[rule].slice(0, 1)\n const exampleFromRule = schemas\n .map((item) => getExampleFromSchema(getResolvedRef(item), options, level + 1, schema))\n .filter(isDefined)\n\n return cache(schema, wrapItems ? [{ [itemsXmlTagName]: exampleFromRule }] : exampleFromRule)\n }\n }\n\n // if it has type: 'object', or properties, it's an object\n const isObject = items?.type === 'object' || items?.properties !== undefined\n // if it has type: 'array', or items, it's an array\n const isArray = items?.type === 'array' || items?.items !== undefined\n\n if (items?.type || isObject || isArray) {\n const exampleFromSchema = getExampleFromSchema(items, options, level + 1)\n\n return wrapItems ? [{ [itemsXmlTagName]: exampleFromSchema }] : [exampleFromSchema]\n }\n\n return []\n }\n\n const exampleValues: Record<any, any> = {\n string: guessFromFormat(schema, makeUpRandomData, options?.emptyString),\n boolean: true,\n integer: schema.minimum ?? 1,\n number: schema.minimum ?? 1,\n array: [],\n }\n if (schema.type && !Array.isArray(schema.type) && exampleValues[schema.type] !== undefined) {\n return cache(schema, exampleValues[schema.type])\n }\n\n const discriminateSchema = schema.oneOf || schema.anyOf\n // Check if property has the `oneOf` | `anyOf` key\n if (Array.isArray(discriminateSchema) && discriminateSchema.length > 0) {\n // Find the first non-null type in the oneOf/anyOf array\n const firstNonNullItem = discriminateSchema.map((item) => getResolvedRef(item)).find((item) => item.type !== 'null')\n\n if (firstNonNullItem) {\n // Return an example for the first non-null item\n return getExampleFromSchema(firstNonNullItem, options, level + 1)\n }\n\n // If all items are null, return null\n return null\n }\n\n // Check if schema has the `allOf` key\n if (Array.isArray(schema.allOf)) {\n let example: any = null\n\n // Loop through all `allOf` schemas\n schema.allOf.forEach((allOfItem) => {\n // Return an example from the schema\n const newExample = getExampleFromSchema(getResolvedRef(allOfItem), options, level + 1)\n\n // Merge or overwrite the example\n example =\n typeof newExample === 'object' && typeof example === 'object'\n ? {\n ...(example ?? {}),\n ...newExample,\n }\n : Array.isArray(newExample) && Array.isArray(example)\n ? [...(example ?? {}), ...newExample]\n : newExample\n })\n\n return cache(schema, example)\n }\n\n // Check if schema is a union type\n if (Array.isArray(schema.type)) {\n // Return null if the type is nullable\n if (schema.type.includes('null')) {\n return null\n }\n // Return an example for the first type in the union\n const exampleValue = exampleValues[schema.type[0] ?? '']\n if (exampleValue !== undefined) {\n return cache(schema, exampleValue)\n }\n }\n\n // Warn if the type is unknown \u2026\n // console.warn(`[getExampleFromSchema] Unknown property type \"${schema.type}\".`)\n\n // \u2026 and just return null for now.\n return null\n}\n"],
5
+ "mappings": "AAAA,SAAS,iBAAiB;AAC1B,SAAS,sBAAsB;AAG/B,MAAM,kBAAkB;AAExB,MAAM,iBAAiB;AAGvB,MAAM,qCAAqC;AAE3C,MAAM,uBAA+C;AAAA;AAAA,EAEnD,cAAa,oBAAI,KAAK,GAAE,YAAY;AAAA;AAAA,EAEpC,SAAQ,oBAAI,KAAK,GAAE,YAAY,EAAE,MAAM,GAAG,EAAE,CAAC;AAAA,EAC7C,SAAS;AAAA,EACT,YAAY;AAAA;AAAA,EAEZ,aAAa;AAAA;AAAA,EAEb,gBAAgB;AAAA,EAChB,QAAQ;AAAA,EACR,QAAQ;AAAA,EACR,iBAAiB;AAAA;AAAA,EAEjB,OAAO;AAAA,EACP,gBAAgB;AAAA,EAChB,YAAY;AAAA,EACZ,SAAS;AAAA;AAAA,EAET,yBAAyB;AAAA;AAAA;AAAA,EAGzB,SAAQ,oBAAI,KAAK,GAAE,YAAY,EAAE,MAAM,GAAG,EAAE,CAAC,EAAG,MAAM,GAAG,EAAE,CAAC;AAAA;AAAA,EAE5D,iBAAiB;AAAA,EACjB,gBAAgB;AAAA,EAChB,OAAO;AAAA,EACP,QAAQ;AAAA,EACR,aAAa;AACf;AAKA,SAAS,gBAAgB,QAAsB,mBAA4B,OAAO,WAAmB,IAAI;AACvG,MAAI,OAAO,WAAW,UAAU;AAC9B,WAAO,IAAI,K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AAC,EAAE,KAAK,CAAC,SAAS,KAAK,SAAS,MAAM;AAEnH,QAAI,kBAAkB;AAEpB,aAAO,qBAAqB,kBAAkB,SAAS,QAAQ,CAAC;AAAA,IAClE;AAGA,WAAO;AAAA,EACT;AAGA,MAAI,MAAM,QAAQ,OAAO,KAAK,GAAG;AAC/B,QAAI,UAAe;AAGnB,WAAO,MAAM,QAAQ,CAAC,cAAc;AAElC,YAAM,aAAa,qBAAqB,eAAe,SAAS,GAAG,SAAS,QAAQ,CAAC;AAGrF,gBACE,OAAO,eAAe,YAAY,OAAO,YAAY,WACjD;AAAA,QACE,GAAI,WAAW,CAAC;AAAA,QAChB,GAAG;AAAA,MACL,IACA,MAAM,QAAQ,UAAU,KAAK,MAAM,QAAQ,OAAO,IAChD,CAAC,GAAI,WAAW,CAAC,GAAI,GAAG,UAAU,IAClC;AAAA,IACV,CAAC;AAED,WAAO,MAAM,QAAQ,OAAO;AAAA,EAC9B;AAGA,MAAI,MAAM,QAAQ,OAAO,IAAI,GAAG;AAE9B,QAAI,OAAO,KAAK,SAAS,MAAM,GAAG;AAChC,aAAO;AAAA,IACT;AAEA,UAAM,eAAe,cAAc,OAAO,KAAK,CAAC,KAAK,EAAE;AACvD,QAAI,iBAAiB,QAAW;AAC9B,aAAO,MAAM,QAAQ,YAAY;AAAA,IACnC;AAAA,EACF;AAMA,SAAO;AACT;",
6
6
  "names": []
7
7
  }
package/package.json CHANGED
@@ -16,7 +16,7 @@
16
16
  "specification",
17
17
  "yaml"
18
18
  ],
19
- "version": "0.4.20",
19
+ "version": "0.4.22",
20
20
  "engines": {
21
21
  "node": ">=20"
22
22
  },
@@ -100,12 +100,12 @@
100
100
  "yaml": "2.8.0",
101
101
  "zod": "3.24.1",
102
102
  "@scalar/helpers": "0.0.8",
103
- "@scalar/object-utils": "1.2.4",
104
- "@scalar/json-magic": "0.3.0",
105
- "@scalar/themes": "0.13.13",
103
+ "@scalar/json-magic": "0.3.1",
106
104
  "@scalar/openapi-types": "0.3.7",
107
- "@scalar/workspace-store": "0.14.0",
108
- "@scalar/types": "0.2.12"
105
+ "@scalar/object-utils": "1.2.4",
106
+ "@scalar/themes": "0.13.14",
107
+ "@scalar/types": "0.2.13",
108
+ "@scalar/workspace-store": "0.14.2"
109
109
  },
110
110
  "devDependencies": {
111
111
  "@types/node": "^22.9.0",
@@ -114,7 +114,7 @@
114
114
  "vitest": "^3.2.4",
115
115
  "zod-to-ts": "github:amritk/zod-to-ts#build",
116
116
  "@scalar/build-tooling": "0.2.6",
117
- "@scalar/openapi-parser": "0.20.0",
117
+ "@scalar/openapi-parser": "0.20.1",
118
118
  "@scalar/openapi-types": "0.3.7"
119
119
  },
120
120
  "scripts": {