UNPKG

oas

Version:

Comprehensive tooling for working with OpenAPI definitions

1 lines 123 kB
{"version":3,"sources":["/Users/erunion/code/readme/oas/packages/oas/dist/chunk-YFZN44KB.cjs","../src/lib/urls.ts","../src/lib/get-user-variable.ts","../src/operation/lib/dedupe-common-parameters.ts","../src/samples/index.ts","../src/samples/utils.ts","../src/operation/lib/get-mediatype-examples.ts","../src/operation/lib/get-response-examples.ts","../src/operation/lib/get-callback-examples.ts","../src/operation/lib/get-example-groups.ts","../src/operation/lib/get-requestbody-examples.ts","../src/operation/lib/operationId.ts","../src/operation/transformers/get-response-as-json-schema.ts","../src/operation/index.ts"],"names":[],"mappings":"AAAA;AACE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACF,wDAA6B;AAC7B;AACE;AACF,wDAA6B;AAC7B;AACE;AACF,wDAA6B;AAC7B;AACA;ACtBA,8CAAoC;ADwBpC;AACA;AElBe,SAAR,eAAA,CAAiC,IAAA,EAAY,QAAA,EAAkB,WAAA,EAAwC;AAC5G,EAAA,IAAI,IAAA,EAAwB,IAAA;AAE5B,EAAA,GAAA,CAAI,OAAA,GAAU,KAAA,GAAQ,KAAA,CAAM,OAAA,CAAQ,IAAA,CAAK,IAAI,EAAA,GAAK,IAAA,CAAK,IAAA,CAAK,MAAA,EAAQ;AAClE,IAAA,GAAA,CAAI,WAAA,EAAa;AACf,MAAA,IAAA,EAAM,IAAA,CAAK,IAAA,CAAK,IAAA,CAAK,CAAA,CAAA,EAAA,GAAK,CAAA,CAAE,KAAA,IAAS,WAAW,CAAA;AAAA,IAClD,EAAA,KAAO;AACL,MAAA,IAAA,EAAM,IAAA,CAAK,IAAA,CAAK,CAAC,CAAA;AAAA,IACnB;AAAA,EACF;AAEA,EAAA,uBAAO,GAAA,4BAAA,CAAM,QAAQ,IAAA,GAAK,IAAA,CAAK,QAAQ,EAAA,GAAK,IAAA;AAC9C;AFkBA;AACA;ACeO,SAAS,kBAAA,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QAAA;AACM,QAAA;AAChB,MAAA;AAEO,MAAA;AAEA,IAAA;AAEM,IAAA;AACF,MAAA;AACf,IAAA;AAEO,IAAA;AACT,EAAA;AACF;AAEO;AAAgC;AAAA;AAAA;AAAA;AAAA;AAAA;AAYJ,EAAA;AACd,IAAA;AACH,MAAA;AACG,IAAA;AACR,MAAA;AACT,IAAA;AAEkB,IAAA;AACR,IAAA;AACU,MAAA;AACJ,MAAA;AAChB,IAAA;AAEoB,IAAA;AACtB,EAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAQqC,EAAA;AAClB,IAAA;AACH,MAAA;AACG,IAAA;AACR,MAAA;AACT,IAAA;AAEkB,IAAA;AACR,IAAA;AACU,MAAA;AACJ,MAAA;AAChB,IAAA;AAEoB,IAAA;AACtB,EAAA;AACF;AbmlBwB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA","file":"/Users/erunion/code/readme/oas/packages/oas/dist/chunk-YFZN44KB.cjs","sourcesContent":[null,"import type { HttpMethods, PathsObject, ServerObject, ServerVariable, ServerVariablesObject, User } from '../types';\nimport type { Match, ParamData } from 'path-to-regexp';\n\nimport { match, pathToRegexp } from 'path-to-regexp';\n\nimport { SERVER_VARIABLE_REGEX } from '../utils';\n\nimport getUserVariable from './get-user-variable';\n\nexport interface PathMatch {\n match?: Match<ParamData>;\n operation: PathsObject;\n url: {\n method?: HttpMethods;\n nonNormalizedPath: string;\n origin: string;\n path: string;\n slugs: Record<string, string>;\n };\n}\n\nexport type PathMatches = PathMatch[];\n\nexport type SplitUrlResult = (\n | {\n /**\n * A unique key, where the `value` is concatenated to its index\n */\n key: string;\n type: 'text';\n value: string;\n }\n | {\n /**\n * An optional description for the server variable.\n *\n * @see {@link https://spec.openapis.org/oas/v3.1.0#fixed-fields-4}\n */\n description?: string;\n\n /**\n * An enumeration of string values to be used if the substitution options are from a limited set.\n *\n * @see {@link https://spec.openapis.org/oas/v3.1.0#fixed-fields-4}\n */\n enum?: string[];\n\n /**\n * A unique key, where the `value` is concatenated to its index\n */\n key: string;\n type: 'variable';\n value: string;\n }\n)[];\n\nexport function stripTrailingSlash(url: string): string {\n if (url[url.length - 1] === '/') {\n return url.slice(0, -1);\n }\n\n return url;\n}\n\nfunction ensureProtocol(url: string) {\n // Add protocol to urls starting with // e.g. //example.com\n // This is because httpsnippet throws a HARError when it doesnt have a protocol\n if (url.match(/^\\/\\//)) {\n return `https:${url}`;\n }\n\n // Add protocol to urls with no // within them\n // This is because httpsnippet throws a HARError when it doesnt have a protocol\n if (!url.match(/\\/\\//)) {\n return `https://${url}`;\n }\n\n return url;\n}\n\n/**\n * Normalize an OpenAPI server URL by ensuring that it has a proper HTTP protocol and doesn't have a\n * trailing slash. If the selected server is unavailable or doesn't define a URL, fall back to\n * `https://example.com` so callers always receive an inert absolute URL.\n *\n * @param servers Server objects to choose from.\n * @param selected The index of the server object that we want to normalize.\n */\nexport function normalizedURLFromServers(servers: ServerObject[] | undefined, selected: number): string {\n const exampleDotCom = 'https://example.com';\n let url: string | undefined;\n try {\n url = servers?.[selected]?.url;\n // This is to catch the case where servers = [{}]\n if (!url) throw new Error('no url');\n\n // Stripping the '/' off the end\n url = stripTrailingSlash(url);\n\n // Check if the URL is just a path a missing an origin, for example `/api/v3`. If so, then make\n // `example.com` the origin to avoid it becoming something invalid like `https:///api/v3`.\n // RM-1044\n if (url.startsWith('/') && !url.startsWith('//')) {\n const urlWithOrigin = new URL(exampleDotCom);\n urlWithOrigin.pathname = url;\n url = urlWithOrigin.href;\n }\n } catch {\n url = exampleDotCom;\n }\n\n return ensureProtocol(url);\n}\n\nexport function variablesFromServers(servers: ServerObject[] | undefined, selected = 0): ServerVariablesObject {\n return servers?.[selected]?.variables || {};\n}\n\nexport function defaultVariablesFromServers(\n servers: ServerObject[] | undefined,\n selected = 0,\n user: User = {},\n): ServerVariable {\n const variables = variablesFromServers(servers, selected);\n const defaults: ServerVariable = {};\n\n Object.keys(variables).forEach(key => {\n defaults[key] = getUserVariable(user, key) || variables[key].default || '';\n });\n\n return defaults;\n}\n\nexport function splitUrlFromServers(servers: ServerObject[] | undefined, selected = 0): SplitUrlResult {\n const url = normalizedURLFromServers(servers, selected);\n const variables = variablesFromServers(servers, selected);\n\n return url\n .split(/({.+?})/)\n .filter(Boolean)\n .map((part, i) => {\n const isVariable = part.match(/[{}]/);\n const value = part.replace(/[{}]/g, '');\n const key = `${value}-${i}`;\n\n if (!isVariable) {\n return {\n type: 'text',\n value,\n key,\n } as const;\n }\n\n const variable = variables?.[value];\n return {\n type: 'variable',\n value,\n key,\n description: variable?.description,\n enum: variable?.enum,\n } as const;\n });\n}\n\n/**\n * With a URL that may contain server variables, transform those server variables into regex that\n * we can query against.\n *\n * For example, when given `https://{region}.node.example.com/v14` this will return back:\n *\n * https://([-_a-zA-Z0-9:.[\\\\]]+).node.example.com/v14\n *\n * @param url URL to transform\n */\nexport function transformURLIntoRegex(url: string): string {\n return stripTrailingSlash(url.replace(SERVER_VARIABLE_REGEX, '([-_a-zA-Z0-9:.[\\\\]]+)'));\n}\n\n/**\n * Normalize a path so that we can use it with `path-to-regexp` to do operation lookups.\n *\n * @param path Path to normalize.\n */\nfunction normalizePath(path: string) {\n return (\n path\n // This regex transforms `{pathParam}` into `:pathParam` so we can regex against it. We're\n // also handling quirks here like if there's an optional proceeding or trailing curly bracket\n // (`{{pathParam}` or `{pathParam}}`) as any unescaped curlys, which would be present in\n // `:pathParam}`, will throw a regex exception.\n // oxlint-disable-next-line no-unused-vars\n .replace(/({?){(.*?)}(}?)/g, (str, ...args) => {\n // If a path contains a path parameter with hyphens, like `:dlc-release`, when it's regexd\n // with `path-to-regexp` it match against the `:dlc` portion of the parameter, breaking all\n // matching against the full path.\n //\n // For example on `/games/:game/dlc/:dlc-release` the regex that's actually used to search\n // against a path like `/games/destiny-2/dlc/witch-queen` is the following:\n // /^\\/games(?:\\/([^\\/#\\?]+?))\\/dlc(?:\\/([^\\/#\\?]+?))-release[\\/#\\?]?$/i\n //\n // However if `:dlc-release` is rewritten to `:dlcrelease` we end up with a functional\n // regex: /^\\/games(?:\\/([^\\/#\\?]+?))\\/dlc(?:\\/([^\\/#\\?]+?))[\\/#\\?]?$/i.\n return `:${args[1].replace('-', '')}`;\n })\n\n // In addition to transforming `{pathParam}` into `:pathParam` we also need to escape cases\n // where a non-variabled colon is next to a variabled-colon because if we don't then\n // `path-to-regexp` won't be able to correct identify where the variable starts.\n //\n // For example if the URL is `/post/:param1::param2` we'll be escaping it to\n // `/post/:param1\\::param2`.\n .replace(/::/, '\\\\::')\n\n // We also need to escape question marks too because they're treated as regex modifiers.\n .split('?')[0]\n );\n}\n\n/**\n * Generate path matches for a given path and origin on a set of OpenAPI path objects.\n *\n * @see {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#paths-object}\n * @see {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#paths-object}\n * @param paths The OpenAPI Paths Object to process.\n * @param pathName Path to look for a match.\n * @param origin The origin that we're matching against.\n */\nexport function generatePathMatches(paths: PathsObject, pathName: string, origin: string): PathMatches {\n const prunedPathName = pathName.split('?')[0];\n const matches: PathMatches = Object.keys(paths)\n .map(path => {\n const cleanedPath = normalizePath(path);\n\n let matchResult: PathMatch['match'];\n try {\n const matchStatement = match(cleanedPath, { decode: decodeURIComponent });\n matchResult = matchStatement(prunedPathName);\n } catch {\n // If path matching fails for whatever reason (maybe they have a malformed path parameter)\n // then we shouldn't also fail.\n return false;\n }\n\n const slugs: Record<string, string> = {};\n\n if (matchResult && Object.keys(matchResult.params).length) {\n Object.keys(matchResult.params).forEach(param => {\n slugs[`:${param}`] = (matchResult.params as Record<string, string>)[param];\n });\n }\n\n return {\n url: {\n origin,\n path: cleanedPath.replace(/\\\\::/, '::'),\n nonNormalizedPath: path,\n slugs,\n },\n operation: paths[path] as PathsObject,\n match: matchResult,\n } satisfies PathMatch;\n })\n .filter(item => item !== false);\n\n return matches.filter(p => p.match);\n}\n\n/**\n * @param pathMatches Array of path matches to filter down.\n * @param targetMethod HTTP method to look for.\n * @returns Filtered down path matches.\n */\nexport function filterPathMethods(pathMatches: PathMatches, targetMethod: HttpMethods): PathMatch[] {\n const regExp = pathToRegexp(targetMethod);\n return pathMatches\n .map(p => {\n const captures = Object.keys(p.operation).filter(r => regExp.regexp.exec(r));\n\n if (captures.length) {\n const method = captures[0];\n p.url.method = method.toUpperCase() as HttpMethods;\n\n return {\n url: p.url,\n operation: p.operation[method],\n };\n }\n\n return false;\n })\n .filter((item): item is PathMatch => Boolean(item));\n}\n\n/**\n * @param pathMatches URL and PathsObject matches to narrow down to find a target path.\n * @returns An object containing matches that were discovered in the API definition.\n */\nexport function findTargetPath(pathMatches: PathMatch[]): PathMatch | undefined {\n if (!pathMatches.length) {\n return undefined;\n }\n\n let minCount = Object.keys(pathMatches[0].url.slugs).length;\n let found: PathMatch | undefined;\n\n for (let m = 0; m < pathMatches.length; m += 1) {\n const selection = pathMatches[m];\n const paramCount = Object.keys(selection.url.slugs).length;\n if (paramCount <= minCount) {\n minCount = paramCount;\n found = selection;\n }\n }\n\n return found;\n}\n","import type { User } from '../types.js';\n\n/**\n * Retrieve a user variable off of a given user.\n *\n * @see {@link https://docs.readme.com/docs/passing-data-to-jwt}\n * @param user The user to get a user variable for.\n * @param property The name of the variable to retrieve.\n * @param selectedApp The user app to retrieve an auth key for.\n */\nexport default function getUserVariable(user: User, property: string, selectedApp?: number | string): unknown {\n let key: User | undefined = user;\n\n if ('keys' in user && Array.isArray(user.keys) && user.keys.length) {\n if (selectedApp) {\n key = user.keys.find(k => k.name === selectedApp);\n } else {\n key = user.keys[0];\n }\n }\n\n return key?.[property] || user[property] || null;\n}\n","import type { ParameterObject } from '../../types.js';\n\nimport { isRef } from '../../types.js';\n\n/**\n * With an array of common parameters filter down them to what isn't already present in a list of\n * non-common parameters.\n *\n * @param parameters Array of parameters defined at the operation level.\n * @param commonParameters Array of **common** parameters defined at the path item level.\n */\nexport function dedupeCommonParameters(\n parameters: ParameterObject[],\n commonParameters: ParameterObject[],\n): ParameterObject[] {\n return commonParameters.filter((param: ParameterObject) => {\n return !parameters.find((param2: ParameterObject) => {\n if (param.name && param2.name) {\n return param.name === param2.name && param.in === param2.in;\n } else if (isRef(param) && isRef(param2)) {\n return param.$ref === param2.$ref;\n }\n\n return false;\n });\n });\n}\n","/**\n * This file has been extracted and modified from Swagger UI.\n *\n * @license Apache-2.0\n * @see {@link https://github.com/swagger-api/swagger-ui/blob/master/src/core/plugins/samples/fn.js}\n */\nimport type { OASDocument, SchemaObject } from '../types.js';\n\nimport mergeJSONSchemaAllOf from 'json-schema-merge-allof';\n\nimport { isRef } from '../types.js';\nimport { dereferenceRef, dereferenceRefDeep } from '../utils.js';\n\nimport { isFunc, normalizeArray, objectify, usesPolymorphism } from './utils.js';\n\nconst sampleDefaults = (genericSample: boolean | number | string) => {\n return (schema: SchemaObject): typeof genericSample =>\n typeof schema.default === typeof genericSample ? schema.default : genericSample;\n};\n\nconst primitives: Record<string, (arg: SchemaObject) => boolean | number | string> = {\n string: sampleDefaults('string'),\n string_email: sampleDefaults('user@example.com'),\n 'string_date-time': sampleDefaults(new Date().toISOString()),\n string_date: sampleDefaults(new Date().toISOString().substring(0, 10)),\n 'string_YYYY-MM-DD': sampleDefaults(new Date().toISOString().substring(0, 10)),\n string_uuid: sampleDefaults('3fa85f64-5717-4562-b3fc-2c963f66afa6'),\n string_hostname: sampleDefaults('example.com'),\n string_ipv4: sampleDefaults('198.51.100.42'),\n string_ipv6: sampleDefaults('2001:0db8:5b96:0000:0000:426f:8e17:642a'),\n number: sampleDefaults(0),\n number_float: sampleDefaults(0.0),\n integer: sampleDefaults(0),\n boolean: sampleDefaults(true),\n};\n\nconst primitive = (schema: SchemaObject) => {\n const objectifiedSchema = objectify(schema);\n const { format } = objectifiedSchema;\n let { type } = objectifiedSchema;\n\n if (type === 'null') {\n return null;\n } else if (Array.isArray(type)) {\n if (type.length === 1) {\n type = type[0];\n } else {\n // If one of our types is `null` then we should generate a sample for the non-null value.\n if (type.includes('null')) {\n type = type.filter(t => t !== 'null');\n }\n\n type = type.shift();\n }\n }\n\n // @todo add support for if `type` is an array\n const fn = primitives[`${type}_${format}`] || primitives[type as string];\n if (isFunc(fn)) {\n return fn(objectifiedSchema);\n }\n\n return `Unknown Type: ${objectifiedSchema.type}`;\n};\n\n/**\n * Generate a piece of sample data from a JSON Schema object. If `example` declarations are present\n * they will be utilized, but generally this will generate fake data for the information present in\n * the schema.\n *\n * @param schema JSON Schema to generate a sample for.\n */\nexport default function sampleFromSchema(\n schema: SchemaObject,\n opts: {\n /**\n * An OpenAPI definition to use when resolving `$ref` pointers.\n */\n definition?: OASDocument;\n\n /**\n * If you wish to include data that's flagged as `readOnly`.\n */\n includeReadOnly?: boolean;\n\n /**\n * If you wish to include data that's flatted as `writeOnly`.\n */\n includeWriteOnly?: boolean;\n\n /**\n * Collection of `$ref` pointers to keep track of when dereferencing schemas here in order to\n * prevent infinite loops on circular references\n */\n seenRefs?: Set<string>;\n } = {},\n): Record<string, unknown> | unknown[] | boolean | number | string | null | undefined {\n const seenRefs = opts.seenRefs || new Set<string>();\n let objectifySchema = objectify(schema);\n\n // If this is a `$ref` pointer we should make an attempt to resolve it so we can generate a full\n // sample for this schema.\n let refToRelease: string | undefined;\n if (opts.definition && isRef(objectifySchema)) {\n refToRelease = objectifySchema.$ref;\n if (seenRefs.has(refToRelease)) {\n return undefined;\n }\n\n objectifySchema = dereferenceRef(objectifySchema, opts.definition, seenRefs);\n if (!objectifySchema || isRef(objectifySchema)) {\n return undefined;\n }\n }\n\n try {\n return sampleFromResolvedSchema(objectifySchema, opts, seenRefs);\n } finally {\n // In order to support generating samples from schemas that have circular references we're\n // releasing our `$ref` from the `seenRefs` store here so, it's re-used again in another\n // top-level property we're processing, we can generated another sample for it.\n if (refToRelease) {\n seenRefs.delete(refToRelease);\n }\n }\n}\n\nfunction sampleFromResolvedSchema(\n schema: Record<string, any>,\n opts: {\n definition?: OASDocument;\n includeReadOnly?: boolean;\n includeWriteOnly?: boolean;\n seenRefs?: Set<string>;\n },\n seenRefs: Set<string>,\n) {\n let { type } = schema;\n const { example, additionalProperties, properties, items } = schema;\n const { includeReadOnly, includeWriteOnly } = opts;\n\n if (example !== undefined) {\n // Schema-level examples are explicit authored data, so they should win before we try to merge\n // polymorphic schemas. Merged allOf schemas can retain a `$ref` alongside sibling metadata,\n // which would otherwise be dereferenced as a plain ref and drop this example.\n return dereferenceRefDeep(example, opts.definition, seenRefs);\n }\n\n const hasPolymorphism = usesPolymorphism(schema);\n if (hasPolymorphism === 'allOf') {\n try {\n const definition = opts.definition;\n const resolvedAllOf = schema.allOf.map((subSchema: SchemaObject) => {\n let sub = objectify(subSchema);\n if (definition && isRef(sub)) {\n // We need to dereference `$ref` pointers before mmerging our schemas together because\n // `json-schema-merge-allof` does not support `$ref` resolutions.\n const resolved = dereferenceRef(sub, definition, new Set<string>());\n if (resolved && !isRef(resolved)) {\n sub = resolved as SchemaObject;\n }\n }\n\n return sub;\n });\n\n return sampleFromSchema(\n mergeJSONSchemaAllOf(\n { ...schema, allOf: resolvedAllOf },\n {\n resolvers: {\n // Ignore any unrecognized OAS-specific keywords that might be present on the schema\n // (like `xml`).\n defaultResolver: mergeJSONSchemaAllOf.options.resolvers.title,\n },\n },\n ),\n {\n ...opts,\n seenRefs,\n },\n );\n } catch {\n return;\n }\n } else if (hasPolymorphism) {\n const samples = (schema[hasPolymorphism] as SchemaObject[]).map(s => {\n return sampleFromSchema(s, { ...opts, seenRefs });\n });\n\n if (samples.length === 1) {\n return samples[0];\n } else if (samples.some(s => s === null)) {\n // If one of our samples is null then we should try to surface the first non-null one.\n return samples.find(s => s !== null);\n }\n\n // If we still don't have a sample then we should just return whatever the first sample we've\n // got is. The sample might not be a _full_ example but it should be enough to act as a sample.\n return samples[0];\n }\n\n if (!type) {\n if (properties || additionalProperties) {\n type = 'object';\n } else if (items) {\n type = 'array';\n } else {\n return;\n }\n }\n\n if (type === 'object' || (Array.isArray(type) && type.includes('object'))) {\n const props = objectify(properties);\n const obj: Record<string, any> = {};\n for (const name in props) {\n if (props?.[name].deprecated) {\n continue;\n }\n\n if (props?.[name].readOnly && !includeReadOnly) {\n continue;\n }\n\n if (props?.[name].writeOnly && !includeWriteOnly) {\n continue;\n }\n\n if (props[name].examples?.length) {\n obj[name] = props[name].examples[0];\n continue;\n }\n\n obj[name] = sampleFromSchema(props[name], { ...opts, seenRefs });\n }\n\n if (additionalProperties === true) {\n obj.additionalProp = {};\n } else if (additionalProperties) {\n const additionalProps = objectify(additionalProperties);\n const additionalPropVal = sampleFromSchema(additionalProps, { ...opts, seenRefs });\n\n obj.additionalProp = additionalPropVal;\n }\n\n return obj;\n }\n\n if (type === 'array' || (Array.isArray(type) && type.includes('array'))) {\n // `items` should always be present on arrays, but if it isn't we should at least do our best\n // to support its absence.\n if (typeof items === 'undefined') {\n return [];\n }\n\n if (Array.isArray(items.anyOf)) {\n return items.anyOf.map((i: SchemaObject) =>\n sampleFromSchema(i, {\n ...opts,\n seenRefs,\n }),\n );\n }\n\n if (Array.isArray(items.oneOf)) {\n return items.oneOf.map((i: SchemaObject) =>\n sampleFromSchema(i, {\n ...opts,\n seenRefs,\n }),\n );\n }\n\n return [sampleFromSchema(items, { ...opts, seenRefs })];\n }\n\n if (schema.enum) {\n if (schema.default) {\n return schema.default;\n }\n\n return normalizeArray(schema.enum as string[])[0];\n }\n\n if (type === 'file') {\n return;\n }\n\n return primitive(schema);\n}\n","/**\n * Portions of this file have been extracted and modified from Swagger UI.\n *\n * @license Apache-2.0\n * @see {@link https://github.com/swagger-api/swagger-ui/blob/master/src/core/utils.js}\n */\nimport type { SchemaObject } from '../types.js';\n\nimport { isObject } from '../lib/helpers.js';\n\nexport function usesPolymorphism(schema: SchemaObject): 'allOf' | 'anyOf' | 'oneOf' | false {\n if (schema.oneOf) {\n return 'oneOf';\n } else if (schema.anyOf) {\n return 'anyOf';\n } else if (schema.allOf) {\n return 'allOf';\n }\n\n return false;\n}\n\nexport function objectify(thing: Record<string, unknown> | unknown): Record<string, any> {\n if (!isObject(thing)) {\n return {};\n }\n\n return thing;\n}\n\nexport function normalizeArray(arr: (number | string)[] | number | string): (number | string)[] {\n if (Array.isArray(arr)) {\n return arr;\n }\n\n return [arr];\n}\n\n// oxlint-disable-next-line typescript/no-unsafe-function-type -- This is part of a type guard.\nexport function isFunc(thing: unknown): thing is Function {\n return typeof thing === 'function';\n}\n","import type { MediaTypeObject, OASDocument } from '../../types.js';\n\nimport matchesMimeType from '../../lib/matches-mimetype.js';\nimport { collectRefsInSchema, dereferenceRef, dereferenceRefDeep } from '../../lib/refs.js';\nimport sampleFromSchema from '../../samples/index.js';\nimport { isRef } from '../../types.js';\n\nexport interface MediaTypeExample {\n description?: string;\n summary?: string;\n title?: string;\n value: unknown;\n}\n\n/**\n * Extracts a collection of examples from an OpenAPI Media Type Object. The example will either\n * come from the `example` property, the first item in an `examples` array, or if none of those are\n * present it will generate an example based off its schema.\n *\n * @see {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#media-type-object}\n * @see {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#media-type-object}\n * @param mediaType The media type that we're looking for examples for.\n * @param mediaTypeObject The media type object that we're looking for examples for.\n */\nexport function getMediaTypeExamples(\n mediaType: string,\n mediaTypeObject: MediaTypeObject,\n definition: OASDocument,\n opts: {\n /**\n * If you wish to include data that's flagged as `readOnly`.\n */\n includeReadOnly?: boolean;\n\n /**\n * If you wish to include data that's flatted as `writeOnly`.\n */\n includeWriteOnly?: boolean;\n } = {},\n): MediaTypeExample[] {\n if (mediaTypeObject.example) {\n mediaTypeObject.example = dereferenceRefDeep(mediaTypeObject.example, definition);\n\n // If there is no example or if it contains any `$ref` pointers that we couldn't resolve then\n // we shouldn't return anything because to the user it'll look like we generated an invalid\n // example.\n if (mediaTypeObject.example === undefined || collectRefsInSchema(mediaTypeObject.example).size > 0) {\n return [];\n }\n\n return [\n {\n value: mediaTypeObject.example,\n },\n ];\n } else if (mediaTypeObject.examples) {\n const { examples } = mediaTypeObject;\n const multipleExamples = Object.keys(examples)\n .map(key => {\n let summary: string | undefined = key;\n let description: string | undefined;\n\n let example = examples[key];\n if (example !== null && typeof example === 'object') {\n if (isRef(example)) {\n example = dereferenceRef(example, definition);\n if (!example || isRef(example)) {\n return false;\n }\n }\n\n if ('summary' in example) {\n summary = example.summary;\n }\n\n if ('description' in example) {\n description = example.description;\n }\n\n if ('value' in example) {\n example.value = dereferenceRefDeep(example.value, definition);\n\n // If there is no example value or if it contains any `$ref` pointers that we couldn't\n // resolve then we shouldn't return anything because to the user it'll look like we\n // generated an invalid example.\n if (example.value === undefined || collectRefsInSchema(example.value).size > 0) {\n return false;\n }\n\n example = example.value;\n }\n }\n\n const ret: MediaTypeExample = { summary, title: key, value: example };\n if (description) {\n ret.description = description;\n }\n\n return ret;\n })\n .filter((item): item is MediaTypeExample => item !== false);\n\n // If we were able to grab examples from the `examples` property return them (`examples` can\n // sometimes be an empty object), otherwise we should try to generate some instead.\n if (multipleExamples.length) {\n return multipleExamples;\n }\n }\n\n if (mediaTypeObject.schema) {\n // We do not fully support XML so we shouldn't generate XML samples for XML schemas.\n if (!matchesMimeType.xml(mediaType)) {\n return [\n {\n value: sampleFromSchema(structuredClone(mediaTypeObject.schema), {\n ...opts,\n definition,\n }),\n },\n ];\n }\n }\n\n return [];\n}\n","import type { OASDocument, OperationObject } from '../../types.js';\nimport type { MediaTypeExample } from './get-mediatype-examples.js';\n\nimport { dereferenceRef } from '../../lib/refs.js';\nimport { isRef } from '../../types.js';\n\nimport { getMediaTypeExamples } from './get-mediatype-examples.js';\n\nexport interface ResponseExample {\n mediaTypes: Record<string, MediaTypeExample[]>;\n onlyHeaders?: boolean;\n status: string;\n}\n\n/**\n * Retrieve a collection of response examples keyed, by their media type.\n *\n * @param operation Operation to retrieve response examples for.\n */\nexport function getResponseExamples(operation: OperationObject, definition: OASDocument): ResponseExample[] {\n return Object.keys(operation.responses || {})\n .map(status => {\n let response = operation.responses?.[status];\n let onlyHeaders = false;\n\n if (!response) return false;\n if (isRef(response)) {\n response = dereferenceRef(response, definition);\n if (!response || isRef(response)) return false;\n }\n\n const mediaTypes: Record<string, MediaTypeExample[]> = {};\n (response?.content ? Object.keys(response.content) : []).forEach(mediaType => {\n if (!mediaType) return;\n\n const mediaTypeObject = response.content?.[mediaType];\n if (!mediaTypeObject) return;\n\n const examples = getMediaTypeExamples(mediaType, mediaTypeObject, definition, {\n includeReadOnly: true,\n includeWriteOnly: false,\n });\n\n if (examples) {\n mediaTypes[mediaType] = examples;\n }\n });\n\n // If the response has no content, but has headers, hardcode an empty example so the headers\n // modal will still display\n if (response.headers && Object.keys(response.headers).length && !Object.keys(mediaTypes).length) {\n mediaTypes['*/*'] = [];\n onlyHeaders = true;\n }\n\n if (!Object.keys(mediaTypes).length) {\n return false;\n }\n\n return {\n status,\n mediaTypes,\n ...(onlyHeaders ? { onlyHeaders } : {}),\n };\n })\n .filter((item): item is ResponseExample => item !== false);\n}\n","import type { OASDocument, OperationObject } from '../../types.js';\nimport type { ResponseExample } from './get-response-examples.js';\n\nimport { dereferenceRef } from '../../lib/refs.js';\nimport { isRef } from '../../types.js';\n\nimport { getResponseExamples } from './get-response-examples.js';\n\nexport interface CallbackExample {\n example: ResponseExample[];\n expression: string;\n identifier: string;\n method: string;\n}\n\n/**\n * With an OpenAPI Operation Object return back a collection of examples for any callbacks that may\n * be present.\n *\n * @param operation Operation to retrieve callback examples from.\n */\nexport function getCallbackExamples(operation: OperationObject, definition: OASDocument): CallbackExample[] {\n if (!operation.callbacks) {\n return [];\n }\n\n const examples = Object.keys(operation.callbacks).map(identifier => {\n let callback = operation.callbacks?.[identifier];\n if (!callback) return [];\n if (isRef(callback)) {\n callback = dereferenceRef(callback, definition);\n if (!callback || isRef(callback)) return [];\n }\n\n const items = Object.keys(callback).map(expression => {\n let callbackPath = callback[expression];\n if (!callbackPath) return [];\n if (isRef(callbackPath)) {\n callbackPath = dereferenceRef(callbackPath, definition);\n if (!callbackPath || isRef(callbackPath)) return [];\n }\n\n return Object.keys(callbackPath).map(method => {\n if (['servers', 'parameters', 'summary', 'description'].includes(method)) {\n return false;\n }\n\n // This is a `PathItemObject` but `PathItemObject` extends `OperationObject` so this is\n // fine to force cast.\n const pathItem = callbackPath as Record<string, OperationObject>;\n const example = getResponseExamples(pathItem[method], definition);\n if (!example.length) return false;\n\n return {\n identifier,\n expression,\n method,\n example,\n };\n });\n });\n\n return items.flat().filter(item => item !== false);\n });\n\n return examples.flat();\n}\n","import type { Extensions } from '../../extensions.js';\nimport type { DataForHAR } from '../../types.js';\nimport type { Operation } from '../index.js';\nimport type { MediaTypeExample } from './get-mediatype-examples.js';\n\nimport { getExtension } from '../../extensions.js';\nimport { dereferenceRef } from '../../lib/refs.js';\ni