oas 28.2.0 → 28.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (57) hide show
  1. package/dist/analyzer/index.cjs +7 -7
  2. package/dist/analyzer/index.js +5 -5
  3. package/dist/chunk-47ELBTA5.js +32 -0
  4. package/dist/chunk-47ELBTA5.js.map +1 -0
  5. package/dist/{chunk-N37BGVKV.cjs → chunk-6JSHPV2O.cjs} +1 -1
  6. package/dist/chunk-6JSHPV2O.cjs.map +1 -0
  7. package/dist/{chunk-WCXAO744.cjs → chunk-DUQ3BL5H.cjs} +19 -19
  8. package/dist/{chunk-WCXAO744.cjs.map → chunk-DUQ3BL5H.cjs.map} +1 -1
  9. package/dist/{chunk-J5RLIWSD.js → chunk-FISLBMFJ.js} +4 -4
  10. package/dist/{chunk-FHMF4CEN.js → chunk-NBQXNFZT.js} +1 -1
  11. package/dist/chunk-NBQXNFZT.js.map +1 -0
  12. package/dist/{chunk-5H5ODYVE.cjs → chunk-R33HRXQA.cjs} +29 -29
  13. package/dist/{chunk-5H5ODYVE.cjs.map → chunk-R33HRXQA.cjs.map} +1 -1
  14. package/dist/{chunk-ATLAOOV5.js → chunk-SVQE2R3T.js} +5 -5
  15. package/dist/{chunk-ATLAOOV5.js.map → chunk-SVQE2R3T.js.map} +1 -1
  16. package/dist/{chunk-FBOFXOMD.js → chunk-TRLQJSYU.js} +4 -4
  17. package/dist/chunk-UZVIB6QV.cjs +32 -0
  18. package/dist/chunk-UZVIB6QV.cjs.map +1 -0
  19. package/dist/{chunk-YKTDUFLY.cjs → chunk-ZGCROLGH.cjs} +13 -13
  20. package/dist/chunk-ZGCROLGH.cjs.map +1 -0
  21. package/dist/{extensions-CJIHlfU6.d.ts → extensions-DAFceEIL.d.ts} +14 -1
  22. package/dist/{extensions-HnzLmmuw.d.cts → extensions-DlGC1TJ1.d.cts} +14 -1
  23. package/dist/extensions.cjs +2 -2
  24. package/dist/extensions.d.cts +1 -1
  25. package/dist/extensions.d.ts +1 -1
  26. package/dist/extensions.js +1 -1
  27. package/dist/index.cjs +6 -6
  28. package/dist/index.d.cts +1 -1
  29. package/dist/index.d.ts +1 -1
  30. package/dist/index.js +5 -5
  31. package/dist/operation/index.cjs +5 -5
  32. package/dist/operation/index.d.cts +1 -1
  33. package/dist/operation/index.d.ts +1 -1
  34. package/dist/operation/index.js +4 -4
  35. package/dist/operation/lib/get-parameters-as-json-schema.cjs +4 -4
  36. package/dist/operation/lib/get-parameters-as-json-schema.d.cts +1 -1
  37. package/dist/operation/lib/get-parameters-as-json-schema.d.ts +1 -1
  38. package/dist/operation/lib/get-parameters-as-json-schema.js +3 -3
  39. package/dist/types.cjs +10 -2
  40. package/dist/types.cjs.map +1 -1
  41. package/dist/types.d.cts +24 -2
  42. package/dist/types.d.ts +24 -2
  43. package/dist/types.js +11 -3
  44. package/dist/utils.cjs +4 -4
  45. package/dist/utils.d.cts +1 -1
  46. package/dist/utils.d.ts +1 -1
  47. package/dist/utils.js +3 -3
  48. package/package.json +4 -4
  49. package/dist/chunk-EQEXNJJE.cjs +0 -17
  50. package/dist/chunk-EQEXNJJE.cjs.map +0 -1
  51. package/dist/chunk-FHMF4CEN.js.map +0 -1
  52. package/dist/chunk-N37BGVKV.cjs.map +0 -1
  53. package/dist/chunk-UCEHCARG.js +0 -17
  54. package/dist/chunk-UCEHCARG.js.map +0 -1
  55. package/dist/chunk-YKTDUFLY.cjs.map +0 -1
  56. /package/dist/{chunk-J5RLIWSD.js.map → chunk-FISLBMFJ.js.map} +0 -0
  57. /package/dist/{chunk-FBOFXOMD.js.map → chunk-TRLQJSYU.js.map} +0 -0
