oas 32.1.10 → 32.1.13

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 (39) hide show
  1. package/dist/analyzer/index.cjs +6 -6
  2. package/dist/analyzer/index.js +4 -4
  3. package/dist/{chunk-WXXVCSCN.js → chunk-2EISA7HB.js} +5 -5
  4. package/dist/chunk-2EISA7HB.js.map +1 -0
  5. package/dist/{chunk-YPR7YTHM.cjs → chunk-3MTU2ESP.cjs} +1 -1
  6. package/dist/{chunk-YPR7YTHM.cjs.map → chunk-3MTU2ESP.cjs.map} +1 -1
  7. package/dist/{chunk-EYI3QYOG.cjs → chunk-7BWVOLZR.cjs} +211 -198
  8. package/dist/chunk-7BWVOLZR.cjs.map +1 -0
  9. package/dist/{chunk-DKPOVGFI.cjs → chunk-BJEFIYTO.cjs} +29 -29
  10. package/dist/chunk-BJEFIYTO.cjs.map +1 -0
  11. package/dist/{chunk-2TQO63CW.js → chunk-GIFUTDD5.js} +53 -40
  12. package/dist/chunk-GIFUTDD5.js.map +1 -0
  13. package/dist/{chunk-7BC6KXMO.js → chunk-K5WNB3M7.js} +133 -49
  14. package/dist/chunk-K5WNB3M7.js.map +1 -0
  15. package/dist/{chunk-MNOEMVCF.js → chunk-PSNTODZL.js} +1 -1
  16. package/dist/{chunk-MNOEMVCF.js.map → chunk-PSNTODZL.js.map} +1 -1
  17. package/dist/{chunk-HTEFBV7K.cjs → chunk-SAB2PGCD.cjs} +158 -74
  18. package/dist/chunk-SAB2PGCD.cjs.map +1 -0
  19. package/dist/index.cjs +5 -5
  20. package/dist/index.js +4 -4
  21. package/dist/operation/index.cjs +4 -4
  22. package/dist/operation/index.js +3 -3
  23. package/dist/reducer/index.cjs +49 -28
  24. package/dist/reducer/index.cjs.map +1 -1
  25. package/dist/reducer/index.js +23 -2
  26. package/dist/reducer/index.js.map +1 -1
  27. package/dist/types.cjs +2 -2
  28. package/dist/types.d.cts +3 -0
  29. package/dist/types.d.ts +3 -0
  30. package/dist/types.js +1 -1
  31. package/dist/utils.cjs +3 -3
  32. package/dist/utils.js +2 -2
  33. package/package.json +6 -8
  34. package/dist/chunk-2TQO63CW.js.map +0 -1
  35. package/dist/chunk-7BC6KXMO.js.map +0 -1
  36. package/dist/chunk-DKPOVGFI.cjs.map +0 -1
  37. package/dist/chunk-EYI3QYOG.cjs.map +0 -1
  38. package/dist/chunk-HTEFBV7K.cjs.map +0 -1
  39. package/dist/chunk-WXXVCSCN.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/types.ts"],"sourcesContent":["import type { JSONSchema4, JSONSchema6, JSONSchema7 } from 'json-schema';\nimport type { OpenAPIV2, OpenAPIV3, OpenAPIV3_1 } from 'openapi-types';\n\nimport {\n isOpenAPI30 as assertOpenAPI30,\n isOpenAPI31 as assertOpenAPI31,\n isSwagger as assertSwagger,\n} from '@readme/openapi-parser/lib/assertions';\n\nexport type JSONSchema = JSONSchema4 | JSONSchema6 | JSONSchema7;\n\n/**\n * @param check Data to determine if it contains a ReferenceObject (`$ref` pointer`).\n * @returns If the supplied data has a `$ref` pointer.\n */\nexport function isRef(check: unknown): check is OpenAPIV3_1.ReferenceObject | OpenAPIV3.ReferenceObject {\n return typeof (check as OpenAPIV3_1.ReferenceObject | OpenAPIV3.ReferenceObject)?.$ref === 'string';\n}\n\n/**\n * Is a given object a Swagger API definition?\n *\n */\nexport const isSwagger: (schema: any) => schema is OpenAPIV2.Document = assertSwagger;\n\n/**\n * Is a given object an OpenAPI 3.0 API definition?\n *\n */\nexport const isOpenAPI30: (schema: any) => schema is OpenAPIV3.Document = assertOpenAPI30;\n\n/**\n * Is a given object an OpenAPI 3.1 API definition?\n *\n */\nexport const isOpenAPI31: (schema: any) => schema is OpenAPIV3_1.Document = assertOpenAPI31;\n\n/**\n * Data shape for taking OpenAPI operation data and converting it into HAR.\n *\n * @see {@link https://github.com/readmeio/oas/tree/main/packages/oas-to-har}\n */\nexport interface DataForHAR {\n body?: any;\n cookie?: Record<string, any>;\n formData?: Record<string, any>; // `application/x-www-form-urlencoded` requests payloads.\n header?: Record<string, any>;\n path?: Record<string, any>;\n query?: Record<string, any>;\n server?: {\n selected: number;\n variables?: ServerVariable;\n };\n}\n\nexport type AuthForHAR = Record<string, number | string | { pass?: string; user?: string }>;\n\nexport interface User {\n [key: string]: unknown;\n keys?: {\n [key: string]: unknown;\n name: number | string;\n pass?: number | string;\n user?: number | string;\n }[];\n}\n\n/**\n * The type of security scheme. Used by `operation.getSecurityWithTypes()` and `operation.prepareSecurity()`.\n */\nexport type SecurityType = 'apiKey' | 'Basic' | 'Bearer' | 'Cookie' | 'Header' | 'http' | 'OAuth2' | 'Query';\n\nexport type HttpMethods =\n | OpenAPIV3_1.HttpMethods\n | OpenAPIV3.HttpMethods\n | 'delete'\n | 'get'\n | 'head'\n | 'options'\n | 'patch'\n | 'post'\n | 'put'\n | 'trace';\n\n// The following are custom OpenAPI types that we use throughout this library, sans\n// `ReferenceObject` because we assume that the API definition has been dereferenced.\n//\n// These are organized by how they're defined in the OpenAPI Specification.\n\n/**\n * @see {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#openapi-object}\n * @see {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#openapi-object}\n */\nexport type OASDocument = (OpenAPIV3_1.Document | OpenAPIV3.Document) &\n // `x-*` extensions\n Record<string, unknown>;\n\nexport type OAS31Document = OpenAPIV3_1.Document &\n // `x-*` extensions\n Record<string, unknown>;\n\n/**\n * @see {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#server-object}\n * @see {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#server-object}\n */\nexport type ServerObject = OpenAPIV3_1.ServerObject | OpenAPIV3.ServerObject;\n\n/**\n * @see {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#server-variable-object}\n * @see {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#server-variable-object}\n */\nexport type ServerVariableObject = OpenAPIV3_1.ServerVariableObject | OpenAPIV3.ServerVariableObject;\nexport type ServerVariablesObject = Record<string, ServerVariableObject>;\nexport type ServerVariable = Record<\n string,\n { default?: number | string }[] | Record<string, never> | number | string | { default?: number | string }\n>;\n\nexport interface Servers {\n selected: number;\n variables: ServerVariable;\n}\n\n/**\n * @see {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#components-object}\n * @see {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#components-object}\n */\nexport type ComponentsObject = OpenAPIV3_1.ComponentsObject | OpenAPIV3.ComponentsObject;\n\n/**\n * @see {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#reference-object}\n * @see {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#reference-object}\n */\nexport type ReferenceObject = OpenAPIV3_1.ReferenceObject | OpenAPIV3.ReferenceObject;\n\n/**\n * @see {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#paths-object}\n * @see {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#paths-object}\n */\nexport type PathsObject = OpenAPIV3_1.PathsObject | OpenAPIV3.PathsObject;\n\n/**\n * @see {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#path-item-object}\n * @see {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#path-item-object}\n */\nexport type PathItemObject = OpenAPIV3_1.PathItemObject | OpenAPIV3.PathItemObject;\n\n/**\n * @see {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#operation-object}\n * @see {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#operation-object}\n */\nexport type OperationObject = (OpenAPIV3_1.OperationObject | OpenAPIV3.OperationObject) &\n // `x-*` extensions\n Record<string, unknown>;\n\n/**\n * @see {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#parameter-object}\n * @see {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#parameter-object}\n */\nexport type ParameterObject = {\n in: 'cookie' | 'header' | 'path' | 'query';\n} & (OpenAPIV3_1.ParameterObject | OpenAPIV3.ParameterObject);\n\n/**\n * @see {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#request-body-object}\n * @see {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#request-body-object}\n */\nexport type RequestBodyObject = OpenAPIV3_1.RequestBodyObject | OpenAPIV3.RequestBodyObject;\n\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 */\nexport type MediaTypeObject = OpenAPIV3_1.MediaTypeObject | OpenAPIV3.MediaTypeObject;\n\n/**\n * @see {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#response-object}\n * @see {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#response-object}\n */\nexport type ResponseObject = OpenAPIV3_1.ResponseObject | OpenAPIV3.ResponseObject;\n\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 */\nexport type CallbackObject = OpenAPIV3_1.CallbackObject | OpenAPIV3.CallbackObject;\n\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.3.md#example-object}\n */\nexport type ExampleObject = OpenAPIV3_1.ExampleObject | OpenAPIV3.ExampleObject;\n\n/**\n * @see {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#tag-object}\n * @see {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#tag-object}\n */\nexport type TagObject = OpenAPIV3_1.TagObject | OpenAPIV3.TagObject;\n\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.0.md#header-object}\n */\nexport type HeaderObject = OpenAPIV3_1.HeaderObject | OpenAPIV3.HeaderObject;\n\n/**\n * @see {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#schema-object}\n * @see {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#schema-object}\n */\nexport type SchemaObject = {\n // OpenAPI-specific properties\n externalDocs?: unknown;\n xml?: unknown;\n} & {\n // TODO: We should split this into one type for v3 and one type for v3.1 to ensure type accuracy.\n $schema?: string;\n\n // We add this to the schema to help out with circular refs\n components?: OpenAPIV3_1.ComponentsObject;\n\n deprecated?: boolean;\n example?: unknown;\n examples?: unknown[];\n nullable?: boolean;\n readOnly?: boolean;\n writeOnly?: boolean;\n\n // `discriminator` comes through in `OpenAPIV3.SchemaObject` but because we also union this type\n // to `JSONSchema` TS gets confused when we narrow types everywhere and doens't pick up valid\n // `discriminator` types when we need them.\n discriminator?: DiscriminatorObject;\n\n // We add this extension within our dereferencing work to preserve the origin dereferenced\n // schemas.\n 'x-readme-ref-name'?: string;\n} & (\n | OpenAPIV3.SchemaObject\n | OpenAPIV3_1.SchemaObject\n // Adding `JSONSchema` to this because `json-schema-merge-allof` expects those.\n | JSONSchema\n );\n\nexport interface SchemaWrapper {\n $schema?: string;\n description?: string;\n label?: string;\n schema: SchemaObject;\n type: string;\n}\n\n/**\n * @param check JSON Schema object to determine if it's a non-polymorphic schema.\n * @param isPolymorphicAllOfChild If this JSON Schema object is the child of a polymorphic `allOf`.\n * @returns If the JSON Schema object is a JSON Schema object.\n */\nexport function isSchema(check: unknown, isPolymorphicAllOfChild = false): check is SchemaObject {\n return (\n (check as SchemaObject).type !== undefined ||\n (check as SchemaObject).allOf !== undefined ||\n (check as SchemaObject).anyOf !== undefined ||\n (check as SchemaObject).oneOf !== undefined ||\n isPolymorphicAllOfChild\n );\n}\n\n/**\n * @see {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#security-scheme-object}\n * @see {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#security-scheme-object}\n */\nexport type SecuritySchemeObject = OpenAPIV3_1.SecuritySchemeObject | OpenAPIV3.SecuritySchemeObject;\n\nexport type SecuritySchemesObject = Record<string, SecuritySchemeObject>;\n\nexport type KeyedSecuritySchemeObject = SecuritySchemeObject & {\n /**\n * The key for the given security scheme object\n */\n _key: string;\n\n /**\n * An array of required scopes for the given security scheme object.\n * Used for `oauth2` security scheme types.\n */\n _requirements?: string[];\n\n // `x-default` is our custom extension for specifying auth defaults.\n // https://docs.readme.com/docs/openapi-extensions#authentication-defaults\n 'x-default'?: number | string;\n};\n\n/**\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 */\nexport type SecurityRequirementObject = OpenAPIV3_1.SecurityRequirementObject | OpenAPIV3.SecurityRequirementObject;\n\n/**\n * @see {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#discriminator-object}\n * @see {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#discriminator-object}\n */\nexport type DiscriminatorObject = OpenAPIV3.DiscriminatorObject | OpenAPIV3_1.DiscriminatorObject;\n\n/**\n * Mapping of discriminator schema names to their child schema names.\n * Used to pass information between the pre-dereference and post-dereference phases.\n */\nexport type DiscriminatorChildrenMap = Map<string, string[]>;\n"],"mappings":";AAGA;AAAA,EACE,eAAe;AAAA,EACf,eAAe;AAAA,EACf,aAAa;AAAA,OACR;AAQA,SAAS,MAAM,OAAkF;AACtG,SAAO,OAAQ,OAAmE,SAAS;AAC7F;AAMO,IAAM,YAA2D;AAMjE,IAAM,cAA6D;AAMnE,IAAM,cAA+D;AA4NrE,SAAS,SAAS,OAAgB,0BAA0B,OAA8B;AAC/F,SACG,MAAuB,SAAS,UAChC,MAAuB,UAAU,UACjC,MAAuB,UAAU,UACjC,MAAuB,UAAU,UAClC;AAEJ;","names":[]}
1
+ {"version":3,"sources":["../src/types.ts"],"sourcesContent":["import type { JSONSchema4, JSONSchema6, JSONSchema7 } from 'json-schema';\nimport type { OpenAPIV2, OpenAPIV3, OpenAPIV3_1 } from 'openapi-types';\n\nimport {\n isOpenAPI30 as assertOpenAPI30,\n isOpenAPI31 as assertOpenAPI31,\n isSwagger as assertSwagger,\n} from '@readme/openapi-parser/lib/assertions';\n\nexport type JSONSchema = JSONSchema4 | JSONSchema6 | JSONSchema7;\n\n/**\n * @param check Data to determine if it contains a ReferenceObject (`$ref` pointer`).\n * @returns If the supplied data has a `$ref` pointer.\n */\nexport function isRef(check: unknown): check is OpenAPIV3_1.ReferenceObject | OpenAPIV3.ReferenceObject {\n return typeof (check as OpenAPIV3_1.ReferenceObject | OpenAPIV3.ReferenceObject)?.$ref === 'string';\n}\n\n/**\n * Is a given object a Swagger API definition?\n *\n */\nexport const isSwagger: (schema: any) => schema is OpenAPIV2.Document = assertSwagger;\n\n/**\n * Is a given object an OpenAPI 3.0 API definition?\n *\n */\nexport const isOpenAPI30: (schema: any) => schema is OpenAPIV3.Document = assertOpenAPI30;\n\n/**\n * Is a given object an OpenAPI 3.1 API definition?\n *\n */\nexport const isOpenAPI31: (schema: any) => schema is OpenAPIV3_1.Document = assertOpenAPI31;\n\n/**\n * Data shape for taking OpenAPI operation data and converting it into HAR.\n *\n * @see {@link https://github.com/readmeio/oas/tree/main/packages/oas-to-har}\n */\nexport interface DataForHAR {\n body?: any;\n cookie?: Record<string, any>;\n formData?: Record<string, any>; // `application/x-www-form-urlencoded` requests payloads.\n header?: Record<string, any>;\n path?: Record<string, any>;\n query?: Record<string, any>;\n server?: {\n selected: number;\n variables?: ServerVariable;\n };\n}\n\nexport type AuthForHAR = Record<string, number | string | { pass?: string; user?: string }>;\n\nexport interface User {\n [key: string]: unknown;\n keys?: {\n [key: string]: unknown;\n name: number | string;\n pass?: number | string;\n user?: number | string;\n }[];\n}\n\n/**\n * The type of security scheme. Used by `operation.getSecurityWithTypes()` and `operation.prepareSecurity()`.\n */\nexport type SecurityType = 'apiKey' | 'Basic' | 'Bearer' | 'Cookie' | 'Header' | 'http' | 'OAuth2' | 'Query';\n\nexport type HttpMethods =\n | OpenAPIV3_1.HttpMethods\n | OpenAPIV3.HttpMethods\n | 'delete'\n | 'get'\n | 'head'\n | 'options'\n | 'patch'\n | 'post'\n | 'put'\n | 'trace';\n\n// The following are custom OpenAPI types that we use throughout this library, sans\n// `ReferenceObject` because we assume that the API definition has been dereferenced.\n//\n// These are organized by how they're defined in the OpenAPI Specification.\n\n/**\n * @see {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#openapi-object}\n * @see {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#openapi-object}\n */\nexport type OASDocument = (OpenAPIV3_1.Document | OpenAPIV3.Document) &\n // `x-*` extensions\n Record<string, unknown>;\n\nexport type OAS31Document = OpenAPIV3_1.Document &\n // `x-*` extensions\n Record<string, unknown>;\n\n/**\n * @see {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#server-object}\n * @see {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#server-object}\n */\nexport type ServerObject = OpenAPIV3_1.ServerObject | OpenAPIV3.ServerObject;\n\n/**\n * @see {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#server-variable-object}\n * @see {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#server-variable-object}\n */\nexport type ServerVariableObject = OpenAPIV3_1.ServerVariableObject | OpenAPIV3.ServerVariableObject;\nexport type ServerVariablesObject = Record<string, ServerVariableObject>;\nexport type ServerVariable = Record<\n string,\n { default?: number | string }[] | Record<string, never> | number | string | { default?: number | string }\n>;\n\nexport interface Servers {\n selected: number;\n variables: ServerVariable;\n}\n\n/**\n * @see {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#components-object}\n * @see {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#components-object}\n */\nexport type ComponentsObject = OpenAPIV3_1.ComponentsObject | OpenAPIV3.ComponentsObject;\n\n/**\n * @see {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#reference-object}\n * @see {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#reference-object}\n */\nexport type ReferenceObject = OpenAPIV3_1.ReferenceObject | OpenAPIV3.ReferenceObject;\n\n/**\n * @see {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#paths-object}\n * @see {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#paths-object}\n */\nexport type PathsObject = OpenAPIV3_1.PathsObject | OpenAPIV3.PathsObject;\n\n/**\n * @see {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#path-item-object}\n * @see {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#path-item-object}\n */\nexport type PathItemObject = OpenAPIV3_1.PathItemObject | OpenAPIV3.PathItemObject;\n\n/**\n * @see {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#operation-object}\n * @see {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#operation-object}\n */\nexport type OperationObject = (OpenAPIV3_1.OperationObject | OpenAPIV3.OperationObject) &\n // `x-*` extensions\n Record<string, unknown>;\n\n/**\n * @see {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#parameter-object}\n * @see {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#parameter-object}\n */\nexport type ParameterObject = {\n in: 'cookie' | 'header' | 'path' | 'query';\n} & (OpenAPIV3_1.ParameterObject | OpenAPIV3.ParameterObject);\n\n/**\n * @see {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#request-body-object}\n * @see {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#request-body-object}\n */\nexport type RequestBodyObject = OpenAPIV3_1.RequestBodyObject | OpenAPIV3.RequestBodyObject;\n\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 */\nexport type MediaTypeObject = OpenAPIV3_1.MediaTypeObject | OpenAPIV3.MediaTypeObject;\n\n/**\n * @see {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#response-object}\n * @see {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#response-object}\n */\nexport type ResponseObject = OpenAPIV3_1.ResponseObject | OpenAPIV3.ResponseObject;\n\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 */\nexport type CallbackObject = OpenAPIV3_1.CallbackObject | OpenAPIV3.CallbackObject;\n\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.3.md#example-object}\n */\nexport type ExampleObject = OpenAPIV3_1.ExampleObject | OpenAPIV3.ExampleObject;\n\n/**\n * @see {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#tag-object}\n * @see {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#tag-object}\n */\nexport type TagObject = OpenAPIV3_1.TagObject | OpenAPIV3.TagObject;\n\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.0.md#header-object}\n */\nexport type HeaderObject = OpenAPIV3_1.HeaderObject | OpenAPIV3.HeaderObject;\n\n/**\n * @see {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#schema-object}\n * @see {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#schema-object}\n */\nexport type SchemaObject = {\n // OpenAPI-specific properties\n externalDocs?: unknown;\n xml?: unknown;\n} & {\n // TODO: We should split this into one type for v3 and one type for v3.1 to ensure type accuracy.\n $schema?: string;\n\n // We add this to the schema to help out with circular refs\n components?: OpenAPIV3_1.ComponentsObject;\n\n deprecated?: boolean;\n example?: unknown;\n examples?: unknown[];\n nullable?: boolean;\n readOnly?: boolean;\n writeOnly?: boolean;\n\n // `discriminator` comes through in `OpenAPIV3.SchemaObject` but because we also union this type\n // to `JSONSchema` TS gets confused when we narrow types everywhere and doens't pick up valid\n // `discriminator` types when we need them.\n discriminator?: DiscriminatorObject;\n\n // We add this extension within our dereferencing work to preserve the origin dereferenced\n // schemas.\n 'x-readme-ref-name'?: string;\n} & (\n | OpenAPIV3.SchemaObject\n | OpenAPIV3_1.SchemaObject\n // Adding `JSONSchema` to this because `json-schema-merge-allof` expects those.\n | JSONSchema\n );\n\nexport interface SchemaWrapper {\n $schema?: string;\n description?: string;\n label?: string;\n schema: SchemaObject;\n type: string;\n}\n\n/**\n * Determine if a given JSON Schema object is a valid JSON Schema object and either has a declared\n * `type` or is polymorphic in one form or another.\n *\n * @param check JSON Schema object to determine if it's a non-polymorphic schema.\n * @param isPolymorphicAllOfChild If this JSON Schema object is the child of a polymorphic `allOf`.\n * @returns If the JSON Schema object is a JSON Schema object.\n */\nexport function isSchema(check: unknown, isPolymorphicAllOfChild = false): check is SchemaObject {\n return (\n (check as SchemaObject).type !== undefined ||\n (check as SchemaObject).allOf !== undefined ||\n (check as SchemaObject).anyOf !== undefined ||\n (check as SchemaObject).oneOf !== undefined ||\n isPolymorphicAllOfChild\n );\n}\n\n/**\n * @see {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#security-scheme-object}\n * @see {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#security-scheme-object}\n */\nexport type SecuritySchemeObject = OpenAPIV3_1.SecuritySchemeObject | OpenAPIV3.SecuritySchemeObject;\n\nexport type SecuritySchemesObject = Record<string, SecuritySchemeObject>;\n\nexport type KeyedSecuritySchemeObject = SecuritySchemeObject & {\n /**\n * The key for the given security scheme object\n */\n _key: string;\n\n /**\n * An array of required scopes for the given security scheme object.\n * Used for `oauth2` security scheme types.\n */\n _requirements?: string[];\n\n // `x-default` is our custom extension for specifying auth defaults.\n // https://docs.readme.com/docs/openapi-extensions#authentication-defaults\n 'x-default'?: number | string;\n};\n\n/**\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 */\nexport type SecurityRequirementObject = OpenAPIV3_1.SecurityRequirementObject | OpenAPIV3.SecurityRequirementObject;\n\n/**\n * @see {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#discriminator-object}\n * @see {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#discriminator-object}\n */\nexport type DiscriminatorObject = OpenAPIV3.DiscriminatorObject | OpenAPIV3_1.DiscriminatorObject;\n\n/**\n * Mapping of discriminator schema names to their child schema names.\n * Used to pass information between the pre-dereference and post-dereference phases.\n */\nexport type DiscriminatorChildrenMap = Map<string, string[]>;\n"],"mappings":";AAGA;AAAA,EACE,eAAe;AAAA,EACf,eAAe;AAAA,EACf,aAAa;AAAA,OACR;AAQA,SAAS,MAAM,OAAkF;AACtG,SAAO,OAAQ,OAAmE,SAAS;AAC7F;AAMO,IAAM,YAA2D;AAMjE,IAAM,cAA6D;AAMnE,IAAM,cAA+D;AA+NrE,SAAS,SAAS,OAAgB,0BAA0B,OAA8B;AAC/F,SACG,MAAuB,SAAS,UAChC,MAAuB,UAAU,UACjC,MAAuB,UAAU,UACjC,MAAuB,UAAU,UAClC;AAEJ;","names":[]}
@@ -6,7 +6,7 @@ var _chunkAYA3UT4Lcjs = require('./chunk-AYA3UT4L.cjs');
6
6
 
7
7
 
8
8
 
9
- var _chunkYPR7YTHMcjs = require('./chunk-YPR7YTHM.cjs');
9
+ var _chunk3MTU2ESPcjs = require('./chunk-3MTU2ESP.cjs');
10
10
 
11
11
  // src/lib/matches-mimetype.ts
12
12
  function matchesMediaType(types2, mediaType) {
@@ -118,7 +118,7 @@ function dereferenceRef(value, definition, seenRefs = /* @__PURE__ */ new Set())
118
118
  if (value === void 0) {
119
119
  return void 0;
120
120
  }
121
- if (_chunkYPR7YTHMcjs.isRef.call(void 0, value)) {
121
+ if (_chunk3MTU2ESPcjs.isRef.call(void 0, value)) {
122
122
  if (!definition) {
123
123
  return value;
124
124
  }
@@ -129,7 +129,7 @@ function dereferenceRef(value, definition, seenRefs = /* @__PURE__ */ new Set())
129
129
  seenRefs.add(ref);
130
130
  try {
131
131
  const dereferenced = findRef(ref, definition);
132
- if (_chunkYPR7YTHMcjs.isRef.call(void 0, dereferenced)) {
132
+ if (_chunk3MTU2ESPcjs.isRef.call(void 0, dereferenced)) {
133
133
  return dereferenceRef(dereferenced, definition, seenRefs);
134
134
  }
135
135
  return {
@@ -141,6 +141,24 @@ function dereferenceRef(value, definition, seenRefs = /* @__PURE__ */ new Set())
141
141
  }
142
142
  return value;
143
143
  }
144
+ function dereferenceRefDeep(value, definition, seenRefs = /* @__PURE__ */ new Set()) {
145
+ if (value === null || value === void 0) return value;
146
+ if (typeof value !== "object") return value;
147
+ if (_chunk3MTU2ESPcjs.isRef.call(void 0, value)) {
148
+ if (!definition) return value;
149
+ const resolved = dereferenceRef(value, definition, seenRefs);
150
+ if (_chunk3MTU2ESPcjs.isRef.call(void 0, resolved)) return resolved;
151
+ return dereferenceRefDeep(resolved, definition, seenRefs);
152
+ }
153
+ if (Array.isArray(value)) {
154
+ return value.map((entry) => dereferenceRefDeep(entry, definition, seenRefs));
155
+ }
156
+ const out = {};
157
+ for (const key of Object.keys(value)) {
158
+ out[key] = dereferenceRefDeep(value[key], definition, seenRefs);
159
+ }
160
+ return out;
161
+ }
144
162
  function getDereferencingOptions(circularRefs) {
145
163
  return {
146
164
  resolve: {
@@ -162,7 +180,7 @@ function collectRefsInSchema(schema) {
162
180
  const refs = /* @__PURE__ */ new Set();
163
181
  if (!schema || typeof schema !== "object") return refs;
164
182
  const obj = schema;
165
- if (_chunkYPR7YTHMcjs.isRef.call(void 0, obj)) {
183
+ if (_chunk3MTU2ESPcjs.isRef.call(void 0, obj)) {
166
184
  refs.add(obj.$ref);
167
185
  }
168
186
  for (const value of Object.values(obj)) {
@@ -298,7 +316,7 @@ function allOfReferencesSchema(schema, targetSchemaName) {
298
316
  if (!schema || typeof schema !== "object") return false;
299
317
  if (!("allOf" in schema) || !Array.isArray(schema.allOf)) return false;
300
318
  return schema.allOf.some((item) => {
301
- if (_chunkYPR7YTHMcjs.isRef.call(void 0, item)) {
319
+ if (_chunk3MTU2ESPcjs.isRef.call(void 0, item)) {
302
320
  const refParts = item.$ref.split("/");
303
321
  const refSchemaName = refParts[refParts.length - 1];
304
322
  return refSchemaName === targetSchemaName;
@@ -400,12 +418,41 @@ var UNSUPPORTED_SCHEMA_PROPS = [
400
418
  "externalDocs",
401
419
  "xml"
402
420
  ];
421
+ var mergeAllOfSchemasOptions = {
422
+ ignoreAdditionalProperties: true,
423
+ resolvers: {
424
+ // `merge-json-schema-allof` by default takes the first `description` when you're merging an
425
+ // `allOf` but because generally when you're merging two schemas together with an `allOf` you
426
+ // want data in the subsequent schemas to be applied to the first and `description` should be a
427
+ // part of that.
428
+ description: (obj) => {
429
+ return obj.slice(-1)[0];
430
+ },
431
+ // `merge-json-schema-allof` doesn't support merging enum arrays but since that's a safe and
432
+ // simple operation as enums always contain primitives we can handle it ourselves with a custom
433
+ // resolver. We intersect the arrays so that child schemas can narrow a parent's broad enum
434
+ // (e.g. [1,2,20,50] ∩ [1] = [1]).
435
+ //
436
+ // We unfortunately need to cast our return value as `any[]` because the internal types of
437
+ // `merge-json-schema-allof`'s `enum` resolver are not portable.
438
+ enum: (obj) => {
439
+ const arrays = obj;
440
+ const intersection = arrays.reduce((acc, e) => acc.filter((v) => e.includes(v)));
441
+ return intersection.length > 0 ? intersection : arrays.reduce((acc, e) => acc.concat(e), []);
442
+ },
443
+ // For any unknown keywords (e.g., `example`, `format`, `x-readme-ref-name`), we fallback to
444
+ // using the `title` resolver (which uses the first value found).
445
+ // https://github.com/mokkabonna/json-schema-merge-allof/blob/ea2e48ee34415022de5a50c236eb4793a943ad11/src/index.js#L292
446
+ // https://github.com/mokkabonna/json-schema-merge-allof/blob/ea2e48ee34415022de5a50c236eb4793a943ad11/README.md?plain=1#L147
447
+ defaultResolver: _jsonschemamergeallof2.default.options.resolvers.title
448
+ }
449
+ };
403
450
  var PENDING_SCHEMA = { __pending: true };
404
451
  function isPendingSchema(s) {
405
452
  return isObject(s) && "__pending" in s && s.__pending === true;
406
453
  }
407
454
  function getSchemaVersionString(schema, api) {
408
- if (_chunkYPR7YTHMcjs.isOpenAPI30.call(void 0, api)) {
455
+ if (_chunk3MTU2ESPcjs.isOpenAPI30.call(void 0, api)) {
409
456
  return "http://json-schema.org/draft-04/schema#";
410
457
  }
411
458
  if (schema.$schema) {
@@ -419,6 +466,14 @@ function getSchemaVersionString(schema, api) {
419
466
  function isPolymorphicSchema(schema) {
420
467
  return "allOf" in schema || "anyOf" in schema || "oneOf" in schema;
421
468
  }
469
+ function shouldFoldParentItemsIntoPolymorphBranch(item) {
470
+ if (!isObject(item)) return false;
471
+ if (_chunk3MTU2ESPcjs.isRef.call(void 0, item)) return true;
472
+ const branch = item;
473
+ if (!("type" in branch) || branch.type === void 0) return true;
474
+ if (!hasSchemaType(branch, "array")) return false;
475
+ return !("items" in branch) || branch.items === void 0;
476
+ }
422
477
  function isEmptyPolymorphicSchema(list) {
423
478
  if (!Array.isArray(list)) return false;
424
479
  if (!list.length) return true;
@@ -428,14 +483,18 @@ function isEmptyPolymorphicSchema(list) {
428
483
  return Array.isArray(branch) ? !branch.length : !Object.keys(branch).length;
429
484
  });
430
485
  }
431
- function inlinePropertyRefsForMerge(schema, usedSchemas) {
486
+ function inlinePropertyRefsForMerge(schema, usedSchemas, refLogger) {
432
487
  const out = structuredClone(schema);
433
488
  if (!("properties" in out) || typeof out.properties !== "object" || out.properties === null) {
434
489
  return out;
435
490
  }
436
491
  for (const key of Object.keys(out.properties)) {
437
492
  const val = out.properties[key];
438
- if (_chunkYPR7YTHMcjs.isRef.call(void 0, val)) {
493
+ if (_chunk3MTU2ESPcjs.isRef.call(void 0, val)) {
494
+ if (val.$ref.startsWith("#/paths/")) {
495
+ refLogger(val.$ref, "ref");
496
+ continue;
497
+ }
439
498
  const resolved = usedSchemas.get(val.$ref);
440
499
  if (resolved !== void 0 && !isPendingSchema(resolved)) {
441
500
  out.properties[key] = {
@@ -465,7 +524,7 @@ function resolveAndCacheRefSchema({
465
524
  if (_optionalChain([refsEmittedAsStub, 'optionalAccess', _18 => _18.has, 'call', _19 => _19(ref)])) {
466
525
  return { $ref: ref };
467
526
  }
468
- if (!_chunkYPR7YTHMcjs.isRef.call(void 0, existing)) {
527
+ if (!_chunk3MTU2ESPcjs.isRef.call(void 0, existing)) {
469
528
  return structuredClone(existing);
470
529
  }
471
530
  return { $ref: ref };
@@ -479,7 +538,7 @@ function resolveAndCacheRefSchema({
479
538
  let resolved;
480
539
  try {
481
540
  const dereferenced = dereferenceRef(schema, definition, seenRefs);
482
- if (_chunkYPR7YTHMcjs.isRef.call(void 0, dereferenced)) {
541
+ if (_chunk3MTU2ESPcjs.isRef.call(void 0, dereferenced)) {
483
542
  refLogger(dereferenced.$ref, "ref");
484
543
  let converted2;
485
544
  try {
@@ -513,7 +572,7 @@ function resolveAndCacheRefSchema({
513
572
  }
514
573
  try {
515
574
  const dereferenced = dereferenceRef(schema, definition, seenRefs);
516
- if (_chunkYPR7YTHMcjs.isRef.call(void 0, dereferenced)) {
575
+ if (_chunk3MTU2ESPcjs.isRef.call(void 0, dereferenced)) {
517
576
  let converted2;
518
577
  try {
519
578
  const pointer = ref.startsWith("#") ? decodeURIComponent(ref.substring(1)) : ref;
@@ -542,7 +601,7 @@ function isRequestBodySchema(schema) {
542
601
  }
543
602
  function searchForValueByPropAndPointer(property, pointer, schemas = []) {
544
603
  if (!schemas.length || !pointer.length) {
545
- return void 0;
604
+ return;
546
605
  }
547
606
  const locSplit = pointer.split("/").filter(Boolean).reverse();
548
607
  const pointers = [];
@@ -584,7 +643,7 @@ function searchForValueByPropAndPointer(property, pointer, schemas = []) {
584
643
  }
585
644
  function toJSONSchema(data, opts) {
586
645
  let schema = data === true ? {} : { ...data };
587
- const schemaAdditionalProperties = _chunkYPR7YTHMcjs.isSchema.call(void 0, schema) ? schema.additionalProperties : null;
646
+ const schemaAdditionalProperties = _chunk3MTU2ESPcjs.isSchema.call(void 0, schema) ? schema.additionalProperties : null;
588
647
  const {
589
648
  addEnumsToDescriptions,
590
649
  currentLocation,
@@ -629,7 +688,7 @@ function toJSONSchema(data, opts) {
629
688
  usedSchemas,
630
689
  refsEmittedAsStub
631
690
  };
632
- if (_chunkYPR7YTHMcjs.isRef.call(void 0, schema)) {
691
+ if (_chunk3MTU2ESPcjs.isRef.call(void 0, schema)) {
633
692
  if (definition && usedSchemas) {
634
693
  const resolved = resolveAndCacheRefSchema({
635
694
  schema,
@@ -649,16 +708,45 @@ function toJSONSchema(data, opts) {
649
708
  refLogger(schema.$ref, "ref");
650
709
  return schema;
651
710
  }
652
- if (_chunkYPR7YTHMcjs.isSchema.call(void 0, schema, isPolymorphicAllOfChild)) {
711
+ if (_chunk3MTU2ESPcjs.isSchema.call(void 0, schema, isPolymorphicAllOfChild)) {
653
712
  if ("allOf" in schema && Array.isArray(schema.allOf)) {
713
+ if ("properties" in schema && schema.properties !== void 0 && typeof schema.properties === "object" && schema.properties !== null && !Array.isArray(schema.properties)) {
714
+ const preprocessed = {};
715
+ for (const prop of Object.keys(schema.properties)) {
716
+ const val = schema.properties[prop];
717
+ if (Array.isArray(val) || typeof val === "object" && val !== null) {
718
+ preprocessed[prop] = toJSONSchema(val, {
719
+ ...polyOptions,
720
+ currentLocation: `${currentLocation}/${encodePointer(prop)}`,
721
+ prevDefaultSchemas,
722
+ prevExampleSchemas
723
+ });
724
+ } else {
725
+ preprocessed[prop] = val;
726
+ }
727
+ }
728
+ schema = { ...schema, properties: preprocessed };
729
+ }
654
730
  let allOfSchemas = schema.allOf;
655
731
  if (definition && usedSchemas) {
656
- const allOfOptions = schema.allOf.length > 1 ? { ...polyOptions, refLogger: () => {
732
+ const allOfOptions = allOfSchemas.length > 1 ? { ...polyOptions, refLogger: () => {
657
733
  } } : polyOptions;
658
- allOfSchemas = schema.allOf.map((item) => {
659
- if (_chunkYPR7YTHMcjs.isRef.call(void 0, item)) {
660
- return resolveAndCacheRefSchema({
661
- schema: item,
734
+ allOfSchemas = allOfSchemas.map((item) => {
735
+ if (_chunk3MTU2ESPcjs.isRef.call(void 0, item)) {
736
+ if (Object.keys(item).length === 1) {
737
+ return resolveAndCacheRefSchema({
738
+ schema: item,
739
+ definition,
740
+ usedSchemas,
741
+ seenRefs,
742
+ conversionOptions: allOfOptions,
743
+ returnMode: "converted",
744
+ refLogger
745
+ });
746
+ }
747
+ const { $ref, ...siblings } = item;
748
+ const resolved = resolveAndCacheRefSchema({
749
+ schema: { $ref },
662
750
  definition,
663
751
  usedSchemas,
664
752
  seenRefs,
@@ -666,45 +754,29 @@ function toJSONSchema(data, opts) {
666
754
  returnMode: "converted",
667
755
  refLogger
668
756
  });
757
+ if (!Object.keys(siblings).length) {
758
+ return resolved;
759
+ }
760
+ const siblingSchema = toJSONSchema(siblings, allOfOptions);
761
+ try {
762
+ return _jsonschemamergeallof2.default.call(void 0,
763
+ { allOf: [resolved, siblingSchema] },
764
+ mergeAllOfSchemasOptions
765
+ );
766
+ } catch (e8) {
767
+ return resolved;
768
+ }
669
769
  }
670
770
  return toJSONSchema(item, allOfOptions);
671
771
  });
672
772
  schema = {
673
773
  ...schema,
674
- allOf: allOfSchemas.map((s) => inlinePropertyRefsForMerge(s, usedSchemas))
774
+ allOf: allOfSchemas.map((s) => inlinePropertyRefsForMerge(s, usedSchemas, refLogger))
675
775
  };
676
776
  }
677
777
  try {
678
- schema = _jsonschemamergeallof2.default.call(void 0, schema, {
679
- ignoreAdditionalProperties: true,
680
- resolvers: {
681
- // `merge-json-schema-allof` by default takes the first `description` when you're
682
- // merging an `allOf` but because generally when you're merging two schemas together
683
- // with an `allOf` you want data in the subsequent schemas to be applied to the first
684
- // and `description` should be a part of that.
685
- description: (obj) => {
686
- return obj.slice(-1)[0];
687
- },
688
- // `merge-json-schema-allof` doesn't support merging enum arrays but since that's a
689
- // safe and simple operation as enums always contain primitives we can handle it
690
- // ourselves with a custom resolver. We intersect the arrays so that child schemas
691
- // can narrow a parent's broad enum (e.g. [1,2,20,50] ∩ [1] = [1]).
692
- //
693
- // We unfortunately need to cast our return value as `any[]` because the internal types
694
- // of `merge-json-schema-allof`'s `enum` resolver are not portable.
695
- enum: (obj) => {
696
- const arrays = obj;
697
- const intersection = arrays.reduce((acc, e) => acc.filter((v) => e.includes(v)));
698
- return intersection.length > 0 ? intersection : arrays.reduce((acc, e) => acc.concat(e), []);
699
- },
700
- // for any unknown keywords (e.g., `example`, `format`, `x-readme-ref-name`),
701
- // we fallback to using the title resolver (which uses the first value found).
702
- // https://github.com/mokkabonna/json-schema-merge-allof/blob/ea2e48ee34415022de5a50c236eb4793a943ad11/src/index.js#L292
703
- // https://github.com/mokkabonna/json-schema-merge-allof/blob/ea2e48ee34415022de5a50c236eb4793a943ad11/README.md?plain=1#L147
704
- defaultResolver: _jsonschemamergeallof2.default.options.resolvers.title
705
- }
706
- });
707
- } catch (e8) {
778
+ schema = _jsonschemamergeallof2.default.call(void 0, schema, mergeAllOfSchemasOptions);
779
+ } catch (e9) {
708
780
  const { ...schemaWithoutAllOf } = schema;
709
781
  schema = schemaWithoutAllOf;
710
782
  delete schema.allOf;
@@ -712,7 +784,7 @@ function toJSONSchema(data, opts) {
712
784
  collectRefsInSchema(schema).forEach((ref) => {
713
785
  refLogger(ref, "ref");
714
786
  });
715
- if (_chunkYPR7YTHMcjs.isRef.call(void 0, schema)) {
787
+ if (_chunk3MTU2ESPcjs.isRef.call(void 0, schema)) {
716
788
  refLogger(schema.$ref, "ref");
717
789
  return schema;
718
790
  }
@@ -737,12 +809,16 @@ function toJSONSchema(data, opts) {
737
809
  itemOptions
738
810
  );
739
811
  } else if ("items" in schema) {
740
- schema[polyType][idx] = toJSONSchema(
741
- {
742
- allOf: [item, { items: schema.items }]
743
- },
744
- itemOptions
745
- );
812
+ if (shouldFoldParentItemsIntoPolymorphBranch(item)) {
813
+ schema[polyType][idx] = toJSONSchema(
814
+ {
815
+ allOf: [item, { items: schema.items }]
816
+ },
817
+ itemOptions
818
+ );
819
+ } else {
820
+ schema[polyType][idx] = toJSONSchema(item, itemOptions);
821
+ }
746
822
  } else {
747
823
  schema[polyType][idx] = toJSONSchema(item, itemOptions);
748
824
  }
@@ -766,7 +842,7 @@ function toJSONSchema(data, opts) {
766
842
  delete childSchema.anyOf;
767
843
  }
768
844
  }
769
- if (definition && usedSchemas && _chunkYPR7YTHMcjs.isRef.call(void 0, childSchema)) {
845
+ if (definition && usedSchemas && _chunk3MTU2ESPcjs.isRef.call(void 0, childSchema)) {
770
846
  const resolved = usedSchemas.get(childSchema.$ref);
771
847
  if (resolved && typeof resolved === "object" && !isPendingSchema(resolved)) {
772
848
  if ("discriminator" in resolved) {
@@ -887,7 +963,7 @@ function toJSONSchema(data, opts) {
887
963
  }
888
964
  }
889
965
  }
890
- if (_chunkYPR7YTHMcjs.isSchema.call(void 0, schema, isPolymorphicAllOfChild)) {
966
+ if (_chunk3MTU2ESPcjs.isSchema.call(void 0, schema, isPolymorphicAllOfChild)) {
891
967
  if ("default" in schema && isObject(schema.default)) {
892
968
  prevDefaultSchemas.push({ default: schema.default });
893
969
  }
@@ -911,7 +987,7 @@ function toJSONSchema(data, opts) {
911
987
  let currentExample = example;
912
988
  if (name === "$ref") {
913
989
  currentExample = dereferenceRef({ $ref: currentExample }, definition, seenRefs);
914
- if (!currentExample || _chunkYPR7YTHMcjs.isRef.call(void 0, currentExample)) {
990
+ if (!currentExample || _chunk3MTU2ESPcjs.isRef.call(void 0, currentExample)) {
915
991
  refLogger(currentExample.$ref, "ref");
916
992
  return;
917
993
  }
@@ -951,7 +1027,7 @@ function toJSONSchema(data, opts) {
951
1027
  }
952
1028
  if (hasSchemaType(schema, "array")) {
953
1029
  if ("items" in schema && schema.items !== void 0) {
954
- if (!(definition && usedSchemas) && !Array.isArray(schema.items) && Object.keys(schema.items).length === 1 && _chunkYPR7YTHMcjs.isRef.call(void 0, schema.items)) {
1030
+ if (!(definition && usedSchemas) && !Array.isArray(schema.items) && Object.keys(schema.items).length === 1 && _chunk3MTU2ESPcjs.isRef.call(void 0, schema.items)) {
955
1031
  refLogger(schema.items.$ref, "ref");
956
1032
  } else if (schema.items !== true) {
957
1033
  schema.items = toJSONSchema(schema.items, {
@@ -1027,13 +1103,13 @@ function toJSONSchema(data, opts) {
1027
1103
  }
1028
1104
  }
1029
1105
  }
1030
- if (_chunkYPR7YTHMcjs.isSchema.call(void 0, schema, isPolymorphicAllOfChild) && globalDefaults && Object.keys(globalDefaults).length > 0 && currentLocation) {
1106
+ if (_chunk3MTU2ESPcjs.isSchema.call(void 0, schema, isPolymorphicAllOfChild) && globalDefaults && Object.keys(globalDefaults).length > 0 && currentLocation) {
1031
1107
  try {
1032
1108
  const userJwtDefault = _jsonpointer2.default.get(globalDefaults, currentLocation);
1033
1109
  if (userJwtDefault) {
1034
1110
  schema.default = userJwtDefault;
1035
1111
  }
1036
- } catch (e9) {
1112
+ } catch (e10) {
1037
1113
  }
1038
1114
  }
1039
1115
  if ("default" in schema && typeof schema.default !== "undefined") {
@@ -1049,7 +1125,7 @@ function toJSONSchema(data, opts) {
1049
1125
  schema.default = foundDefault;
1050
1126
  }
1051
1127
  }
1052
- if (_chunkYPR7YTHMcjs.isSchema.call(void 0, schema, isPolymorphicAllOfChild) && "enum" in schema && Array.isArray(schema.enum)) {
1128
+ if (_chunk3MTU2ESPcjs.isSchema.call(void 0, schema, isPolymorphicAllOfChild) && "enum" in schema && Array.isArray(schema.enum)) {
1053
1129
  schema.enum = Array.from(new Set(schema.enum));
1054
1130
  if (addEnumsToDescriptions) {
1055
1131
  const enums = schema.enum.filter((v) => v !== void 0 && (typeof v !== "string" || v.trim() !== "")).map((str) => `\`${str}\``).join(" ");
@@ -1087,6 +1163,9 @@ ${enums}`;
1087
1163
  }
1088
1164
  if ("items" in schema) {
1089
1165
  delete schema.items;
1166
+ if ("type" in schema && schema.type === "array") {
1167
+ delete schema.type;
1168
+ }
1090
1169
  }
1091
1170
  }
1092
1171
  }
@@ -1154,10 +1233,10 @@ function getParametersAsJSONSchema(operation, api, opts) {
1154
1233
  prevExampleSchemas.push({
1155
1234
  examples: Object.values(mediaTypeObject.examples || {}).map((ex) => {
1156
1235
  let example = ex;
1157
- if (!example) return void 0;
1158
- if (_chunkYPR7YTHMcjs.isRef.call(void 0, example)) {
1236
+ if (!example) return;
1237
+ if (_chunk3MTU2ESPcjs.isRef.call(void 0, example)) {
1159
1238
  example = dereferenceRef(example, operation.api);
1160
- if (!example || _chunkYPR7YTHMcjs.isRef.call(void 0, example)) return void 0;
1239
+ if (!example || _chunk3MTU2ESPcjs.isRef.call(void 0, example)) return;
1161
1240
  }
1162
1241
  return example.value;
1163
1242
  }).filter((item) => item !== void 0)
@@ -1284,7 +1363,7 @@ function getParametersAsJSONSchema(operation, api, opts) {
1284
1363
  }
1285
1364
  try {
1286
1365
  const resolved = dereferenceRef({ $ref: ref }, api, seenRefs);
1287
- if (_chunkYPR7YTHMcjs.isRef.call(void 0, resolved)) return void 0;
1366
+ if (_chunk3MTU2ESPcjs.isRef.call(void 0, resolved)) return;
1288
1367
  const converted = toJSONSchema(structuredClone(resolved), {
1289
1368
  ...baseSchemaOptions,
1290
1369
  usedSchemas,
@@ -1292,12 +1371,15 @@ function getParametersAsJSONSchema(operation, api, opts) {
1292
1371
  });
1293
1372
  usedSchemas.set(ref, converted);
1294
1373
  return converted;
1295
- } catch (e10) {
1296
- return void 0;
1374
+ } catch (e11) {
1297
1375
  }
1298
1376
  });
1377
+ const refsInOutput = collectRefsInSchema(group.schema);
1299
1378
  const refsInGroup = _nullishCoalesce(refsByGroup.get(group.type), () => ( /* @__PURE__ */ new Set()));
1300
- const referencedSchemas = filterRequiredRefsToReferenced(refsInGroup, usedSchemas);
1379
+ const referencedSchemas = filterRequiredRefsToReferenced(
1380
+ /* @__PURE__ */ new Set([...refsInGroup, ...refsInOutput]),
1381
+ usedSchemas
1382
+ );
1301
1383
  if (referencedSchemas.size > 0) {
1302
1384
  mergeReferencedSchemasIntoRoot(group.schema, referencedSchemas);
1303
1385
  }
@@ -1331,5 +1413,7 @@ var SERVER_VARIABLE_REGEX = /{([-_a-zA-Z0-9:.[\]]+)}/g;
1331
1413
 
1332
1414
 
1333
1415
 
1334
- exports.isObject = isObject; exports.isPrimitive = isPrimitive; exports.decorateComponentSchemasWithRefName = decorateComponentSchemasWithRefName; exports.decodePointer = decodePointer; exports.dereferenceRef = dereferenceRef; exports.getDereferencingOptions = getDereferencingOptions; exports.filterRequiredRefsToReferenced = filterRequiredRefsToReferenced; exports.mergeReferencedSchemasIntoRoot = mergeReferencedSchemasIntoRoot; exports.matches_mimetype_default = matches_mimetype_default; exports.getParameterContentType = getParameterContentType; exports.cloneObject = cloneObject; exports.applyDiscriminatorOneOfToUsedSchemas = applyDiscriminatorOneOfToUsedSchemas; exports.getSchemaVersionString = getSchemaVersionString; exports.toJSONSchema = toJSONSchema; exports.types = types; exports.getParametersAsJSONSchema = getParametersAsJSONSchema; exports.supportedMethods = supportedMethods; exports.SERVER_VARIABLE_REGEX = SERVER_VARIABLE_REGEX;
1335
- //# sourceMappingURL=chunk-HTEFBV7K.cjs.map
1416
+
1417
+
1418
+ exports.isObject = isObject; exports.isPrimitive = isPrimitive; exports.decorateComponentSchemasWithRefName = decorateComponentSchemasWithRefName; exports.decodePointer = decodePointer; exports.dereferenceRef = dereferenceRef; exports.dereferenceRefDeep = dereferenceRefDeep; exports.getDereferencingOptions = getDereferencingOptions; exports.collectRefsInSchema = collectRefsInSchema; exports.filterRequiredRefsToReferenced = filterRequiredRefsToReferenced; exports.mergeReferencedSchemasIntoRoot = mergeReferencedSchemasIntoRoot; exports.matches_mimetype_default = matches_mimetype_default; exports.getParameterContentType = getParameterContentType; exports.cloneObject = cloneObject; exports.applyDiscriminatorOneOfToUsedSchemas = applyDiscriminatorOneOfToUsedSchemas; exports.getSchemaVersionString = getSchemaVersionString; exports.toJSONSchema = toJSONSchema; exports.types = types; exports.getParametersAsJSONSchema = getParametersAsJSONSchema; exports.supportedMethods = supportedMethods; exports.SERVER_VARIABLE_REGEX = SERVER_VARIABLE_REGEX;
1419
+ //# sourceMappingURL=chunk-SAB2PGCD.cjs.map