@@ -1 +1 @@
1
- {"version":3,"sources":["/Users/erunion/code/readme/oas/packages/oas/dist/chunk-5H5ODYVE.cjs","../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/get-response-as-json-schema.ts","../src/operation/lib/operationId.ts","../src/operation/index.ts"],"names":[],"mappings":"AAAA;AACE;AACA;AACF,wDAA6B;AAC7B;AACE;AACA;AACA;AACA;AACA;AACA;AACA;AACF,wDAA6B;AAC7B;AACE;AACF,wDAA6B;AAC7B;AACE;AACF,wDAA6B;AAC7B;AACA;ACTO,SAAS,sBAAA,CACd,UAAA,EACA,gBAAA,EACmB;AACnB,EAAA,OAAO,gBAAA,CAAiB,MAAA,CAAO,CAAC,KAAA,EAAA,GAA2B;AACzD,IAAA,OAAO,CAAC,UAAA,CAAW,IAAA,CAAK,CAAC,MAAA,EAAA,GAA4B;AACnD,MAAA,GAAA,CAAI,KAAA,CAAM,KAAA,GAAQ,MAAA,CAAO,IAAA,EAAM;AAC7B,QAAA,OAAO,KAAA,CAAM,KAAA,IAAS,MAAA,CAAO,KAAA,GAAQ,KAAA,CAAM,GAAA,IAAO,MAAA,CAAO,EAAA;AAAA,MAC3D,EAAA,KAAA,GAAA,CAAW,qCAAA,KAAW,EAAA,GAAK,qCAAA,MAAY,CAAA,EAAG;AACxC,QAAA,OAAO,KAAA,CAAM,KAAA,IAAS,MAAA,CAAO,IAAA;AAAA,MAC/B;AAEA,MAAA,OAAO,KAAA;AAAA,IACT,CAAC,CAAA;AAAA,EACH,CAAC,CAAA;AACH;ADOA;AACA;AE1BA,2IAAiC;AACjC,wFAAoB;AF4BpB;AACA;AG5BO,SAAS,gBAAA,CAAiB,MAAA,EAA2D;AAC1F,EAAA,GAAA,CAAI,MAAA,CAAO,KAAA,EAAO;AAChB,IAAA,OAAO,OAAA;AAAA,EACT,EAAA,KAAA,GAAA,CAAW,MAAA,CAAO,KAAA,EAAO;AACvB,IAAA,OAAO,OAAA;AAAA,EACT,EAAA,KAAA,GAAA,CAAW,MAAA,CAAO,KAAA,EAAO;AACvB,IAAA,OAAO,OAAA;AAAA,EACT;A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AA;AAClB,IAAA;AAEO,IAAA;AACT,EAAA;AACF;AXsVyB;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-5H5ODYVE.cjs","sourcesContent":[null,"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 { SchemaObject } from '../types.js';\n\nimport mergeJSONSchemaAllOf from 'json-schema-merge-allof';\nimport memoize from 'memoizee';\n\nimport { deeplyStripKey, 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 */\nfunction sampleFromSchema(\n schema: SchemaObject,\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): Record<string, unknown> | unknown[] | boolean | number | string | null | undefined {\n const objectifySchema = objectify(schema);\n let { type } = objectifySchema;\n\n const hasPolymorphism = usesPolymorphism(objectifySchema);\n if (hasPolymorphism === 'allOf') {\n try {\n return sampleFromSchema(\n mergeJSONSchemaAllOf(objectifySchema, {\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 opts,\n );\n } catch {\n return undefined;\n }\n } else if (hasPolymorphism) {\n const samples = (objectifySchema[hasPolymorphism] as SchemaObject[]).map(s => {\n return sampleFromSchema(s, opts);\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 const { example, additionalProperties, properties, items } = objectifySchema;\n const { includeReadOnly, includeWriteOnly } = opts;\n\n if (example !== undefined) {\n return deeplyStripKey(example, '$$ref', (val: string) => {\n // do a couple of quick sanity tests to ensure the value\n // looks like a $$ref that swagger-client generates.\n return typeof val === 'string' && val.indexOf('#') > -1;\n });\n }\n\n if (!type) {\n if (properties || additionalProperties) {\n type = 'object';\n } else if (items) {\n type = 'array';\n } else {\n return undefined;\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);\n }\n\n if (additionalProperties === true) {\n obj.additionalProp = {};\n } else if (additionalProperties) {\n const additionalProps = objectify(additionalProperties);\n const additionalPropVal = sampleFromSchema(additionalProps, opts);\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) => sampleFromSchema(i, opts));\n }\n\n if (Array.isArray(items.oneOf)) {\n return items.oneOf.map((i: SchemaObject) => sampleFromSchema(i, opts));\n }\n\n return [sampleFromSchema(items, opts)];\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 undefined;\n }\n\n return primitive(schema);\n}\n\nconst memo: typeof sampleFromSchema = memoize(sampleFromSchema);\n\n// biome-ignore lint/style/noDefaultExport: This is safe for now.\nexport default memo;\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// biome-ignore lint/complexity/noBannedTypes: This is part of a type guard.\nexport function isFunc(thing: unknown): thing is Function {\n return typeof thing === 'function';\n}\n\n// Deeply strips a specific key from an object.\n//\n// `predicate` can be used to discriminate the stripping further,\n// by preserving the key's place in the object based on its value.\n// @todo make this have a better type than `any`\nexport function deeplyStripKey(\n input: unknown,\n keyToStrip: string,\n predicate = (obj: unknown, key?: string): boolean => true,\n): SchemaObject | any {\n if (typeof input !== 'object' || Array.isArray(input) || input === null || !keyToStrip) {\n return input;\n }\n\n const obj = { ...input } as Record<string, SchemaObject>;\n\n Object.keys(obj).forEach(k => {\n if (k === keyToStrip && predicate(obj[k], k)) {\n delete obj[k];\n return;\n }\n\n obj[k] = deeplyStripKey(obj[k], keyToStrip, predicate);\n });\n\n return obj;\n}\n","import type { MediaTypeObject } from '../../types.js';\n\nimport matchesMimeType from '../../lib/matches-mimetype.js';\nimport sampleFromSchema from '../../samples/index.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 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 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 = key;\n let description: string;\n\n let example = examples[key];\n if (example !== null && typeof example === 'object') {\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 // If we have a $ref here then it's a circular reference and we should ignore it.\n if (example.value !== null && typeof example.value === 'object' && '$ref' in example.value) {\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(Boolean) as MediaTypeExample[];\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(JSON.parse(JSON.stringify(mediaTypeObject.schema)), opts),\n },\n ];\n }\n }\n\n return [];\n}\n","import type { OperationObject } from '../../types.js';\nimport type { MediaTypeExample } from './get-mediatype-examples.js';\n\nimport { isRef } from '../../types.js';\nimport { getMediaTypeExamples } from './get-mediatype-examples.js';\n\nexport type ResponseExamples = {\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) {\n return Object.keys(operation.responses || {})\n .map(status => {\n const response = operation.responses[status];\n let onlyHeaders = false;\n\n // If we have a $ref here that means that this was a circular ref so we should ignore it.\n if (isRef(response)) {\n 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 const examples = getMediaTypeExamples(mediaType, mediaTypeObject, {\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(Boolean) as ResponseExamples;\n}\n","import type { CallbackObject, OperationObject } from '../../types.js';\nimport type { ResponseExamples } from './get-response-examples.js';\n\nimport { getResponseExamples } from './get-response-examples.js';\n\nexport type CallbackExamples = {\n example: ResponseExamples;\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): CallbackExamples {\n const ret: CallbackExamples = [];\n\n // spreads the contents of the map for each callback so there's not nested arrays returned\n return ret.concat(\n ...Object.keys(operation.callbacks || {}).map(identifier => {\n const callback = operation.callbacks[identifier] as CallbackObject;\n\n // spreads the contents again so there's not nested arrays returned\n return []\n .concat(\n ...Object.keys(callback).map(expression => {\n return Object.keys(callback[expression]).map(method => {\n const pathItem = callback[expression] as Record<string, OperationObject>;\n const example = getResponseExamples(pathItem[method]);\n if (example.length === 0) return false;\n\n return {\n identifier,\n expression,\n method,\n example,\n };\n });\n }),\n )\n .filter(Boolean);\n }),\n );\n}\n","import type { OpenAPIV3 } from 'openapi-types';\nimport type { DataForHAR } from '../../types.js';\nimport type { Operation } from '../index.js';\nimport type { MediaTypeExample } from './get-mediatype-examples.js';\n\nimport { type Extensions, getExtension } from '../../extensions.js';\n\nexport type ExampleGroups = Record<\n string,\n {\n /**\n * Array of custom code samples that contain `correspondingExample` key.\n * Mutually exclusive of `request`. Note that if this object is present,\n * there may or may not be corresponding responses in the `response` object.\n */\n customCodeSamples?: (Extensions['code-samples'][number] & {\n /**\n * The index in the originally defined `code-samples` array\n */\n originalIndex: number;\n })[];\n\n /**\n * Title of example group. This is derived from the `summary` field of one of\n * the operation's example objects. The precedence is as follows (from highest to lowest):\n * 1. The first custom code sample's `name` field.\n * 2. The first request parameter (e.g., cookie/header/path/query) example object that\n * contains a `summary` field\n * 3. The request body example object's `summary` field\n * 4. The response example object's `summary` field\n *\n * @see {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#example-object}\n * @see {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#example-object}\n */\n name: string;\n\n /**\n * Object containing the example request data for the current example key.\n * Mutually exclusive of `customCodeSamples`. If `customCodeSamples` is present,\n * any request example definitions are ignored.\n */\n request?: DataForHAR;\n\n /**\n * Object containing the example response data for the current example key.\n */\n response?: {\n /**\n * The content type of the current example\n *\n * @example \"application/json\"\n * @example \"text/plain\"\n */\n mediaType: string;\n\n /**\n * The entire response example object. The example value itself is contained\n * within `value`.\n *\n * @see {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#example-object}\n * @see {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#example-object}\n */\n mediaTypeExample: MediaTypeExample;\n\n /**\n * The HTTP status code for the current response example\n *\n * @example \"2xx\"\n * @example \"400\"\n */\n status: string;\n };\n }\n>;\n\n/**\n * Internal key to represent custom code samples that do not have a corresponding response example.\n */\nconst noCorrespondingResponseKey = 'NoCorrespondingResponseForCustomCodeSample';\n\n/**\n * Takes a groups object and an operation and adds any matching response examples\n * to existing groups object\n */\nfunction addMatchingResponseExamples(groups: ExampleGroups, operation: Operation) {\n operation.getResponseExamples().forEach(example => {\n Object.entries(example.mediaTypes || {}).forEach(([mediaType, mediaTypeExamples]) => {\n mediaTypeExamples.forEach(mediaTypeExample => {\n // only add a response example if the `title` field exists\n // and it matches one of the existing example keys\n if (mediaTypeExample.title && Object.keys(groups).includes(mediaTypeExample.title)) {\n groups[mediaTypeExample.title].response = {\n mediaType,\n mediaTypeExample,\n status: example.status,\n };\n\n // if the current group doesn't already have a name set,\n // use the response example object's summary field\n if (!groups[mediaTypeExample.title].name) {\n groups[mediaTypeExample.title].name = mediaTypeExample.summary;\n }\n }\n });\n });\n });\n}\n\n/**\n * Returns a name for the given custom code sample. If there isn't already one defined,\n * we construct a fallback value based on where the sample is in the array.\n */\nfunction getDefaultName(sample: Extensions['code-samples'][number], count: Record<string, number>): string {\n return sample.name && sample.name.length > 0\n ? sample.name\n : `Default${count[sample.language] > 1 ? ` #${count[sample.language]}` : ''}`;\n}\n\n/**\n * Returns an object with groups of all example definitions (body/header/query/path/response/etc.).\n * The examples are grouped by their key when defined via the `examples` map.\n *\n * Any custom code samples defined via the `x-readme.code-samples` extension are returned,\n * regardless of if they have a matching response example.\n *\n * For standard OAS request parameter (e.g., body/header/query/path/etc.) examples,\n * they are only present in the return object if they have a corresponding response example\n * (i.e., a response example with the same key in the `examples` map).\n */\nexport function getExampleGroups(operation: Operation): ExampleGroups {\n const namelessCodeSampleCounts: Record<string, number> = {};\n const groups: ExampleGroups = {};\n\n // add custom code samples\n const codeSamples = getExtension('code-samples', operation.api, operation) as Extensions['code-samples'];\n codeSamples?.forEach((sample, i) => {\n if (namelessCodeSampleCounts[sample.language]) {\n namelessCodeSampleCounts[sample.language] += 1;\n } else {\n namelessCodeSampleCounts[sample.language] = 1;\n }\n const name = getDefaultName(sample, namelessCodeSampleCounts);\n\n // sample contains `correspondingExample` key\n if (groups[sample.correspondingExample]?.customCodeSamples?.length) {\n groups[sample.correspondingExample].customCodeSamples.push({ ...sample, name, originalIndex: i });\n } else if (sample.correspondingExample) {\n groups[sample.correspondingExample] = {\n name,\n customCodeSamples: [{ ...sample, name, originalIndex: i }],\n };\n }\n\n // sample does not contain a corresponding response example\n else if (groups[noCorrespondingResponseKey]?.customCodeSamples?.length) {\n groups[noCorrespondingResponseKey].customCodeSamples.push({ ...sample, name, originalIndex: i });\n } else {\n groups[noCorrespondingResponseKey] = {\n name,\n customCodeSamples: [{ ...sample, name, originalIndex: i }],\n };\n }\n });\n\n // if we added any custom code samples, add the corresponding response examples and return\n if (Object.keys(groups).length) {\n addMatchingResponseExamples(groups, operation);\n return groups;\n }\n\n // add request param examples\n operation.getParameters().forEach(param => {\n Object.entries(param.examples || {}).forEach(([exampleKey, paramExample]: [string, OpenAPIV3.ExampleObject]) => {\n groups[exampleKey] = {\n ...groups[exampleKey],\n name: groups[exampleKey]?.name || paramExample.summary,\n request: {\n ...groups[exampleKey]?.request,\n [param.in]: {\n ...groups[exampleKey]?.request?.[param.in],\n [param.name]: paramExample.value,\n },\n },\n };\n });\n });\n\n // add request body examples\n operation.getRequestBodyExamples().forEach(requestExample => {\n requestExample.examples.forEach((mediaTypeExample: MediaTypeExample) => {\n if (mediaTypeExample.title) {\n const mediaType = requestExample.mediaType === 'application/x-www-form-urlencoded' ? 'formData' : 'body';\n groups[mediaTypeExample.title] = {\n ...groups[mediaTypeExample.title],\n name: groups[mediaTypeExample.title]?.name || mediaTypeExample.summary,\n request: {\n ...groups[mediaTypeExample.title]?.request,\n [mediaType]: mediaTypeExample.value,\n },\n };\n }\n });\n });\n\n // if we added any request examples, add the corresponding response examples\n if (Object.keys(groups).length) {\n addMatchingResponseExamples(groups, operation);\n }\n\n // prune any objects that don't have both a request and a response\n Object.entries(groups).forEach(([groupId, group]) => {\n if (group.request && !group.response) {\n delete groups[groupId];\n }\n });\n\n return groups;\n}\n","import type { OperationObject, RequestBodyObject } from '../../types.js';\nimport type { MediaTypeExample } from './get-mediatype-examples.js';\n\nimport { getMediaTypeExamples } from './get-mediatype-examples.js';\n\nexport type RequestBodyExamples = {\n examples: MediaTypeExample[];\n mediaType: string;\n}[];\n\n/**\n * Retrieve a collection of request body examples, keyed by their media type.\n *\n * @param operation Operation to retrieve requestBody examples for.\n */\nexport function getRequestBodyExamples(operation: OperationObject): RequestBodyExamples {\n // `requestBody` will never have `$ref` pointers here so we need to work around the type that we\n // have from `OperationObject`.\n const requestBody = operation.requestBody as RequestBodyObject;\n if (!requestBody || !requestBody.content) {\n return [];\n }\n\n return Object.keys(requestBody.content || {})\n .map(mediaType => {\n const mediaTypeObject = requestBody.content[mediaType];\n const examples = getMediaTypeExamples(mediaType, mediaTypeObject, {\n includeReadOnly: false,\n includeWriteOnly: true,\n });\n\n if (!examples.length) {\n return false;\n }\n\n return {\n mediaType,\n examples,\n };\n })\n .filter(x => x !== false);\n}\n","import type {\n ComponentsObject,\n HeaderObject,\n MediaTypeObject,\n OASDocument,\n ResponseObject,\n SchemaObject,\n} from '../../types.js';\nimport type { Operation } from '../index.js';\n\nimport { cloneObject } from '../../lib/clone-object.js';\nimport { isPrimitive } from '../../lib/helpers.js';\nimport matches from '../../lib/matches-mimetype.js';\nimport { getSchemaVersionString, toJSONSchema } from '../../lib/openapi-to-json-schema.js';\n\ninterface ResponseSchemaObject {\n description?: string;\n label: string;\n schema: SchemaObject;\n type: string[] | string;\n}\n\nconst isJSON = matches.json;\n\n/**\n * Turn a header map from OpenAPI 3.0 (and some earlier versions too) into a schema.\n *\n * Note: This does not support OpenAPI 3.1's header format.\n *\n * @see {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#header-object}\n * @see {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.3.md#header-object}\n * @param response Response object to build a JSON Schema object for its headers for.\n */\nfunction buildHeadersSchema(\n response: ResponseObject,\n opts?: {\n /**\n * With a transformer you can transform any data within a given schema, like say if you want to\n * rewrite a potentially unsafe `title` that might be eventually used as a JS variable name,\n * just make sure to return your transformed schema.\n */\n transformer?: (schema: SchemaObject) => SchemaObject;\n },\n) {\n const headers = response.headers;\n\n const headersSchema: SchemaObject = {\n type: 'object',\n properties: {},\n };\n\n Object.keys(headers).forEach(key => {\n if (headers[key] && (headers[key] as HeaderObject).schema) {\n const header: HeaderObject = headers[key] as HeaderObject;\n\n // TODO: Response headers are essentially parameters in OAS\n // This means they can have content instead of schema.\n // We should probably support that in the future\n headersSchema.properties[key] = toJSONSchema(header.schema, {\n addEnumsToDescriptions: true,\n transformer: opts.transformer,\n });\n\n if (header.description) {\n (headersSchema.properties[key] as HeaderObject).description = header.description;\n }\n }\n });\n\n const headersWrapper: {\n description?: string;\n label: string;\n schema: SchemaObject;\n type: string;\n } = {\n schema: headersSchema,\n type: 'object',\n label: 'Headers',\n };\n\n if (response.description && headersWrapper.schema) {\n headersWrapper.description = response.description;\n }\n\n return headersWrapper;\n}\n\n/**\n * Extract all the response schemas, matching the format of `get-parameters-as-json-schema`.\n *\n * Note: This expects a dereferenced schema.\n *\n * @param operation Operation to construct a response JSON Schema for.\n * @param api The OpenAPI definition that this operation originates.\n * @param statusCode The response status code to generate a schema for.\n */\nexport function getResponseAsJSONSchema(\n operation: Operation,\n api: OASDocument,\n statusCode: number | string,\n opts?: {\n includeDiscriminatorMappingRefs?: boolean;\n /**\n * With a transformer you can transform any data within a given schema, like say if you want\n * to rewrite a potentially unsafe `title` that might be eventually used as a JS variable\n * name, just make sure to return your transformed schema.\n */\n transformer?: (schema: SchemaObject) => SchemaObject;\n },\n): ResponseSchemaObject[] | null {\n const response = operation.getResponseByStatusCode(statusCode);\n const jsonSchema: ResponseSchemaObject[] = [];\n\n if (!response) {\n return null;\n }\n\n let hasCircularRefs = false;\n let hasDiscriminatorMappingRefs = false;\n\n function refLogger(ref: string, type: 'discriminator' | 'ref') {\n if (type === 'ref') {\n hasCircularRefs = true;\n } else {\n hasDiscriminatorMappingRefs = true;\n }\n }\n\n /**\n * @param content An array of `MediaTypeObject`'s to retrieve a preferred schema out of. We\n * prefer JSON media types.\n */\n function getPreferredSchema(content: Record<string, MediaTypeObject>) {\n if (!content) {\n return null;\n }\n\n const contentTypes = Object.keys(content);\n if (!contentTypes.length) {\n return null;\n }\n\n for (let i = 0; i < contentTypes.length; i++) {\n if (isJSON(contentTypes[i])) {\n return toJSONSchema(cloneObject(content[contentTypes[i]].schema), {\n addEnumsToDescriptions: true,\n refLogger,\n transformer: opts.transformer,\n });\n }\n }\n\n // We always want to prefer the JSON-compatible content types over everything else but if we\n // haven't found one we should default to the first available.\n const contentType = contentTypes.shift();\n return toJSONSchema(cloneObject(content[contentType].schema), {\n addEnumsToDescriptions: true,\n refLogger,\n transformer: opts.transformer,\n });\n }\n\n const foundSchema = getPreferredSchema((response as ResponseObject).content);\n if (foundSchema) {\n const schema = cloneObject(foundSchema);\n const schemaWrapper: {\n description?: string;\n label: string;\n schema: SchemaObject;\n type: string[] | string;\n } = {\n // If there's no `type` then the root schema is a circular `$ref` that we likely won't be\n // able to render so instead of generating a JSON Schema with an `undefined` type we should\n // default to `string` so there's at least *something* the end-user can interact with.\n type: foundSchema.type || 'string',\n schema: isPrimitive(schema)\n ? schema\n : {\n ...schema,\n $schema: getSchemaVersionString(schema, api),\n },\n label: 'Response body',\n };\n\n if ((response as ResponseObject).description && schemaWrapper.schema) {\n schemaWrapper.description = (response as ResponseObject).description;\n }\n\n /**\n * Since this library assumes that the schema has already been dereferenced, adding every\n * component here that **isn't** circular adds a ton of bloat so it'd be cool if `components`\n * was just the remaining `$ref` pointers that are still being referenced.\n *\n * @todo\n */\n if (api.components && schemaWrapper.schema) {\n // We should only include components if we've got circular refs or we have discriminator\n // mapping refs (we want to include them).\n if (hasCircularRefs || (hasDiscriminatorMappingRefs && opts.includeDiscriminatorMappingRefs)) {\n ((schemaWrapper.schema as SchemaObject).components as ComponentsObject) = api.components as ComponentsObject;\n }\n }\n\n jsonSchema.push(schemaWrapper);\n }\n\n // 3.0.3 and earlier headers. TODO: New format for 3.1.0\n if ((response as ResponseObject).headers) {\n jsonSchema.push(buildHeadersSchema(response as ResponseObject, opts));\n }\n\n return jsonSchema.length ? jsonSchema : null;\n}\n","import type { OperationObject } from '../../types.ts';\n\nexport interface OperationIDGeneratorOptions {\n /**\n * Generate a JS method-friendly operation ID when one isn't present.\n *\n * For backwards compatiblity reasons this option will be indefinitely supported however we\n * recommend using `friendlyCase` instead as it's a heavily improved version of this option.\n *\n * @see {friendlyCase}\n * @deprecated\n */\n camelCase?: boolean;\n\n /**\n * Generate a human-friendly, but still camelCase, operation ID when one isn't present. The\n * difference between this and `camelCase` is that this also ensure that consecutive words are\n * not present in the resulting ID. For example, for the endpoint `/candidate/{candidate}` will\n * return `getCandidateCandidate` for `camelCase` however `friendlyCase` will return\n * `getCandidate`.\n *\n * The reason this friendliness is just not a part of the `camelCase` option is because we have\n * a number of consumers of the old operation ID style and making that change there would a\n * breaking change that we don't have any easy way to resolve.\n */\n friendlyCase?: boolean;\n}\n\n/**\n * Determine if an operation has an `operationId` present in its schema. Note that if one is\n * present in the schema but is an empty string then this will return false.\n *\n */\nexport function hasOperationId(operation: OperationObject): boolean {\n return Boolean('operationId' in operation && operation.operationId.length);\n}\n\n/**\n * Get an `operationId` for an operation. If one is not present (it's not required by the spec!)\n * a hash of the path and method will be returned instead.\n *\n */\nexport function getOperationId(\n path: string,\n method: string,\n operation: OperationObject,\n opts: OperationIDGeneratorOptions = {},\n): string {\n function sanitize(id: string) {\n // We aren't sanitizing underscores here by default in order to preserve operation IDs that\n // were already generated with this method in the past.\n return id\n .replace(opts?.camelCase || opts?.friendlyCase ? /[^a-zA-Z0-9_]/g : /[^a-zA-Z0-9]/g, '-') // Remove weird characters\n .replace(/--+/g, '-') // Remove double --'s\n .replace(/^-|-$/g, ''); // Don't start or end with -\n }\n\n const operationIdExists = hasOperationId(operation);\n let operationId: string;\n if (operationIdExists) {\n operationId = operation.operationId;\n } else {\n operationId = sanitize(path).toLowerCase();\n }\n\n const currMethod = method.toLowerCase();\n if (opts?.camelCase || opts?.friendlyCase) {\n if (opts?.friendlyCase) {\n // In order to generate friendlier operation IDs we should swap out underscores with spaces\n // so the end result will be _slightly_ more camelCase.\n operationId = operationId.replaceAll('_', ' ');\n\n if (!operationIdExists) {\n // In another effort to generate friendly operation IDs we should prevent words from\n // appearing in consecutive order (eg. `/candidate/{candidate}` should generate\n // `getCandidate` not `getCandidateCandidate`). However we only want to do this if we're\n // generating the operation ID as if they intentionally added a consecutive word into the\n // operation ID then we should respect that.\n operationId = operationId\n .replace(/[^a-zA-Z0-9_]+(.)/g, (_, chr) => ` ${chr}`)\n .split(' ')\n .filter((word, i, arr) => word !== arr[i - 1])\n .join(' ');\n }\n }\n\n operationId = operationId.replace(/[^a-zA-Z0-9_]+(.)/g, (_, chr) => chr.toUpperCase());\n if (operationIdExists) {\n operationId = sanitize(operationId);\n }\n\n // Never start with a number.\n operationId = operationId.replace(/^[0-9]/g, match => `_${match}`);\n\n // Ensure that the first character of an `operationId` is always lowercase.\n operationId = operationId.charAt(0).toLowerCase() + operationId.slice(1);\n\n // If the generated `operationId` already starts with the method (eg. `getPets`) we don't want\n // to double it up into `getGetPets`.\n if (operationId.startsWith(currMethod)) {\n return operationId;\n }\n\n // If this operation already has an `operationId` and we just cleaned it up then we shouldn't\n // prefix it with an HTTP method.\n if (operationIdExists) {\n return operationId;\n }\n\n // Because we're merging the `operationId` into an HTTP method we need to reset the first\n // character of it back to lowercase so we end up with `getBuster`, not `getbuster`.\n operationId = operationId.charAt(0).toUpperCase() + operationId.slice(1);\n return `${currMethod}${operationId}`;\n } else if (operationIdExists) {\n return operationId;\n }\n\n return `${currMethod}_${operationId}`;\n}\n","import type { OpenAPIV3, OpenAPIV3_1 } from 'openapi-types';\nimport type { Extensions } from '../extensions.js';\nimport type {\n CallbackObject,\n HttpMethods,\n KeyedSecuritySchemeObject,\n MediaTypeObject,\n OAS31Document,\n OASDocument,\n OperationObject,\n ParameterObject,\n PathItemObject,\n RequestBodyObject,\n ResponseObject,\n SchemaObject,\n SecurityRequirementObject,\n SecurityType,\n TagObject,\n} from '../types.js';\nimport type { CallbackExamples } from './lib/get-callback-examples.js';\nimport type { getParametersAsJSONSchemaOptions, SchemaWrapper } from './lib/get-parameters-as-json-schema.js';\nimport type { RequestBodyExamples } from './lib/get-requestbody-examples.js';\nimport type { ResponseExamples } from './lib/get-response-examples.js';\nimport type { OperationIDGeneratorOptions } from './lib/operationId.js';\n\nimport findSchemaDefinition from '../lib/find-schema-definition.js';\nimport matchesMimeType from '../lib/matches-mimetype.js';\nimport { isRef } from '../types.js';\nimport { supportedMethods } from '../utils.js';\nimport { dedupeCommonParameters } from './lib/dedupe-common-parameters.js';\nimport { getCallbackExamples } from './lib/get-callback-examples.js';\nimport { type ExampleGroups, getExampleGroups } from './lib/get-example-groups.js';\nimport { getParametersAsJSONSchema } from './lib/get-parameters-as-json-schema.js';\nimport { getRequestBodyExamples } from './lib/get-requestbody-examples.js';\nimport { getResponseAsJSONSchema } from './lib/get-response-as-json-schema.js';\nimport { getResponseExamples } from './lib/get-response-examples.js';\nimport { getOperationId, hasOperationId } from './lib/operationId.js';\n\nexport class Operation {\n /**\n * Schema of the operation from the API Definition.\n */\n schema: OperationObject;\n\n /**\n * OpenAPI API Definition that this operation originated from.\n */\n api: OASDocument;\n\n /**\n * Path that this operation is targeted towards.\n */\n path: string;\n\n /**\n * HTTP Method that this operation is targeted towards.\n */\n method: HttpMethods;\n\n /**\n * The primary Content Type that this operation accepts.\n */\n contentType: string;\n\n /**\n * An object with groups of all example definitions (body/header/query/path/response/etc.)\n */\n exampleGroups: ExampleGroups;\n\n /**\n * Request body examples for this operation.\n */\n requestBodyExamples: RequestBodyExamples;\n\n /**\n * Response examples for this operation.\n */\n responseExamples: ResponseExamples;\n\n /**\n * Callback examples for this operation (if it has callbacks).\n */\n callbackExamples: CallbackExamples;\n\n /**\n * Flattened out arrays of both request and response headers that are utilized on this operation.\n */\n headers: {\n request: string[];\n response: string[];\n };\n\n constructor(api: OASDocument, path: string, method: HttpMethods, operation: OperationObject) {\n this.schema = operation;\n this.api = api;\n this.path = path;\n this.method = method;\n\n this.contentType = undefined;\n this.requestBodyExamples = undefined;\n this.responseExamples = undefined;\n this.callbackExamples = undefined;\n this.exampleGroups = undefined;\n this.headers = {\n request: [],\n response: [],\n };\n }\n\n getSummary(): string {\n if (this.schema?.summary && typeof this.schema.summary === 'string') {\n return this.schema.summary;\n } else if (this.api.paths[this.path].summary && typeof this.api.paths[this.path].summary === 'string') {\n return this.api.paths[this.path].summary;\n }\n\n return undefined;\n }\n\n getDescription(): string {\n if (this.schema?.description && typeof this.schema.description === 'string') {\n return this.schema.description;\n } else if (this.api.paths[this.path].description && typeof this.api.paths[this.path].description === 'string') {\n return this.api.paths[this.path].description;\n }\n\n return undefined;\n }\n\n getContentType(): string {\n if (this.contentType) {\n return this.contentType;\n }\n\n let types: string[] = [];\n if (this.schema.requestBody) {\n if ('$ref' in this.schema.requestBody) {\n this.schema.requestBody = findSchemaDefinition(this.schema.requestBody.$ref, this.api);\n }\n\n if ('content' in this.schema.requestBody) {\n types = Object.keys(this.schema.requestBody.content);\n }\n }\n\n this.contentType = 'application/json';\n if (types?.length) {\n this.contentType = types[0];\n }\n\n // Favor JSON if it exists\n types.forEach(t => {\n if (matchesMimeType.json(t)) {\n this.contentType = t;\n }\n });\n\n return this.contentType;\n }\n\n isFormUrlEncoded(): boolean {\n return matchesMimeType.formUrlEncoded(this.getContentType());\n }\n\n isMultipart(): boolean {\n return matchesMimeType.multipart(this.getContentType());\n }\n\n isJson(): boolean {\n return matchesMimeType.json(this.getContentType());\n }\n\n isXml(): boolean {\n return matchesMimeType.xml(this.getContentType());\n }\n\n /**\n * Checks if the current operation is a webhook or not.\n *\n */\n isWebhook(): boolean {\n return this instanceof Webhook;\n }\n\n /**\n * Returns an array of all security requirements associated wtih this operation. If none are\n * defined at the operation level, the securities for the entire API definition are returned\n * (with an empty array as a final fallback).\n *\n */\n getSecurity(): SecurityRequirementObject[] {\n if (!this.api?.components?.securitySchemes || !Object.keys(this.api.components.securitySchemes).length) {\n return [];\n }\n\n return this.schema.security || this.api.security || [];\n }\n\n /**\n * Retrieve a collection of grouped security schemes. The inner array determines AND-grouped\n * security schemes, the outer array determines OR-groups.\n *\n * @see {@link https://swagger.io/docs/specification/authentication/#multiple}\n * @see {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#security-requirement-object}\n * @see {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#security-requirement-object}\n * @param filterInvalid Optional flag that, when set to `true`, filters out invalid/nonexistent\n * security schemes, rather than returning `false`.\n */\n getSecurityWithTypes(\n filterInvalid = false,\n ): ((false | { security: KeyedSecuritySchemeObject; type: SecurityType })[] | false)[] {\n const securityRequirements = this.getSecurity();\n\n return securityRequirements.map(requirement => {\n let keys: string[];\n try {\n keys = Object.keys(requirement);\n } catch {\n return false;\n }\n\n const keysWithTypes = keys.map(key => {\n let security: KeyedSecuritySchemeObject;\n try {\n // Remove the reference type, because we know this will be dereferenced\n security = this.api.components.securitySchemes[key] as KeyedSecuritySchemeObject;\n } catch {\n return false;\n }\n\n if (!security) return false;\n\n let type: SecurityType = null;\n\n if (security.type === 'http') {\n if (security.scheme === 'basic') type = 'Basic';\n else if (security.scheme === 'bearer') type = 'Bearer';\n else type = security.type;\n } else if (security.type === 'oauth2') {\n type = 'OAuth2';\n } else if (security.type === 'apiKey') {\n if (security.in === 'query') type = 'Query';\n else if (security.in === 'header') type = 'Header';\n else if (security.in === 'cookie') type = 'Cookie';\n else type = security.type;\n } else {\n return false;\n }\n\n return {\n type,\n security: {\n ...security,\n _key: key,\n _requirements: requirement[key],\n },\n };\n });\n\n if (filterInvalid) return keysWithTypes.filter(key => key !== false);\n\n return keysWithTypes;\n });\n }\n\n /**\n * Retrieve an object where the keys are unique scheme types, and the values are arrays\n * containing each security scheme of that type.\n *\n */\n prepareSecurity(): Record<SecurityType, KeyedSecuritySchemeObject[]> {\n const securitiesWithTypes = this.getSecurityWithTypes();\n\n return securitiesWithTypes.reduce(\n (prev, securities) => {\n if (!securities) return prev;\n\n securities.forEach(security => {\n // Remove non-existent schemes\n if (!security) return;\n if (!prev[security.type]) prev[security.type] = [];\n\n // Only add schemes we haven't seen yet.\n const exists = prev[security.type].some(sec => sec._key === security.security._key);\n if (!exists) {\n // Since an operation can require the same security scheme several times (each with different scope requirements),\n // including the `_requirements` in this object would be misleading since we dedupe the security schemes.\n if (security.security?._requirements) delete security.security._requirements;\n prev[security.type].push(security.security);\n }\n });\n\n return prev;\n },\n {} as Record<SecurityType, KeyedSecuritySchemeObject[]>,\n );\n }\n\n getHeaders(): Operation['headers'] {\n const security = this.prepareSecurity();\n if (security.Header) {\n this.headers.request = (security.Header as OpenAPIV3_1.ApiKeySecurityScheme[]).map(h => {\n return h.name;\n });\n }\n\n if (security.Bearer || security.Basic || security.OAuth2) {\n this.headers.request.push('Authorization');\n }\n\n if (security.Cookie) {\n this.headers.request.push('Cookie');\n }\n\n if (this.schema.parameters) {\n this.headers.request = this.headers.request.concat(\n // Remove the reference object because we will have already dereferenced.\n (this.schema.parameters as OpenAPIV3_1.ParameterObject[] | OpenAPIV3.ParameterObject[])\n .map(p => {\n if (p.in && p.in === 'header') return p.name;\n return undefined;\n })\n .filter(p => p),\n );\n }\n\n if (this.schema.responses) {\n this.headers.response = Object.keys(this.schema.responses)\n // Remove the reference object because we will have already dereferenced.\n .filter(r => (this.schema.responses[r] as ResponseObject).headers)\n .map(r =>\n // Remove the reference object because we will have already dereferenced.\n Object.keys((this.schema.responses[r] as ResponseObject).headers),\n )\n .reduce((a, b) => a.concat(b), []);\n }\n\n // If the operation doesn't already specify a `content-type` request header, we check if the\n // path operation request body contains content, which implies that we should also include the\n // `content-type` header.\n if (!this.headers.request.includes('Content-Type') && this.schema.requestBody) {\n if (\n (this.schema.requestBody as RequestBodyObject).content &&\n Object.keys((this.schema.requestBody as RequestBodyObject).content)\n ) {\n this.headers.request.push('Content-Type');\n }\n }\n\n // This is a similar approach, but in this case if we check the response content and prioritize\n // the `accept` request header and `content-type` request header.\n if (this.schema.responses) {\n if (\n Object.keys(this.schema.responses).some(\n response => !!(this.schema.responses[response] as ResponseObject).content,\n )\n ) {\n if (!this.headers.request.includes('Accept')) this.headers.request.push('Accept');\n if (!this.headers.response.includes('Content-Type')) this.headers.response.push('Content-Type');\n }\n }\n\n return this.headers;\n }\n\n /**\n * Determine if the operation has an `operationId` present in its schema. Note that if one is\n * present in the schema but is an empty string then this will return false.\n *\n */\n hasOperationId(): boolean {\n return hasOperationId(this.schema);\n }\n\n /**\n * Determine if an operation has an `operationId` present in its schema. Note that if one is\n * present in the schema but is an empty string then this will return false.\n *\n */\n static hasOperationId(schema: OperationObject): boolean {\n return hasOperationId(schema);\n }\n\n /**\n * Get an `operationId` for this operation. If one is not present (it's not required by the spec!)\n * a hash of the path and method will be returned instead.\n *\n */\n getOperationId(opts: OperationIDGeneratorOptions = {}): string {\n return getOperationId(this.path, this.method, this.schema, opts);\n }\n\n /**\n * Get an `operationId` for an operation. If one is not present (it's not required by the spec!)\n * a hash of the path and method will be returned instead.\n *\n */\n static getOperationId(\n path: string,\n method: string,\n schema: OperationObject,\n opts: OperationIDGeneratorOptions = {},\n ): string {\n return getOperationId(path, method, schema, opts);\n }\n\n /**\n * Return an array of all tags, and their metadata, that exist on this operation.\n *\n */\n getTags(): TagObject[] {\n if (!('tags' in this.schema)) {\n return [];\n }\n\n const oasTagMap: Map<string, TagObject> = new Map();\n if ('tags' in this.api) {\n this.api.tags.forEach((tag: TagObject) => {\n oasTagMap.set(tag.name, tag);\n });\n }\n\n const oasTags = Object.fromEntries(oasTagMap);\n\n const tags: TagObject[] = [];\n if (Array.isArray(this.schema.tags)) {\n this.schema.tags.forEach(tag => {\n if (tag in oasTags) {\n tags.push(oasTags[tag]);\n } else {\n tags.push({\n name: tag,\n });\n }\n });\n }\n\n return tags;\n }\n\n /**\n * Return is the operation is flagged as `deprecated` or not.\n *\n */\n isDeprecated(): boolean {\n return 'deprecated' in this.schema ? this.schema.deprecated : false;\n }\n\n /**\n * Determine if the operation has any (non-request body) parameters.\n *\n */\n hasParameters(): boolean {\n return !!this.getParameters().length;\n }\n\n /**\n * Return the parameters (non-request body) on the operation.\n *\n */\n getParameters(): ParameterObject[] {\n let parameters = (this.schema?.parameters || []) as ParameterObject[];\n const commonParams = (this.api?.paths?.[this.path]?.parameters || []) as ParameterObject[];\n if (commonParams.length) {\n parameters = parameters.concat(dedupeCommonParameters(parameters, commonParams) || []);\n }\n\n return parameters;\n }\n\n /**\n * Determine if this operation has any required parameters.\n *\n */\n hasRequiredParameters(): boolean {\n return this.getParameters().some(param => 'required' in param && param.required);\n }\n\n /**\n * Convert the operation into an array of JSON Schema schemas for each available type of\n * parameter available on the operation.\n *\n */\n getParametersAsJSONSchema(opts: getParametersAsJSONSchemaOptions = {}): SchemaWrapper[] {\n return getParametersAsJSONSchema(this, this.api, {\n includeDiscriminatorMappingRefs: true,\n transformer: (s: SchemaObject) => s,\n ...opts,\n });\n }\n\n /**\n * Get a single response for this status code, formatted as JSON schema.\n *\n * @param statusCode Status code to pull a JSON Schema response for.\n */\n getResponseAsJSONSchema(\n statusCode: number | string,\n opts: {\n /**\n * If you wish to include discriminator mapping `$ref` components alongside your\n * `discriminator` in schemas. Defaults to `true`.\n */\n includeDiscriminatorMappingRefs?: boolean;\n\n /**\n * With a transformer you can transform any data within a given schema, like say if you want\n * to rewrite a potentially unsafe `title` that might be eventually used as a JS variable\n * name, just make sure to return your transformed schema.\n */\n transformer?: (schema: SchemaObject) => SchemaObject;\n } = {},\n ): SchemaObject {\n return getResponseAsJSONSchema(this, this.api, statusCode, {\n includeDiscriminatorMappingRefs: true,\n transformer: (s: SchemaObject) => s,\n ...opts,\n });\n }\n\n /**\n * Get an array of all valid response status codes for this operation.\n *\n */\n getResponseStatusCodes(): string[] {\n return this.schema.responses ? Object.keys(this.schema.responses) : [];\n }\n\n /**\n * Determine if the operation has any request bodies.\n *\n */\n hasRequestBody(): boolean {\n return !!this.schema.requestBody;\n }\n\n /**\n * Retrieve the list of all available media types that the operations request body can accept.\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 */\n getRequestBodyMediaTypes(): string[] {\n if (!this.hasRequestBody()) {\n return [];\n }\n\n const requestBody = this.schema.requestBody;\n if (isRef(requestBody)) {\n // If the request body is still a `$ref` pointer we should return false because this library\n // assumes that you've run dereferencing beforehand.\n return [];\n }\n\n return Object.keys(requestBody.content);\n }\n\n /**\n * Determine if this operation has a required request body.\n *\n */\n hasRequiredRequestBody(): boolean {\n if (!this.hasRequestBody()) {\n return false;\n }\n\n const requestBody = this.schema.requestBody;\n if (isRef(requestBody)) {\n return false;\n }\n\n if (requestBody.required) {\n return true;\n }\n\n // The OpenAPI spec isn't clear on the differentiation between schema `required` and\n // `requestBody.required` because you can have required top-level schema properties but a\n // non-required requestBody that negates each other.\n //\n // To kind of work ourselves around this and present a better QOL for this accessor, if at this\n // final point where we don't have a required request body, but the underlying Media Type Object\n // schema says that it has required properties then we should ultimately recognize that this\n // request body is required -- even as the request body description says otherwise.\n return !!this.getParametersAsJSONSchema()\n .filter(js => ['body', 'formData'].includes(js.type))\n .find(js => js.schema && Array.isArray(js.schema.required) && js.schema.required.length);\n }\n\n /**\n * Retrieve a specific request body content schema off this operation.\n *\n * If no media type is supplied this will return either the first available JSON-like request\n * body, or the first available if there are no JSON-like media types present. When this return\n * comes back it's in the form of an array with the first key being the selected media type,\n * followed by the media type object in question.\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 Specific request body media type to retrieve if present.\n */\n getRequestBody(mediaType?: string): MediaTypeObject | false | [string, MediaTypeObject, ...string[]] {\n if (!this.hasRequestBody()) {\n return false;\n }\n\n const requestBody = this.schema.requestBody;\n if (isRef(requestBody)) {\n // If the request body is still a `$ref` pointer we should return false because this library\n // assumes that you've run dereferencing beforehand.\n return false;\n }\n\n if (mediaType) {\n if (!(mediaType in requestBody.content)) {\n return false;\n }\n\n return requestBody.content[mediaType];\n }\n\n // Since no media type was supplied we need to find either the first JSON-like media type that\n // we've got, or the first available of anything else if no JSON-like media types are present.\n let availableMediaType: string;\n const mediaTypes = this.getRequestBodyMediaTypes();\n mediaTypes.forEach((mt: string) => {\n if (!availableMediaType && matchesMimeType.json(mt)) {\n availableMediaType = mt;\n }\n });\n\n if (!availableMediaType) {\n mediaTypes.forEach((mt: string) => {\n if (!availableMediaType) {\n availableMediaType = mt;\n }\n });\n }\n\n if (availableMediaType) {\n return [\n availableMediaType,\n requestBody.content[availableMediaType],\n ...(requestBody.description ? [requestBody.description] : []),\n ];\n }\n\n return false;\n }\n\n /**\n * Retrieve an array of request body examples that this operation has.\n *\n */\n getRequestBodyExamples(): RequestBodyExamples {\n const isRequestExampleValueDefined = typeof this.requestBodyExamples?.[0]?.examples?.[0].value !== 'undefined';\n\n if (this.requestBodyExamples && isRequestExampleValueDefined) {\n return this.requestBodyExamples;\n }\n\n this.requestBodyExamples = getRequestBodyExamples(this.schema);\n return this.requestBodyExamples;\n }\n\n /**\n * Return a specific response out of the operation by a given HTTP status code.\n *\n * @param statusCode Status code to pull a response object for.\n */\n getResponseByStatusCode(statusCode: number | string): ResponseObject | boolean {\n if (!this.schema.responses) {\n return false;\n }\n\n if (typeof this.schema.responses[statusCode] === 'undefined') {\n return false;\n }\n\n const response = this.schema.responses[statusCode];\n\n if (isRef(response)) {\n return false;\n }\n\n // Remove the reference from the type, because it will already be dereferenced.\n return response;\n }\n\n /**\n * Retrieve an array of response examples that this operation has.\n *\n */\n getResponseExamples(): ResponseExamples {\n if (this.responseExamples) {\n return this.responseExamples;\n }\n\n // @todo Remove this `as` once we convert getResponseExamples\n this.responseExamples = getResponseExamples(this.schema) as ResponseExamples;\n return this.responseExamples;\n }\n\n /**\n * Determine if the operation has callbacks.\n *\n */\n hasCallbacks(): boolean {\n return !!this.schema.callbacks;\n }\n\n /**\n * Retrieve a specific callback.\n *\n * @see {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#callback-object}\n * @see {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#callback-object}\n * @param identifier Callback identifier to look for.\n * @param expression Callback expression to look for.\n * @param method HTTP Method on the callback to look for.\n */\n getCallback(identifier: string, expression: string, method: HttpMethods): Callback | false {\n if (!this.schema.callbacks) return false;\n\n // The usage of `as` in the below is to remove the possibility of a ref type, since we've\n // dereferenced.\n const callback = this.schema.callbacks[identifier]\n ? (((this.schema.callbacks as Record<string, CallbackObject>)[identifier] as CallbackObject)[\n expression\n ] as PathItemObject)\n : false;\n\n if (!callback || !callback[method]) return false;\n return new Callback(this.api, expression, method, callback[method], identifier, callback);\n }\n\n /**\n * Retrieve an array of operations created from each callback.\n *\n */\n getCallbacks(): (Callback | false)[] | false {\n const callbackOperations: (Callback | false)[] = [];\n if (!this.hasCallbacks()) return false;\n\n Object.keys(this.schema.callbacks).forEach(callback => {\n Object.keys(this.schema.callbacks[callback]).forEach(expression => {\n const cb = this.schema.callbacks[callback];\n\n if (!isRef(cb)) {\n const exp = cb[expression];\n\n if (!isRef(exp)) {\n Object.keys(exp).forEach((method: HttpMethods) => {\n if (!supportedMethods.includes(method)) return;\n\n callbackOperations.push(this.getCallback(callback, expression, method));\n });\n }\n }\n });\n });\n\n return callbackOperations;\n }\n\n /**\n * Retrieve an array of callback examples that this operation has.\n *\n */\n getCallbackExamples(): CallbackExamples {\n if (this.callbackExamples) {\n return this.callbackExamples;\n }\n\n this.callbackExamples = getCallbackExamples(this.schema);\n return this.callbackExamples;\n }\n\n /**\n * Determine if a given a custom specification extension exists within the operation.\n *\n * @see {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#specification-extensions}\n * @see {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#specification-extensions}\n * @param extension Specification extension to lookup.\n */\n hasExtension(extension: string): boolean {\n return Boolean(this.schema && extension in this.schema);\n }\n\n /**\n * Retrieve a custom specification extension off of the operation.\n *\n * @see {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#specification-extensions}\n * @see {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#specification-extensions}\n * @param extension Specification extension to lookup.\n *\n * @deprecated Use `oas.getExtension(extension, operation)` instead.\n */\n getExtension(extension: string | keyof Extensions): any {\n return this.schema?.[extension];\n }\n\n /**\n * Returns an object with groups of all example definitions (body/header/query/path/response/etc.).\n * The examples are grouped by their key when defined via the `examples` map.\n *\n * Any custom code samples defined via the `x-readme.code-samples` extension are returned,\n * regardless of if they have a matching response example.\n *\n * For standard OAS request parameter (e.g., body/header/query/path/etc.) examples,\n * they are only present in the return object if they have a corresponding response example\n * (i.e., a response example with the same key in the `examples` map).\n */\n getExampleGroups(): ExampleGroups {\n if (this.exampleGroups) return this.exampleGroups;\n\n const groups = getExampleGroups(this);\n\n this.exampleGroups = groups;\n\n return groups;\n }\n}\n\nexport class Callback extends Operation {\n /**\n * The identifier that this callback is set to.\n */\n identifier: string;\n\n /**\n * The parent path item object that this Callback exists within.\n */\n parentSchema: PathItemObject;\n\n constructor(\n oas: OASDocument,\n path: string,\n method: HttpMethods,\n operation: OperationObject,\n identifier: string,\n parentPathItem: PathItemObject,\n ) {\n super(oas, path, method, operation);\n\n this.identifier = identifier;\n this.parentSchema = parentPathItem;\n }\n\n /**\n * Return the primary identifier for this callback.\n *\n * @see {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#callback-object}\n * @see {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#callback-object}\n */\n getIdentifier(): string {\n return this.identifier;\n }\n\n getSummary(): string {\n if (this.schema?.summary && typeof this.schema.summary === 'string') {\n return this.schema.summary;\n } else if (this.parentSchema.summary && typeof this.parentSchema.summary === 'string') {\n return this.parentSchema.summary;\n }\n\n return undefined;\n }\n\n getDescription(): string {\n if (this.schema?.description && typeof this.schema.description === 'string') {\n return this.schema.description;\n } else if (this.parentSchema.description && typeof this.parentSchema.description === 'string') {\n return this.parentSchema.description;\n }\n\n return undefined;\n }\n\n getParameters(): ParameterObject[] {\n let parameters = (this.schema?.parameters || []) as ParameterObject[];\n const commonParams = (this.parentSchema.parameters || []) as ParameterObject[];\n if (commonParams.length) {\n parameters = parameters.concat(dedupeCommonParameters(parameters, commonParams) || []);\n }\n\n return parameters;\n }\n}\n\nexport class Webhook extends Operation {\n /**\n * OpenAPI API Definition that this webhook originated from.\n */\n declare api: OAS31Document;\n\n getSummary(): string {\n if (this.schema?.summary && typeof this.schema.summary === 'string') {\n return this.schema.summary;\n } else if (this.api.webhooks[this.path].summary && typeof this.api.webhooks[this.path].summary === 'string') {\n return this.api.webhooks[this.path].summary;\n }\n\n return undefined;\n }\n\n getDescription(): string {\n if (this.schema?.description && typeof this.schema.description === 'string') {\n return this.schema.description;\n } else if (\n this.api.webhooks[this.path].description &&\n typeof this.api.webhooks[this.path].description === 'string'\n ) {\n return this.api.webhooks[this.path].description;\n }\n\n return undefined;\n }\n}\n"]}
1
+ {"version":3,"sources":["/Users/erunion/code/readme/oas/packages/oas/dist/chunk-R33HRXQA.cjs","../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/get-response-as-json-schema.ts","../src/operation/lib/operationId.ts","../src/operation/index.ts"],"names":[],"mappings":"AAAA;AACE;AACA;AACF,wDAA6B;AAC7B;AACE;AACA;AACA;AACA;AACA;AACA;AACA;AACF,wDAA6B;AAC7B;AACE;AACF,wDAA6B;AAC7B;AACE;AACF,wDAA6B;AAC7B;AACA;ACTO,SAAS,sBAAA,CACd,UAAA,EACA,gBAAA,EACmB;AACnB,EAAA,OAAO,gBAAA,CAAiB,MAAA,CAAO,CAAC,KAAA,EAAA,GAA2B;AACzD,IAAA,OAAO,CAAC,UAAA,CAAW,IAAA,CAAK,CAAC,MAAA,EAAA,GAA4B;AACnD,MAAA,GAAA,CAAI,KAAA,CAAM,KAAA,GAAQ,MAAA,CAAO,IAAA,EAAM;AAC7B,QAAA,OAAO,KAAA,CAAM,KAAA,IAAS,MAAA,CAAO,KAAA,GAAQ,KAAA,CAAM,GAAA,IAAO,MAAA,CAAO,EAAA;AAAA,MAC3D,EAAA,KAAA,GAAA,CAAW,qCAAA,KAAW,EAAA,GAAK,qCAAA,MAAY,CAAA,EAAG;AACxC,QAAA,OAAO,KAAA,CAAM,KAAA,IAAS,MAAA,CAAO,IAAA;AAAA,MAC/B;AAEA,MAAA,OAAO,KAAA;AAAA,IACT,CAAC,CAAA;AAAA,EACH,CAAC,CAAA;AACH;ADOA;AACA;AE1BA,2IAAiC;AACjC,wFAAoB;AF4BpB;AACA;AG5BO,SAAS,gBAAA,CAAiB,MAAA,EAA2D;AAC1F,EAAA,GAAA,CAAI,MAAA,CAAO,KAAA,E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AAA;AACF,MAAA;AACf,IAAA;AAEO,IAAA;AACT,EAAA;AACF;AAEO;AAMgB,EAAA;AACF,IAAA;AACI,MAAA;AACD,IAAA;AACF,MAAA;AAClB,IAAA;AAEO,IAAA;AACT,EAAA;AAEyB,EAAA;AACN,IAAA;AACI,MAAA;AAEV,IAAA;AAGO,MAAA;AAClB,IAAA;AAEO,IAAA;AACT,EAAA;AACF;AXsVyB;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-R33HRXQA.cjs","sourcesContent":[null,"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 { SchemaObject } from '../types.js';\n\nimport mergeJSONSchemaAllOf from 'json-schema-merge-allof';\nimport memoize from 'memoizee';\n\nimport { deeplyStripKey, 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 */\nfunction sampleFromSchema(\n schema: SchemaObject,\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): Record<string, unknown> | unknown[] | boolean | number | string | null | undefined {\n const objectifySchema = objectify(schema);\n let { type } = objectifySchema;\n\n const hasPolymorphism = usesPolymorphism(objectifySchema);\n if (hasPolymorphism === 'allOf') {\n try {\n return sampleFromSchema(\n mergeJSONSchemaAllOf(objectifySchema, {\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 opts,\n );\n } catch {\n return undefined;\n }\n } else if (hasPolymorphism) {\n const samples = (objectifySchema[hasPolymorphism] as SchemaObject[]).map(s => {\n return sampleFromSchema(s, opts);\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 const { example, additionalProperties, properties, items } = objectifySchema;\n const { includeReadOnly, includeWriteOnly } = opts;\n\n if (example !== undefined) {\n return deeplyStripKey(example, '$$ref', (val: string) => {\n // do a couple of quick sanity tests to ensure the value\n // looks like a $$ref that swagger-client generates.\n return typeof val === 'string' && val.indexOf('#') > -1;\n });\n }\n\n if (!type) {\n if (properties || additionalProperties) {\n type = 'object';\n } else if (items) {\n type = 'array';\n } else {\n return undefined;\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);\n }\n\n if (additionalProperties === true) {\n obj.additionalProp = {};\n } else if (additionalProperties) {\n const additionalProps = objectify(additionalProperties);\n const additionalPropVal = sampleFromSchema(additionalProps, opts);\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) => sampleFromSchema(i, opts));\n }\n\n if (Array.isArray(items.oneOf)) {\n return items.oneOf.map((i: SchemaObject) => sampleFromSchema(i, opts));\n }\n\n return [sampleFromSchema(items, opts)];\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 undefined;\n }\n\n return primitive(schema);\n}\n\nconst memo: typeof sampleFromSchema = memoize(sampleFromSchema);\n\n// biome-ignore lint/style/noDefaultExport: This is safe for now.\nexport default memo;\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// biome-ignore lint/complexity/noBannedTypes: This is part of a type guard.\nexport function isFunc(thing: unknown): thing is Function {\n return typeof thing === 'function';\n}\n\n// Deeply strips a specific key from an object.\n//\n// `predicate` can be used to discriminate the stripping further,\n// by preserving the key's place in the object based on its value.\n// @todo make this have a better type than `any`\nexport function deeplyStripKey(\n input: unknown,\n keyToStrip: string,\n predicate = (obj: unknown, key?: string): boolean => true,\n): SchemaObject | any {\n if (typeof input !== 'object' || Array.isArray(input) || input === null || !keyToStrip) {\n return input;\n }\n\n const obj = { ...input } as Record<string, SchemaObject>;\n\n Object.keys(obj).forEach(k => {\n if (k === keyToStrip && predicate(obj[k], k)) {\n delete obj[k];\n return;\n }\n\n obj[k] = deeplyStripKey(obj[k], keyToStrip, predicate);\n });\n\n return obj;\n}\n","import type { MediaTypeObject } from '../../types.js';\n\nimport matchesMimeType from '../../lib/matches-mimetype.js';\nimport sampleFromSchema from '../../samples/index.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 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 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 = key;\n let description: string;\n\n let example = examples[key];\n if (example !== null && typeof example === 'object') {\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 // If we have a $ref here then it's a circular reference and we should ignore it.\n if (example.value !== null && typeof example.value === 'object' && '$ref' in example.value) {\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(Boolean) as MediaTypeExample[];\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(JSON.parse(JSON.stringify(mediaTypeObject.schema)), opts),\n },\n ];\n }\n }\n\n return [];\n}\n","import type { OperationObject } from '../../types.js';\nimport type { MediaTypeExample } from './get-mediatype-examples.js';\n\nimport { isRef } from '../../types.js';\nimport { getMediaTypeExamples } from './get-mediatype-examples.js';\n\nexport type ResponseExamples = {\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) {\n return Object.keys(operation.responses || {})\n .map(status => {\n const response = operation.responses[status];\n let onlyHeaders = false;\n\n // If we have a $ref here that means that this was a circular ref so we should ignore it.\n if (isRef(response)) {\n 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 const examples = getMediaTypeExamples(mediaType, mediaTypeObject, {\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(Boolean) as ResponseExamples;\n}\n","import type { CallbackObject, OperationObject } from '../../types.js';\nimport type { ResponseExamples } from './get-response-examples.js';\n\nimport { getResponseExamples } from './get-response-examples.js';\n\nexport type CallbackExamples = {\n example: ResponseExamples;\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): CallbackExamples {\n const ret: CallbackExamples = [];\n\n // spreads the contents of the map for each callback so there's not nested arrays returned\n return ret.concat(\n ...Object.keys(operation.callbacks || {}).map(identifier => {\n const callback = operation.callbacks[identifier] as CallbackObject;\n\n // spreads the contents again so there's not nested arrays returned\n return []\n .concat(\n ...Object.keys(callback).map(expression => {\n return Object.keys(callback[expression]).map(method => {\n const pathItem = callback[expression] as Record<string, OperationObject>;\n const example = getResponseExamples(pathItem[method]);\n if (example.length === 0) return false;\n\n return {\n identifier,\n expression,\n method,\n example,\n };\n });\n }),\n )\n .filter(Boolean);\n }),\n );\n}\n","import type { OpenAPIV3 } from 'openapi-types';\nimport type { DataForHAR } from '../../types.js';\nimport type { Operation } from '../index.js';\nimport type { MediaTypeExample } from './get-mediatype-examples.js';\n\nimport { type Extensions, getExtension } from '../../extensions.js';\n\nexport type ExampleGroups = Record<\n string,\n {\n /**\n * Array of custom code samples that contain `correspondingExample` key.\n * Mutually exclusive of `request`. Note that if this object is present,\n * there may or may not be corresponding responses in the `response` object.\n */\n customCodeSamples?: (Extensions['code-samples'][number] & {\n /**\n * The index in the originally defined `code-samples` array\n */\n originalIndex: number;\n })[];\n\n /**\n * Title of example group. This is derived from the `summary` field of one of\n * the operation's example objects. The precedence is as follows (from highest to lowest):\n * 1. The first custom code sample's `name` field.\n * 2. The first request parameter (e.g., cookie/header/path/query) example object that\n * contains a `summary` field\n * 3. The request body example object's `summary` field\n * 4. The response example object's `summary` field\n *\n * @see {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#example-object}\n * @see {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#example-object}\n */\n name: string;\n\n /**\n * Object containing the example request data for the current example key.\n * Mutually exclusive of `customCodeSamples`. If `customCodeSamples` is present,\n * any request example definitions are ignored.\n */\n request?: DataForHAR;\n\n /**\n * Object containing the example response data for the current example key.\n */\n response?: {\n /**\n * The content type of the current example\n *\n * @example \"application/json\"\n * @example \"text/plain\"\n */\n mediaType: string;\n\n /**\n * The entire response example object. The example value itself is contained\n * within `value`.\n *\n * @see {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#example-object}\n * @see {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#example-object}\n */\n mediaTypeExample: MediaTypeExample;\n\n /**\n * The HTTP status code for the current response example\n *\n * @example \"2xx\"\n * @example \"400\"\n */\n status: string;\n };\n }\n>;\n\n/**\n * Internal key to represent custom code samples that do not have a corresponding response example.\n */\nconst noCorrespondingResponseKey = 'NoCorrespondingResponseForCustomCodeSample';\n\n/**\n * Takes a groups object and an operation and adds any matching response examples\n * to existing groups object\n */\nfunction addMatchingResponseExamples(groups: ExampleGroups, operation: Operation) {\n operation.getResponseExamples().forEach(example => {\n Object.entries(example.mediaTypes || {}).forEach(([mediaType, mediaTypeExamples]) => {\n mediaTypeExamples.forEach(mediaTypeExample => {\n // only add a response example if the `title` field exists\n // and it matches one of the existing example keys\n if (mediaTypeExample.title && Object.keys(groups).includes(mediaTypeExample.title)) {\n groups[mediaTypeExample.title].response = {\n mediaType,\n mediaTypeExample,\n status: example.status,\n };\n\n // if the current group doesn't already have a name set,\n // use the response example object's summary field\n if (!groups[mediaTypeExample.title].name) {\n groups[mediaTypeExample.title].name = mediaTypeExample.summary;\n }\n }\n });\n });\n });\n}\n\n/**\n * Returns a name for the given custom code sample. If there isn't already one defined,\n * we construct a fallback value based on where the sample is in the array.\n */\nfunction getDefaultName(sample: Extensions['code-samples'][number], count: Record<string, number>): string {\n return sample.name && sample.name.length > 0\n ? sample.name\n : `Default${count[sample.language] > 1 ? ` #${count[sample.language]}` : ''}`;\n}\n\n/**\n * Returns an object with groups of all example definitions (body/header/query/path/response/etc.).\n * The examples are grouped by their key when defined via the `examples` map.\n *\n * Any custom code samples defined via the `x-readme.code-samples` extension are returned,\n * regardless of if they have a matching response example.\n *\n * For standard OAS request parameter (e.g., body/header/query/path/etc.) examples,\n * they are only present in the return object if they have a corresponding response example\n * (i.e., a response example with the same key in the `examples` map).\n */\nexport function getExampleGroups(operation: Operation): ExampleGroups {\n const namelessCodeSampleCounts: Record<string, number> = {};\n const groups: ExampleGroups = {};\n\n // add custom code samples\n const codeSamples = getExtension('code-samples', operation.api, operation) as Extensions['code-samples'];\n codeSamples?.forEach((sample, i) => {\n if (namelessCodeSampleCounts[sample.language]) {\n namelessCodeSampleCounts[sample.language] += 1;\n } else {\n namelessCodeSampleCounts[sample.language] = 1;\n }\n const name = getDefaultName(sample, namelessCodeSampleCounts);\n\n // sample contains `correspondingExample` key\n if (groups[sample.correspondingExample]?.customCodeSamples?.length) {\n groups[sample.correspondingExample].customCodeSamples.push({ ...sample, name, originalIndex: i });\n } else if (sample.correspondingExample) {\n groups[sample.correspondingExample] = {\n name,\n customCodeSamples: [{ ...sample, name, originalIndex: i }],\n };\n }\n\n // sample does not contain a corresponding response example\n else if (groups[noCorrespondingResponseKey]?.customCodeSamples?.length) {\n groups[noCorrespondingResponseKey].customCodeSamples.push({ ...sample, name, originalIndex: i });\n } else {\n groups[noCorrespondingResponseKey] = {\n name,\n customCodeSamples: [{ ...sample, name, originalIndex: i }],\n };\n }\n });\n\n // if we added any custom code samples, add the corresponding response examples and return\n if (Object.keys(groups).length) {\n addMatchingResponseExamples(groups, operation);\n return groups;\n }\n\n // add request param examples\n operation.getParameters().forEach(param => {\n Object.entries(param.examples || {}).forEach(([exampleKey, paramExample]: [string, OpenAPIV3.ExampleObject]) => {\n groups[exampleKey] = {\n ...groups[exampleKey],\n name: groups[exampleKey]?.name || paramExample.summary,\n request: {\n ...groups[exampleKey]?.request,\n [param.in]: {\n ...groups[exampleKey]?.request?.[param.in],\n [param.name]: paramExample.value,\n },\n },\n };\n });\n });\n\n // add request body examples\n operation.getRequestBodyExamples().forEach(requestExample => {\n requestExample.examples.forEach((mediaTypeExample: MediaTypeExample) => {\n if (mediaTypeExample.title) {\n const mediaType = requestExample.mediaType === 'application/x-www-form-urlencoded' ? 'formData' : 'body';\n groups[mediaTypeExample.title] = {\n ...groups[mediaTypeExample.title],\n name: groups[mediaTypeExample.title]?.name || mediaTypeExample.summary,\n request: {\n ...groups[mediaTypeExample.title]?.request,\n [mediaType]: mediaTypeExample.value,\n },\n };\n }\n });\n });\n\n // if we added any request examples, add the corresponding response examples\n if (Object.keys(groups).length) {\n addMatchingResponseExamples(groups, operation);\n }\n\n // prune any objects that don't have both a request and a response\n Object.entries(groups).forEach(([groupId, group]) => {\n if (group.request && !group.response) {\n delete groups[groupId];\n }\n });\n\n return groups;\n}\n","import type { OperationObject, RequestBodyObject } from '../../types.js';\nimport type { MediaTypeExample } from './get-mediatype-examples.js';\n\nimport { getMediaTypeExamples } from './get-mediatype-examples.js';\n\nexport type RequestBodyExamples = {\n examples: MediaTypeExample[];\n mediaType: string;\n}[];\n\n/**\n * Retrieve a collection of request body examples, keyed by their media type.\n *\n * @param operation Operation to retrieve requestBody examples for.\n */\nexport function getRequestBodyExamples(operation: OperationObject): RequestBodyExamples {\n // `requestBody` will never have `$ref` pointers here so we need to work around the type that we\n // have from `OperationObject`.\n const requestBody = operation.requestBody as RequestBodyObject;\n if (!requestBody || !requestBody.content) {\n return [];\n }\n\n return Object.keys(requestBody.content || {})\n .map(mediaType => {\n const mediaTypeObject = requestBody.content[mediaType];\n const examples = getMediaTypeExamples(mediaType, mediaTypeObject, {\n includeReadOnly: false,\n includeWriteOnly: true,\n });\n\n if (!examples.length) {\n return false;\n }\n\n return {\n mediaType,\n examples,\n };\n })\n .filter(x => x !== false);\n}\n","import type {\n ComponentsObject,\n HeaderObject,\n MediaTypeObject,\n OASDocument,\n ResponseObject,\n SchemaObject,\n} from '../../types.js';\nimport type { Operation } from '../index.js';\n\nimport { cloneObject } from '../../lib/clone-object.js';\nimport { isPrimitive } from '../../lib/helpers.js';\nimport matches from '../../lib/matches-mimetype.js';\nimport { getSchemaVersionString, toJSONSchema } from '../../lib/openapi-to-json-schema.js';\n\ninterface ResponseSchemaObject {\n description?: string;\n label: string;\n schema: SchemaObject;\n type: string[] | string;\n}\n\nconst isJSON = matches.json;\n\n/**\n * Turn a header map from OpenAPI 3.0 (and some earlier versions too) into a schema.\n *\n * Note: This does not support OpenAPI 3.1's header format.\n *\n * @see {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#header-object}\n * @see {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.3.md#header-object}\n * @param response Response object to build a JSON Schema object for its headers for.\n */\nfunction buildHeadersSchema(\n response: ResponseObject,\n opts?: {\n /**\n * With a transformer you can transform any data within a given schema, like say if you want to\n * rewrite a potentially unsafe `title` that might be eventually used as a JS variable name,\n * just make sure to return your transformed schema.\n */\n transformer?: (schema: SchemaObject) => SchemaObject;\n },\n) {\n const headers = response.headers;\n\n const headersSchema: SchemaObject = {\n type: 'object',\n properties: {},\n };\n\n Object.keys(headers).forEach(key => {\n if (headers[key] && (headers[key] as HeaderObject).schema) {\n const header: HeaderObject = headers[key] as HeaderObject;\n\n // TODO: Response headers are essentially parameters in OAS\n // This means they can have content instead of schema.\n // We should probably support that in the future\n headersSchema.properties[key] = toJSONSchema(header.schema, {\n addEnumsToDescriptions: true,\n transformer: opts.transformer,\n });\n\n if (header.description) {\n (headersSchema.properties[key] as HeaderObject).description = header.description;\n }\n }\n });\n\n const headersWrapper: {\n description?: string;\n label: string;\n schema: SchemaObject;\n type: string;\n } = {\n schema: headersSchema,\n type: 'object',\n label: 'Headers',\n };\n\n if (response.description && headersWrapper.schema) {\n headersWrapper.description = response.description;\n }\n\n return headersWrapper;\n}\n\n/**\n * Extract all the response schemas, matching the format of `get-parameters-as-json-schema`.\n *\n * Note: This expects a dereferenced schema.\n *\n * @param operation Operation to construct a response JSON Schema for.\n * @param api The OpenAPI definition that this operation originates.\n * @param statusCode The response status code to generate a schema for.\n */\nexport function getResponseAsJSONSchema(\n operation: Operation,\n api: OASDocument,\n statusCode: number | string,\n opts?: {\n includeDiscriminatorMappingRefs?: boolean;\n /**\n * With a transformer you can transform any data within a given schema, like say if you want\n * to rewrite a potentially unsafe `title` that might be eventually used as a JS variable\n * name, just make sure to return your transformed schema.\n */\n transformer?: (schema: SchemaObject) => SchemaObject;\n },\n): ResponseSchemaObject[] | null {\n const response = operation.getResponseByStatusCode(statusCode);\n const jsonSchema: ResponseSchemaObject[] = [];\n\n if (!response) {\n return null;\n }\n\n let hasCircularRefs = false;\n let hasDiscriminatorMappingRefs = false;\n\n function refLogger(ref: string, type: 'discriminator' | 'ref') {\n if (type === 'ref') {\n hasCircularRefs = true;\n } else {\n hasDiscriminatorMappingRefs = true;\n }\n }\n\n /**\n * @param content An array of `MediaTypeObject`'s to retrieve a preferred schema out of. We\n * prefer JSON media types.\n */\n function getPreferredSchema(content: Record<string, MediaTypeObject>) {\n if (!content) {\n return null;\n }\n\n const contentTypes = Object.keys(content);\n if (!contentTypes.length) {\n return null;\n }\n\n for (let i = 0; i < contentTypes.length; i++) {\n if (isJSON(contentTypes[i])) {\n return toJSONSchema(cloneObject(content[contentTypes[i]].schema), {\n addEnumsToDescriptions: true,\n refLogger,\n transformer: opts.transformer,\n });\n }\n }\n\n // We always want to prefer the JSON-compatible content types over everything else but if we\n // haven't found one we should default to the first available.\n const contentType = contentTypes.shift();\n return toJSONSchema(cloneObject(content[contentType].schema), {\n addEnumsToDescriptions: true,\n refLogger,\n transformer: opts.transformer,\n });\n }\n\n const foundSchema = getPreferredSchema((response as ResponseObject).content);\n if (foundSchema) {\n const schema = cloneObject(foundSchema);\n const schemaWrapper: {\n description?: string;\n label: string;\n schema: SchemaObject;\n type: string[] | string;\n } = {\n // If there's no `type` then the root schema is a circular `$ref` that we likely won't be\n // able to render so instead of generating a JSON Schema with an `undefined` type we should\n // default to `string` so there's at least *something* the end-user can interact with.\n type: foundSchema.type || 'string',\n schema: isPrimitive(schema)\n ? schema\n : {\n ...schema,\n $schema: getSchemaVersionString(schema, api),\n },\n label: 'Response body',\n };\n\n if ((response as ResponseObject).description && schemaWrapper.schema) {\n schemaWrapper.description = (response as ResponseObject).description;\n }\n\n /**\n * Since this library assumes that the schema has already been dereferenced, adding every\n * component here that **isn't** circular adds a ton of bloat so it'd be cool if `components`\n * was just the remaining `$ref` pointers that are still being referenced.\n *\n * @todo\n */\n if (api.components && schemaWrapper.schema) {\n // We should only include components if we've got circular refs or we have discriminator\n // mapping refs (we want to include them).\n if (hasCircularRefs || (hasDiscriminatorMappingRefs && opts.includeDiscriminatorMappingRefs)) {\n ((schemaWrapper.schema as SchemaObject).components as ComponentsObject) = api.components as ComponentsObject;\n }\n }\n\n jsonSchema.push(schemaWrapper);\n }\n\n // 3.0.3 and earlier headers. TODO: New format for 3.1.0\n if ((response as ResponseObject).headers) {\n jsonSchema.push(buildHeadersSchema(response as ResponseObject, opts));\n }\n\n return jsonSchema.length ? jsonSchema : null;\n}\n","import type { OperationObject } from '../../types.ts';\n\nexport interface OperationIDGeneratorOptions {\n /**\n * Generate a JS method-friendly operation ID when one isn't present.\n *\n * For backwards compatiblity reasons this option will be indefinitely supported however we\n * recommend using `friendlyCase` instead as it's a heavily improved version of this option.\n *\n * @see {friendlyCase}\n * @deprecated\n */\n camelCase?: boolean;\n\n /**\n * Generate a human-friendly, but still camelCase, operation ID when one isn't present. The\n * difference between this and `camelCase` is that this also ensure that consecutive words are\n * not present in the resulting ID. For example, for the endpoint `/candidate/{candidate}` will\n * return `getCandidateCandidate` for `camelCase` however `friendlyCase` will return\n * `getCandidate`.\n *\n * The reason this friendliness is just not a part of the `camelCase` option is because we have\n * a number of consumers of the old operation ID style and making that change there would a\n * breaking change that we don't have any easy way to resolve.\n */\n friendlyCase?: boolean;\n}\n\n/**\n * Determine if an operation has an `operationId` present in its schema. Note that if one is\n * present in the schema but is an empty string then this will return false.\n *\n */\nexport function hasOperationId(operation: OperationObject): boolean {\n return Boolean('operationId' in operation && operation.operationId.length);\n}\n\n/**\n * Get an `operationId` for an operation. If one is not present (it's not required by the spec!)\n * a hash of the path and method will be returned instead.\n *\n */\nexport function getOperationId(\n path: string,\n method: string,\n operation: OperationObject,\n opts: OperationIDGeneratorOptions = {},\n): string {\n function sanitize(id: string) {\n // We aren't sanitizing underscores here by default in order to preserve operation IDs that\n // were already generated with this method in the past.\n return id\n .replace(opts?.camelCase || opts?.friendlyCase ? /[^a-zA-Z0-9_]/g : /[^a-zA-Z0-9]/g, '-') // Remove weird characters\n .replace(/--+/g, '-') // Remove double --'s\n .replace(/^-|-$/g, ''); // Don't start or end with -\n }\n\n const operationIdExists = hasOperationId(operation);\n let operationId: string;\n if (operationIdExists) {\n operationId = operation.operationId;\n } else {\n operationId = sanitize(path).toLowerCase();\n }\n\n const currMethod = method.toLowerCase();\n if (opts?.camelCase || opts?.friendlyCase) {\n if (opts?.friendlyCase) {\n // In order to generate friendlier operation IDs we should swap out underscores with spaces\n // so the end result will be _slightly_ more camelCase.\n operationId = operationId.replaceAll('_', ' ');\n\n if (!operationIdExists) {\n // In another effort to generate friendly operation IDs we should prevent words from\n // appearing in consecutive order (eg. `/candidate/{candidate}` should generate\n // `getCandidate` not `getCandidateCandidate`). However we only want to do this if we're\n // generating the operation ID as if they intentionally added a consecutive word into the\n // operation ID then we should respect that.\n operationId = operationId\n .replace(/[^a-zA-Z0-9_]+(.)/g, (_, chr) => ` ${chr}`)\n .split(' ')\n .filter((word, i, arr) => word !== arr[i - 1])\n .join(' ');\n }\n }\n\n operationId = operationId.replace(/[^a-zA-Z0-9_]+(.)/g, (_, chr) => chr.toUpperCase());\n if (operationIdExists) {\n operationId = sanitize(operationId);\n }\n\n // Never start with a number.\n operationId = operationId.replace(/^[0-9]/g, match => `_${match}`);\n\n // Ensure that the first character of an `operationId` is always lowercase.\n operationId = operationId.charAt(0).toLowerCase() + operationId.slice(1);\n\n // If the generated `operationId` already starts with the method (eg. `getPets`) we don't want\n // to double it up into `getGetPets`.\n if (operationId.startsWith(currMethod)) {\n return operationId;\n }\n\n // If this operation already has an `operationId` and we just cleaned it up then we shouldn't\n // prefix it with an HTTP method.\n if (operationIdExists) {\n return operationId;\n }\n\n // Because we're merging the `operationId` into an HTTP method we need to reset the first\n // character of it back to lowercase so we end up with `getBuster`, not `getbuster`.\n operationId = operationId.charAt(0).toUpperCase() + operationId.slice(1);\n return `${currMethod}${operationId}`;\n } else if (operationIdExists) {\n return operationId;\n }\n\n return `${currMethod}_${operationId}`;\n}\n","import type { OpenAPIV3, OpenAPIV3_1 } from 'openapi-types';\nimport type { Extensions } from '../extensions.js';\nimport type {\n CallbackObject,\n HttpMethods,\n KeyedSecuritySchemeObject,\n MediaTypeObject,\n OAS31Document,\n OASDocument,\n OperationObject,\n ParameterObject,\n PathItemObject,\n RequestBodyObject,\n ResponseObject,\n SchemaObject,\n SecurityRequirementObject,\n SecurityType,\n TagObject,\n} from '../types.js';\nimport type { CallbackExamples } from './lib/get-callback-examples.js';\nimport type { getParametersAsJSONSchemaOptions, SchemaWrapper } from './lib/get-parameters-as-json-schema.js';\nimport type { RequestBodyExamples } from './lib/get-requestbody-examples.js';\nimport type { ResponseExamples } from './lib/get-response-examples.js';\nimport type { OperationIDGeneratorOptions } from './lib/operationId.js';\n\nimport findSchemaDefinition from '../lib/find-schema-definition.js';\nimport matchesMimeType from '../lib/matches-mimetype.js';\nimport { isRef } from '../types.js';\nimport { supportedMethods } from '../utils.js';\nimport { dedupeCommonParameters } from './lib/dedupe-common-parameters.js';\nimport { getCallbackExamples } from './lib/get-callback-examples.js';\nimport { type ExampleGroups, getExampleGroups } from './lib/get-example-groups.js';\nimport { getParametersAsJSONSchema } from './lib/get-parameters-as-json-schema.js';\nimport { getRequestBodyExamples } from './lib/get-requestbody-examples.js';\nimport { getResponseAsJSONSchema } from './lib/get-response-as-json-schema.js';\nimport { getResponseExamples } from './lib/get-response-examples.js';\nimport { getOperationId, hasOperationId } from './lib/operationId.js';\n\nexport class Operation {\n /**\n * Schema of the operation from the API Definition.\n */\n schema: OperationObject;\n\n /**\n * OpenAPI API Definition that this operation originated from.\n */\n api: OASDocument;\n\n /**\n * Path that this operation is targeted towards.\n */\n path: string;\n\n /**\n * HTTP Method that this operation is targeted towards.\n */\n method: HttpMethods;\n\n /**\n * The primary Content Type that this operation accepts.\n */\n contentType: string;\n\n /**\n * An object with groups of all example definitions (body/header/query/path/response/etc.)\n */\n exampleGroups: ExampleGroups;\n\n /**\n * Request body examples for this operation.\n */\n requestBodyExamples: RequestBodyExamples;\n\n /**\n * Response examples for this operation.\n */\n responseExamples: ResponseExamples;\n\n /**\n * Callback examples for this operation (if it has callbacks).\n */\n callbackExamples: CallbackExamples;\n\n /**\n * Flattened out arrays of both request and response headers that are utilized on this operation.\n */\n headers: {\n request: string[];\n response: string[];\n };\n\n constructor(api: OASDocument, path: string, method: HttpMethods, operation: OperationObject) {\n this.schema = operation;\n this.api = api;\n this.path = path;\n this.method = method;\n\n this.contentType = undefined;\n this.requestBodyExamples = undefined;\n this.responseExamples = undefined;\n this.callbackExamples = undefined;\n this.exampleGroups = undefined;\n this.headers = {\n request: [],\n response: [],\n };\n }\n\n getSummary(): string {\n if (this.schema?.summary && typeof this.schema.summary === 'string') {\n return this.schema.summary;\n } else if (this.api.paths[this.path].summary && typeof this.api.paths[this.path].summary === 'string') {\n return this.api.paths[this.path].summary;\n }\n\n return undefined;\n }\n\n getDescription(): string {\n if (this.schema?.description && typeof this.schema.description === 'string') {\n return this.schema.description;\n } else if (this.api.paths[this.path].description && typeof this.api.paths[this.path].description === 'string') {\n return this.api.paths[this.path].description;\n }\n\n return undefined;\n }\n\n getContentType(): string {\n if (this.contentType) {\n return this.contentType;\n }\n\n let types: string[] = [];\n if (this.schema.requestBody) {\n if ('$ref' in this.schema.requestBody) {\n this.schema.requestBody = findSchemaDefinition(this.schema.requestBody.$ref, this.api);\n }\n\n if ('content' in this.schema.requestBody) {\n types = Object.keys(this.schema.requestBody.content);\n }\n }\n\n this.contentType = 'application/json';\n if (types?.length) {\n this.contentType = types[0];\n }\n\n // Favor JSON if it exists\n types.forEach(t => {\n if (matchesMimeType.json(t)) {\n this.contentType = t;\n }\n });\n\n return this.contentType;\n }\n\n isFormUrlEncoded(): boolean {\n return matchesMimeType.formUrlEncoded(this.getContentType());\n }\n\n isMultipart(): boolean {\n return matchesMimeType.multipart(this.getContentType());\n }\n\n isJson(): boolean {\n return matchesMimeType.json(this.getContentType());\n }\n\n isXml(): boolean {\n return matchesMimeType.xml(this.getContentType());\n }\n\n /**\n * Checks if the current operation is a webhook or not.\n *\n */\n isWebhook(): boolean {\n return this instanceof Webhook;\n }\n\n /**\n * Returns an array of all security requirements associated wtih this operation. If none are\n * defined at the operation level, the securities for the entire API definition are returned\n * (with an empty array as a final fallback).\n *\n */\n getSecurity(): SecurityRequirementObject[] {\n if (!this.api?.components?.securitySchemes || !Object.keys(this.api.components.securitySchemes).length) {\n return [];\n }\n\n return this.schema.security || this.api.security || [];\n }\n\n /**\n * Retrieve a collection of grouped security schemes. The inner array determines AND-grouped\n * security schemes, the outer array determines OR-groups.\n *\n * @see {@link https://swagger.io/docs/specification/authentication/#multiple}\n * @see {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#security-requirement-object}\n * @see {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#security-requirement-object}\n * @param filterInvalid Optional flag that, when set to `true`, filters out invalid/nonexistent\n * security schemes, rather than returning `false`.\n */\n getSecurityWithTypes(\n filterInvalid = false,\n ): ((false | { security: KeyedSecuritySchemeObject; type: SecurityType })[] | false)[] {\n const securityRequirements = this.getSecurity();\n\n return securityRequirements.map(requirement => {\n let keys: string[];\n try {\n keys = Object.keys(requirement);\n } catch {\n return false;\n }\n\n const keysWithTypes = keys.map(key => {\n let security: KeyedSecuritySchemeObject;\n try {\n // Remove the reference type, because we know this will be dereferenced\n security = this.api.components.securitySchemes[key] as KeyedSecuritySchemeObject;\n } catch {\n return false;\n }\n\n if (!security) return false;\n\n let type: SecurityType = null;\n\n if (security.type === 'http') {\n if (security.scheme === 'basic') type = 'Basic';\n else if (security.scheme === 'bearer') type = 'Bearer';\n else type = security.type;\n } else if (security.type === 'oauth2') {\n type = 'OAuth2';\n } else if (security.type === 'apiKey') {\n if (security.in === 'query') type = 'Query';\n else if (security.in === 'header') type = 'Header';\n else if (security.in === 'cookie') type = 'Cookie';\n else type = security.type;\n } else {\n return false;\n }\n\n return {\n type,\n security: {\n ...security,\n _key: key,\n _requirements: requirement[key],\n },\n };\n });\n\n if (filterInvalid) return keysWithTypes.filter(key => key !== false);\n\n return keysWithTypes;\n });\n }\n\n /**\n * Retrieve an object where the keys are unique scheme types, and the values are arrays\n * containing each security scheme of that type.\n *\n */\n prepareSecurity(): Record<SecurityType, KeyedSecuritySchemeObject[]> {\n const securitiesWithTypes = this.getSecurityWithTypes();\n\n return securitiesWithTypes.reduce(\n (prev, securities) => {\n if (!securities) return prev;\n\n securities.forEach(security => {\n // Remove non-existent schemes\n if (!security) return;\n if (!prev[security.type]) prev[security.type] = [];\n\n // Only add schemes we haven't seen yet.\n const exists = prev[security.type].some(sec => sec._key === security.security._key);\n if (!exists) {\n // Since an operation can require the same security scheme several times (each with different scope requirements),\n // including the `_requirements` in this object would be misleading since we dedupe the security schemes.\n if (security.security?._requirements) delete security.security._requirements;\n prev[security.type].push(security.security);\n }\n });\n\n return prev;\n },\n {} as Record<SecurityType, KeyedSecuritySchemeObject[]>,\n );\n }\n\n getHeaders(): Operation['headers'] {\n const security = this.prepareSecurity();\n if (security.Header) {\n this.headers.request = (security.Header as OpenAPIV3_1.ApiKeySecurityScheme[]).map(h => {\n return h.name;\n });\n }\n\n if (security.Bearer || security.Basic || security.OAuth2) {\n this.headers.request.push('Authorization');\n }\n\n if (security.Cookie) {\n this.headers.request.push('Cookie');\n }\n\n if (this.schema.parameters) {\n this.headers.request = this.headers.request.concat(\n // Remove the reference object because we will have already dereferenced.\n (this.schema.parameters as OpenAPIV3_1.ParameterObject[] | OpenAPIV3.ParameterObject[])\n .map(p => {\n if (p.in && p.in === 'header') return p.name;\n return undefined;\n })\n .filter(p => p),\n );\n }\n\n if (this.schema.responses) {\n this.headers.response = Object.keys(this.schema.responses)\n // Remove the reference object because we will have already dereferenced.\n .filter(r => (this.schema.responses[r] as ResponseObject).headers)\n .map(r =>\n // Remove the reference object because we will have already dereferenced.\n Object.keys((this.schema.responses[r] as ResponseObject).headers),\n )\n .reduce((a, b) => a.concat(b), []);\n }\n\n // If the operation doesn't already specify a `content-type` request header, we check if the\n // path operation request body contains content, which implies that we should also include the\n // `content-type` header.\n if (!this.headers.request.includes('Content-Type') && this.schema.requestBody) {\n if (\n (this.schema.requestBody as RequestBodyObject).content &&\n Object.keys((this.schema.requestBody as RequestBodyObject).content)\n ) {\n this.headers.request.push('Content-Type');\n }\n }\n\n // This is a similar approach, but in this case if we check the response content and prioritize\n // the `accept` request header and `content-type` request header.\n if (this.schema.responses) {\n if (\n Object.keys(this.schema.responses).some(\n response => !!(this.schema.responses[response] as ResponseObject).content,\n )\n ) {\n if (!this.headers.request.includes('Accept')) this.headers.request.push('Accept');\n if (!this.headers.response.includes('Content-Type')) this.headers.response.push('Content-Type');\n }\n }\n\n return this.headers;\n }\n\n /**\n * Determine if the operation has an `operationId` present in its schema. Note that if one is\n * present in the schema but is an empty string then this will return false.\n *\n */\n hasOperationId(): boolean {\n return hasOperationId(this.schema);\n }\n\n /**\n * Determine if an operation has an `operationId` present in its schema. Note that if one is\n * present in the schema but is an empty string then this will return false.\n *\n */\n static hasOperationId(schema: OperationObject): boolean {\n return hasOperationId(schema);\n }\n\n /**\n * Get an `operationId` for this operation. If one is not present (it's not required by the spec!)\n * a hash of the path and method will be returned instead.\n *\n */\n getOperationId(opts: OperationIDGeneratorOptions = {}): string {\n return getOperationId(this.path, this.method, this.schema, opts);\n }\n\n /**\n * Get an `operationId` for an operation. If one is not present (it's not required by the spec!)\n * a hash of the path and method will be returned instead.\n *\n */\n static getOperationId(\n path: string,\n method: string,\n schema: OperationObject,\n opts: OperationIDGeneratorOptions = {},\n ): string {\n return getOperationId(path, method, schema, opts);\n }\n\n /**\n * Return an array of all tags, and their metadata, that exist on this operation.\n *\n */\n getTags(): TagObject[] {\n if (!('tags' in this.schema)) {\n return [];\n }\n\n const oasTagMap: Map<string, TagObject> = new Map();\n if ('tags' in this.api) {\n this.api.tags.forEach((tag: TagObject) => {\n oasTagMap.set(tag.name, tag);\n });\n }\n\n const oasTags = Object.fromEntries(oasTagMap);\n\n const tags: TagObject[] = [];\n if (Array.isArray(this.schema.tags)) {\n this.schema.tags.forEach(tag => {\n if (tag in oasTags) {\n tags.push(oasTags[tag]);\n } else {\n tags.push({\n name: tag,\n });\n }\n });\n }\n\n return tags;\n }\n\n /**\n * Return is the operation is flagged as `deprecated` or not.\n *\n */\n isDeprecated(): boolean {\n return 'deprecated' in this.schema ? this.schema.deprecated : false;\n }\n\n /**\n * Determine if the operation has any (non-request body) parameters.\n *\n */\n hasParameters(): boolean {\n return !!this.getParameters().length;\n }\n\n /**\n * Return the parameters (non-request body) on the operation.\n *\n */\n getParameters(): ParameterObject[] {\n let parameters = (this.schema?.parameters || []) as ParameterObject[];\n const commonParams = (this.api?.paths?.[this.path]?.parameters || []) as ParameterObject[];\n if (commonParams.length) {\n parameters = parameters.concat(dedupeCommonParameters(parameters, commonParams) || []);\n }\n\n return parameters;\n }\n\n /**\n * Determine if this operation has any required parameters.\n *\n */\n hasRequiredParameters(): boolean {\n return this.getParameters().some(param => 'required' in param && param.required);\n }\n\n /**\n * Convert the operation into an array of JSON Schema schemas for each available type of\n * parameter available on the operation.\n *\n */\n getParametersAsJSONSchema(opts: getParametersAsJSONSchemaOptions = {}): SchemaWrapper[] {\n return getParametersAsJSONSchema(this, this.api, {\n includeDiscriminatorMappingRefs: true,\n transformer: (s: SchemaObject) => s,\n ...opts,\n });\n }\n\n /**\n * Get a single response for this status code, formatted as JSON schema.\n *\n * @param statusCode Status code to pull a JSON Schema response for.\n */\n getResponseAsJSONSchema(\n statusCode: number | string,\n opts: {\n /**\n * If you wish to include discriminator mapping `$ref` components alongside your\n * `discriminator` in schemas. Defaults to `true`.\n */\n includeDiscriminatorMappingRefs?: boolean;\n\n /**\n * With a transformer you can transform any data within a given schema, like say if you want\n * to rewrite a potentially unsafe `title` that might be eventually used as a JS variable\n * name, just make sure to return your transformed schema.\n */\n transformer?: (schema: SchemaObject) => SchemaObject;\n } = {},\n ): SchemaObject {\n return getResponseAsJSONSchema(this, this.api, statusCode, {\n includeDiscriminatorMappingRefs: true,\n transformer: (s: SchemaObject) => s,\n ...opts,\n });\n }\n\n /**\n * Get an array of all valid response status codes for this operation.\n *\n */\n getResponseStatusCodes(): string[] {\n return this.schema.responses ? Object.keys(this.schema.responses) : [];\n }\n\n /**\n * Determine if the operation has any request bodies.\n *\n */\n hasRequestBody(): boolean {\n return !!this.schema.requestBody;\n }\n\n /**\n * Retrieve the list of all available media types that the operations request body can accept.\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 */\n getRequestBodyMediaTypes(): string[] {\n if (!this.hasRequestBody()) {\n return [];\n }\n\n const requestBody = this.schema.requestBody;\n if (isRef(requestBody)) {\n // If the request body is still a `$ref` pointer we should return false because this library\n // assumes that you've run dereferencing beforehand.\n return [];\n }\n\n return Object.keys(requestBody.content);\n }\n\n /**\n * Determine if this operation has a required request body.\n *\n */\n hasRequiredRequestBody(): boolean {\n if (!this.hasRequestBody()) {\n return false;\n }\n\n const requestBody = this.schema.requestBody;\n if (isRef(requestBody)) {\n return false;\n }\n\n if (requestBody.required) {\n return true;\n }\n\n // The OpenAPI spec isn't clear on the differentiation between schema `required` and\n // `requestBody.required` because you can have required top-level schema properties but a\n // non-required requestBody that negates each other.\n //\n // To kind of work ourselves around this and present a better QOL for this accessor, if at this\n // final point where we don't have a required request body, but the underlying Media Type Object\n // schema says that it has required properties then we should ultimately recognize that this\n // request body is required -- even as the request body description says otherwise.\n return !!this.getParametersAsJSONSchema()\n .filter(js => ['body', 'formData'].includes(js.type))\n .find(js => js.schema && Array.isArray(js.schema.required) && js.schema.required.length);\n }\n\n /**\n * Retrieve a specific request body content schema off this operation.\n *\n * If no media type is supplied this will return either the first available JSON-like request\n * body, or the first available if there are no JSON-like media types present. When this return\n * comes back it's in the form of an array with the first key being the selected media type,\n * followed by the media type object in question.\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 Specific request body media type to retrieve if present.\n */\n getRequestBody(mediaType?: string): MediaTypeObject | false | [string, MediaTypeObject, ...string[]] {\n if (!this.hasRequestBody()) {\n return false;\n }\n\n const requestBody = this.schema.requestBody;\n if (isRef(requestBody)) {\n // If the request body is still a `$ref` pointer we should return false because this library\n // assumes that you've run dereferencing beforehand.\n return false;\n }\n\n if (mediaType) {\n if (!(mediaType in requestBody.content)) {\n return false;\n }\n\n return requestBody.content[mediaType];\n }\n\n // Since no media type was supplied we need to find either the first JSON-like media type that\n // we've got, or the first available of anything else if no JSON-like media types are present.\n let availableMediaType: string;\n const mediaTypes = this.getRequestBodyMediaTypes();\n mediaTypes.forEach((mt: string) => {\n if (!availableMediaType && matchesMimeType.json(mt)) {\n availableMediaType = mt;\n }\n });\n\n if (!availableMediaType) {\n mediaTypes.forEach((mt: string) => {\n if (!availableMediaType) {\n availableMediaType = mt;\n }\n });\n }\n\n if (availableMediaType) {\n return [\n availableMediaType,\n requestBody.content[availableMediaType],\n ...(requestBody.description ? [requestBody.description] : []),\n ];\n }\n\n return false;\n }\n\n /**\n * Retrieve an array of request body examples that this operation has.\n *\n */\n getRequestBodyExamples(): RequestBodyExamples {\n const isRequestExampleValueDefined = typeof this.requestBodyExamples?.[0]?.examples?.[0].value !== 'undefined';\n\n if (this.requestBodyExamples && isRequestExampleValueDefined) {\n return this.requestBodyExamples;\n }\n\n this.requestBodyExamples = getRequestBodyExamples(this.schema);\n return this.requestBodyExamples;\n }\n\n /**\n * Return a specific response out of the operation by a given HTTP status code.\n *\n * @param statusCode Status code to pull a response object for.\n */\n getResponseByStatusCode(statusCode: number | string): ResponseObject | boolean {\n if (!this.schema.responses) {\n return false;\n }\n\n if (typeof this.schema.responses[statusCode] === 'undefined') {\n return false;\n }\n\n const response = this.schema.responses[statusCode];\n\n if (isRef(response)) {\n return false;\n }\n\n // Remove the reference from the type, because it will already be dereferenced.\n return response;\n }\n\n /**\n * Retrieve an array of response examples that this operation has.\n *\n */\n getResponseExamples(): ResponseExamples {\n if (this.responseExamples) {\n return this.responseExamples;\n }\n\n // @todo Remove this `as` once we convert getResponseExamples\n this.responseExamples = getResponseExamples(this.schema) as ResponseExamples;\n return this.responseExamples;\n }\n\n /**\n * Determine if the operation has callbacks.\n *\n */\n hasCallbacks(): boolean {\n return !!this.schema.callbacks;\n }\n\n /**\n * Retrieve a specific callback.\n *\n * @see {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#callback-object}\n * @see {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#callback-object}\n * @param identifier Callback identifier to look for.\n * @param expression Callback expression to look for.\n * @param method HTTP Method on the callback to look for.\n */\n getCallback(identifier: string, expression: string, method: HttpMethods): Callback | false {\n if (!this.schema.callbacks) return false;\n\n // The usage of `as` in the below is to remove the possibility of a ref type, since we've\n // dereferenced.\n const callback = this.schema.callbacks[identifier]\n ? (((this.schema.callbacks as Record<string, CallbackObject>)[identifier] as CallbackObject)[\n expression\n ] as PathItemObject)\n : false;\n\n if (!callback || !callback[method]) return false;\n return new Callback(this.api, expression, method, callback[method], identifier, callback);\n }\n\n /**\n * Retrieve an array of operations created from each callback.\n *\n */\n getCallbacks(): (Callback | false)[] | false {\n const callbackOperations: (Callback | false)[] = [];\n if (!this.hasCallbacks()) return false;\n\n Object.keys(this.schema.callbacks).forEach(callback => {\n Object.keys(this.schema.callbacks[callback]).forEach(expression => {\n const cb = this.schema.callbacks[callback];\n\n if (!isRef(cb)) {\n const exp = cb[expression];\n\n if (!isRef(exp)) {\n Object.keys(exp).forEach((method: HttpMethods) => {\n if (!supportedMethods.includes(method)) return;\n\n callbackOperations.push(this.getCallback(callback, expression, method));\n });\n }\n }\n });\n });\n\n return callbackOperations;\n }\n\n /**\n * Retrieve an array of callback examples that this operation has.\n *\n */\n getCallbackExamples(): CallbackExamples {\n if (this.callbackExamples) {\n return this.callbackExamples;\n }\n\n this.callbackExamples = getCallbackExamples(this.schema);\n return this.callbackExamples;\n }\n\n /**\n * Determine if a given a custom specification extension exists within the operation.\n *\n * @see {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#specification-extensions}\n * @see {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#specification-extensions}\n * @param extension Specification extension to lookup.\n */\n hasExtension(extension: string): boolean {\n return Boolean(this.schema && extension in this.schema);\n }\n\n /**\n * Retrieve a custom specification extension off of the operation.\n *\n * @see {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#specification-extensions}\n * @see {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#specification-extensions}\n * @param extension Specification extension to lookup.\n *\n * @deprecated Use `oas.getExtension(extension, operation)` instead.\n */\n getExtension(extension: string | keyof Extensions): any {\n return this.schema?.[extension];\n }\n\n /**\n * Returns an object with groups of all example definitions (body/header/query/path/response/etc.).\n * The examples are grouped by their key when defined via the `examples` map.\n *\n * Any custom code samples defined via the `x-readme.code-samples` extension are returned,\n * regardless of if they have a matching response example.\n *\n * For standard OAS request parameter (e.g., body/header/query/path/etc.) examples,\n * they are only present in the return object if they have a corresponding response example\n * (i.e., a response example with the same key in the `examples` map).\n */\n getExampleGroups(): ExampleGroups {\n if (this.exampleGroups) return this.exampleGroups;\n\n const groups = getExampleGroups(this);\n\n this.exampleGroups = groups;\n\n return groups;\n }\n}\n\nexport class Callback extends Operation {\n /**\n * The identifier that this callback is set to.\n */\n identifier: string;\n\n /**\n * The parent path item object that this Callback exists within.\n */\n parentSchema: PathItemObject;\n\n constructor(\n oas: OASDocument,\n path: string,\n method: HttpMethods,\n operation: OperationObject,\n identifier: string,\n parentPathItem: PathItemObject,\n ) {\n super(oas, path, method, operation);\n\n this.identifier = identifier;\n this.parentSchema = parentPathItem;\n }\n\n /**\n * Return the primary identifier for this callback.\n *\n * @see {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#callback-object}\n * @see {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#callback-object}\n */\n getIdentifier(): string {\n return this.identifier;\n }\n\n getSummary(): string {\n if (this.schema?.summary && typeof this.schema.summary === 'string') {\n return this.schema.summary;\n } else if (this.parentSchema.summary && typeof this.parentSchema.summary === 'string') {\n return this.parentSchema.summary;\n }\n\n return undefined;\n }\n\n getDescription(): string {\n if (this.schema?.description && typeof this.schema.description === 'string') {\n return this.schema.description;\n } else if (this.parentSchema.description && typeof this.parentSchema.description === 'string') {\n return this.parentSchema.description;\n }\n\n return undefined;\n }\n\n getParameters(): ParameterObject[] {\n let parameters = (this.schema?.parameters || []) as ParameterObject[];\n const commonParams = (this.parentSchema.parameters || []) as ParameterObject[];\n if (commonParams.length) {\n parameters = parameters.concat(dedupeCommonParameters(parameters, commonParams) || []);\n }\n\n return parameters;\n }\n}\n\nexport class Webhook extends Operation {\n /**\n * OpenAPI API Definition that this webhook originated from.\n */\n declare api: OAS31Document;\n\n getSummary(): string {\n if (this.schema?.summary && typeof this.schema.summary === 'string') {\n return this.schema.summary;\n } else if (this.api.webhooks[this.path].summary && typeof this.api.webhooks[this.path].summary === 'string') {\n return this.api.webhooks[this.path].summary;\n }\n\n return undefined;\n }\n\n getDescription(): string {\n if (this.schema?.description && typeof this.schema.description === 'string') {\n return this.schema.description;\n } else if (\n this.api.webhooks[this.path].description &&\n typeof this.api.webhooks[this.path].description === 'string'\n ) {\n return this.api.webhooks[this.path].description;\n }\n\n return undefined;\n }\n}\n"]}
@@ -1,12 +1,12 @@
1
1
  import {
2
2
  PARAMETER_ORDERING,
3
3
  getExtension
4
- } from "./chunk-FHMF4CEN.js";
4
+ } from "./chunk-NBQXNFZT.js";
5
5
  import {
6
- isOAS31,
6
+ isOpenAPI30,
7
7
  isRef,
8
8
  isSchema
9
- } from "./chunk-UCEHCARG.js";
9
+ } from "./chunk-47ELBTA5.js";
10
10
 
11
11
  // src/lib/clone-object.ts
12
12
  function cloneObject(obj) {
@@ -84,7 +84,7 @@ function encodePointer(str) {
84
84
  return str.replace("~", "~0").replace("/", "~1");
85
85
  }
86
86
  function getSchemaVersionString(schema, api) {
87
- if (!isOAS31(api)) {
87
+ if (isOpenAPI30(api)) {
88
88
  return "http://json-schema.org/draft-04/schema#";
89
89
  }
90
90
  if (schema.$schema) {
@@ -832,4 +832,4 @@ export {
832
832
  types,
833
833
  getParametersAsJSONSchema
834
834
  };
835
- //# sourceMappingURL=chunk-ATLAOOV5.js.map
835
+ //# sourceMappingURL=chunk-SVQE2R3T.js.map