@skmtc/core 0.29.0 → 0.31.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.
- package/esm/_dnt.polyfills.d.ts +11 -0
- package/esm/_dnt.polyfills.js +14 -0
- package/esm/context/ParseContext.js +9 -1
- package/esm/context/generateTypes.d.ts +14 -2
- package/esm/context/generateTypes.js +5 -1
- package/esm/dsl/GeneratorKeys.d.ts +2 -2
- package/esm/dsl/GeneratorKeys.js +6 -3
- package/esm/helpers/naming.d.ts +2 -1
- package/esm/helpers/naming.js +4 -2
- package/esm/mod.d.ts +1 -0
- package/esm/mod.js +1 -0
- package/esm/oas/discriminator/Discriminator.d.ts +3 -0
- package/esm/oas/discriminator/Discriminator.js +7 -0
- package/esm/oas/document/Document.d.ts +7 -0
- package/esm/oas/document/Document.js +8 -0
- package/esm/oas/example/Example.d.ts +10 -1
- package/esm/oas/example/Example.js +16 -0
- package/esm/oas/header/Header.d.ts +4 -2
- package/esm/oas/header/Header.js +12 -5
- package/esm/oas/mediaType/MediaType.d.ts +12 -0
- package/esm/oas/mediaType/MediaType.js +24 -0
- package/esm/oas/mediaType/jsonMediaType.d.ts +50 -0
- package/esm/oas/mediaType/jsonMediaType.js +64 -0
- package/esm/oas/mediaType/toContentSchema.d.ts +8 -0
- package/esm/oas/mediaType/toContentSchema.js +6 -0
- package/esm/oas/operation/Operation.d.ts +10 -2
- package/esm/oas/operation/Operation.js +20 -7
- package/esm/oas/parameter/Parameter.d.ts +3 -2
- package/esm/oas/parameter/Parameter.js +11 -5
- package/esm/oas/parameter/parameter-types.d.ts +10 -2
- package/esm/oas/parameter/parameter-types.js +3 -1
- package/esm/oas/requestBody/RequestBody.d.ts +11 -0
- package/esm/oas/requestBody/RequestBody.js +16 -2
- package/esm/oas/response/Response.d.ts +17 -1
- package/esm/oas/response/Response.js +24 -2
- package/esm/oas/securitySchemes/SecurityScheme.d.ts +47 -4
- package/esm/oas/securitySchemes/SecurityScheme.js +46 -1
- package/esm/oas/securitySchemes/security-scheme-types.d.ts +21 -0
- package/esm/oas/server/Server.d.ts +8 -2
- package/esm/oas/server/Server.js +10 -1
- package/esm/oas/tag/Tag.d.ts +9 -0
- package/esm/oas/tag/Tag.js +9 -0
- package/esm/oas/webhook/Webhook.d.ts +4 -4
- package/esm/oas/webhook/Webhook.js +6 -6
- package/esm/parse/logBodyMediaTypes.d.ts +27 -0
- package/esm/parse/logBodyMediaTypes.js +50 -0
- package/esm/parse/toOasDialect.d.ts +8 -7
- package/esm/parse/toOasDialect.js +4 -2
- package/esm/parse/v3-0/methods.d.ts +11 -0
- package/esm/parse/v3-0/methods.js +16 -0
- package/esm/parse/v3-0/operation/toOperationsV3.js +5 -5
- package/esm/parse/v3-0/parameter/toParameterV3.d.ts +4 -2
- package/esm/parse/v3-0/parameter/toParameterV3.js +17 -3
- package/esm/parse/v3-0/requestBody/toRequestBodiesV3.js +4 -1
- package/esm/parse/v3-0/response/toResponseV3.js +4 -1
- package/esm/parse/v3-0/securitySchemes/toSecuritySchemes.js +50 -38
- package/esm/parse/v3-0/webhook/toWebhooksV3.js +5 -5
- package/esm/parse/v3-1/methods.d.ts +11 -0
- package/esm/parse/v3-1/methods.js +16 -0
- package/esm/parse/v3-1/operation/toOperationsV3.js +5 -5
- package/esm/parse/v3-1/parameter/toParameterV3.d.ts +4 -2
- package/esm/parse/v3-1/parameter/toParameterV3.js +17 -3
- package/esm/parse/v3-1/requestBody/toRequestBodiesV3.js +4 -1
- package/esm/parse/v3-1/response/toResponseV3.js +4 -1
- package/esm/parse/v3-1/securitySchemes/toSecuritySchemes.js +50 -38
- package/esm/parse/v3-1/webhook/toWebhooksV3.js +5 -5
- package/esm/parse/v3-2/_helpers/parseDefault.d.ts +43 -0
- package/esm/parse/v3-2/_helpers/parseDefault.js +39 -0
- package/esm/parse/v3-2/_helpers/parseEnum.d.ts +13 -0
- package/esm/parse/v3-2/_helpers/parseEnum.js +23 -0
- package/esm/parse/v3-2/_helpers/parseExample.d.ts +41 -0
- package/esm/parse/v3-2/_helpers/parseExample.js +37 -0
- package/esm/parse/v3-2/_helpers/parseNullable.d.ts +141 -0
- package/esm/parse/v3-2/_helpers/parseNullable.js +140 -0
- package/esm/parse/v3-2/_merge-all-of/check-array-item-type-conflicts.d.ts +2 -0
- package/esm/parse/v3-2/_merge-all-of/check-array-item-type-conflicts.js +9 -0
- package/esm/parse/v3-2/_merge-all-of/check-at-least-one-type-match.d.ts +4 -0
- package/esm/parse/v3-2/_merge-all-of/check-at-least-one-type-match.js +5 -0
- package/esm/parse/v3-2/_merge-all-of/check-enum-conflicts.d.ts +2 -0
- package/esm/parse/v3-2/_merge-all-of/check-enum-conflicts.js +11 -0
- package/esm/parse/v3-2/_merge-all-of/check-format-conflicts.d.ts +2 -0
- package/esm/parse/v3-2/_merge-all-of/check-format-conflicts.js +5 -0
- package/esm/parse/v3-2/_merge-all-of/check-number-constraints-conflicts.d.ts +2 -0
- package/esm/parse/v3-2/_merge-all-of/check-number-constraints-conflicts.js +11 -0
- package/esm/parse/v3-2/_merge-all-of/check-read-only-write-only-conflicts.d.ts +2 -0
- package/esm/parse/v3-2/_merge-all-of/check-read-only-write-only-conflicts.js +5 -0
- package/esm/parse/v3-2/_merge-all-of/check-type-conflicts.d.ts +2 -0
- package/esm/parse/v3-2/_merge-all-of/check-type-conflicts.js +5 -0
- package/esm/parse/v3-2/_merge-all-of/cross-product.d.ts +2 -0
- package/esm/parse/v3-2/_merge-all-of/cross-product.js +3 -0
- package/esm/parse/v3-2/_merge-all-of/decompose-intersection.d.ts +6 -0
- package/esm/parse/v3-2/_merge-all-of/decompose-intersection.js +27 -0
- package/esm/parse/v3-2/_merge-all-of/decompose-union.d.ts +12 -0
- package/esm/parse/v3-2/_merge-all-of/decompose-union.js +69 -0
- package/esm/parse/v3-2/_merge-all-of/generic-merge.d.ts +3 -0
- package/esm/parse/v3-2/_merge-all-of/generic-merge.js +12 -0
- package/esm/parse/v3-2/_merge-all-of/is-equal.d.ts +1 -0
- package/esm/parse/v3-2/_merge-all-of/is-equal.js +19 -0
- package/esm/parse/v3-2/_merge-all-of/merge-array-constraints.d.ts +2 -0
- package/esm/parse/v3-2/_merge-all-of/merge-array-constraints.js +44 -0
- package/esm/parse/v3-2/_merge-all-of/merge-boolean-constraints.d.ts +3 -0
- package/esm/parse/v3-2/_merge-all-of/merge-boolean-constraints.js +7 -0
- package/esm/parse/v3-2/_merge-all-of/merge-enum-values.d.ts +3 -0
- package/esm/parse/v3-2/_merge-all-of/merge-enum-values.js +32 -0
- package/esm/parse/v3-2/_merge-all-of/merge-integer-constraints.d.ts +3 -0
- package/esm/parse/v3-2/_merge-all-of/merge-integer-constraints.js +41 -0
- package/esm/parse/v3-2/_merge-all-of/merge-intersection.d.ts +8 -0
- package/esm/parse/v3-2/_merge-all-of/merge-intersection.js +16 -0
- package/esm/parse/v3-2/_merge-all-of/merge-number-constraints.d.ts +3 -0
- package/esm/parse/v3-2/_merge-all-of/merge-number-constraints.js +41 -0
- package/esm/parse/v3-2/_merge-all-of/merge-object-constraints.d.ts +5 -0
- package/esm/parse/v3-2/_merge-all-of/merge-object-constraints.js +28 -0
- package/esm/parse/v3-2/_merge-all-of/merge-properties.d.ts +2 -0
- package/esm/parse/v3-2/_merge-all-of/merge-properties.js +25 -0
- package/esm/parse/v3-2/_merge-all-of/merge-required.d.ts +3 -0
- package/esm/parse/v3-2/_merge-all-of/merge-required.js +10 -0
- package/esm/parse/v3-2/_merge-all-of/merge-string-constraints.d.ts +3 -0
- package/esm/parse/v3-2/_merge-all-of/merge-string-constraints.js +55 -0
- package/esm/parse/v3-2/_merge-all-of/merge-union.d.ts +15 -0
- package/esm/parse/v3-2/_merge-all-of/merge-union.js +53 -0
- package/esm/parse/v3-2/_merge-all-of/merge.d.ts +2 -0
- package/esm/parse/v3-2/_merge-all-of/merge.js +155 -0
- package/esm/parse/v3-2/_merge-all-of/nullable-merge.d.ts +3 -0
- package/esm/parse/v3-2/_merge-all-of/nullable-merge.js +12 -0
- package/esm/parse/v3-2/_merge-all-of/types.d.ts +14 -0
- package/esm/parse/v3-2/_merge-all-of/types.js +2 -0
- package/esm/parse/v3-2/array/toArray.d.ts +80 -0
- package/esm/parse/v3-2/array/toArray.js +165 -0
- package/esm/parse/v3-2/boolean/toBoolean.d.ts +78 -0
- package/esm/parse/v3-2/boolean/toBoolean.js +139 -0
- package/esm/parse/v3-2/components/toComponentsV3.d.ts +14 -0
- package/esm/parse/v3-2/components/toComponentsV3.js +43 -0
- package/esm/parse/v3-2/contact/toContactV3.d.ts +5 -0
- package/esm/parse/v3-2/contact/toContactV3.js +18 -0
- package/esm/parse/v3-2/discriminator/toDiscriminatorV3.d.ts +14 -0
- package/esm/parse/v3-2/discriminator/toDiscriminatorV3.js +21 -0
- package/esm/parse/v3-2/document/toDocumentFieldsV3.d.ts +16 -0
- package/esm/parse/v3-2/document/toDocumentFieldsV3.js +33 -0
- package/esm/parse/v3-2/example/toExamplesV3.d.ts +77 -0
- package/esm/parse/v3-2/example/toExamplesV3.js +143 -0
- package/esm/parse/v3-2/externalDocs/toExternalDocs.d.ts +10 -0
- package/esm/parse/v3-2/externalDocs/toExternalDocs.js +15 -0
- package/esm/parse/v3-2/header/toHeadersV3.d.ts +18 -0
- package/esm/parse/v3-2/header/toHeadersV3.js +47 -0
- package/esm/parse/v3-2/info/toInfoV3.d.ts +10 -0
- package/esm/parse/v3-2/info/toInfoV3.js +23 -0
- package/esm/parse/v3-2/integer/toInteger.d.ts +21 -0
- package/esm/parse/v3-2/integer/toInteger.js +115 -0
- package/esm/parse/v3-2/license/toLicenseV3.d.ts +5 -0
- package/esm/parse/v3-2/license/toLicenseV3.js +17 -0
- package/esm/parse/v3-2/link/toLinksV3.d.ts +16 -0
- package/esm/parse/v3-2/link/toLinksV3.js +40 -0
- package/esm/parse/v3-2/mediaType/toMediaTypeItemV3.d.ts +323 -0
- package/esm/parse/v3-2/mediaType/toMediaTypeItemV3.js +375 -0
- package/esm/parse/v3-2/methods.d.ts +17 -0
- package/esm/parse/v3-2/methods.js +21 -0
- package/esm/parse/v3-2/number/toNumber.d.ts +10 -0
- package/esm/parse/v3-2/number/toNumber.js +115 -0
- package/esm/parse/v3-2/object/toAdditionalPropertiesV3.d.ts +11 -0
- package/esm/parse/v3-2/object/toAdditionalPropertiesV3.js +10 -0
- package/esm/parse/v3-2/object/toObject.d.ts +10 -0
- package/esm/parse/v3-2/object/toObject.js +90 -0
- package/esm/parse/v3-2/operation/toOperationsV3.d.ts +25 -0
- package/esm/parse/v3-2/operation/toOperationsV3.js +129 -0
- package/esm/parse/v3-2/parameter/toParameterV3.d.ts +39 -0
- package/esm/parse/v3-2/parameter/toParameterV3.js +152 -0
- package/esm/parse/v3-2/parameter/warnQuerystringConflictsV3.d.ts +22 -0
- package/esm/parse/v3-2/parameter/warnQuerystringConflictsV3.js +39 -0
- package/esm/parse/v3-2/pathItem/dropAdditionalOperationsV3.d.ts +17 -0
- package/esm/parse/v3-2/pathItem/dropAdditionalOperationsV3.js +34 -0
- package/esm/parse/v3-2/pathItem/toPathItemV3.d.ts +23 -0
- package/esm/parse/v3-2/pathItem/toPathItemV3.js +45 -0
- package/esm/parse/v3-2/ref/toRefV31.d.ts +19 -0
- package/esm/parse/v3-2/ref/toRefV31.js +10 -0
- package/esm/parse/v3-2/requestBody/toRequestBodiesV3.d.ts +18 -0
- package/esm/parse/v3-2/requestBody/toRequestBodiesV3.js +47 -0
- package/esm/parse/v3-2/response/toResponseV3.d.ts +29 -0
- package/esm/parse/v3-2/response/toResponseV3.js +59 -0
- package/esm/parse/v3-2/schema/toSchemasV3.d.ts +29 -0
- package/esm/parse/v3-2/schema/toSchemasV3.js +511 -0
- package/esm/parse/v3-2/securityRequirement/toSecurityRequirement.d.ts +9 -0
- package/esm/parse/v3-2/securityRequirement/toSecurityRequirement.js +9 -0
- package/esm/parse/v3-2/securitySchemes/toSecuritySchemes.d.ts +17 -0
- package/esm/parse/v3-2/securitySchemes/toSecuritySchemes.js +152 -0
- package/esm/parse/v3-2/server/toServerV3.d.ts +26 -0
- package/esm/parse/v3-2/server/toServerV3.js +31 -0
- package/esm/parse/v3-2/serverVariable/toServerVariableV3.d.ts +22 -0
- package/esm/parse/v3-2/serverVariable/toServerVariableV3.js +30 -0
- package/esm/parse/v3-2/specificationExtensions/toSpecificationExtensionsV3.d.ts +14 -0
- package/esm/parse/v3-2/specificationExtensions/toSpecificationExtensionsV3.js +25 -0
- package/esm/parse/v3-2/string/toString.d.ts +146 -0
- package/esm/parse/v3-2/string/toString.js +211 -0
- package/esm/parse/v3-2/tag/toTagsV3.d.ts +22 -0
- package/esm/parse/v3-2/tag/toTagsV3.js +78 -0
- package/esm/parse/v3-2/union/toUnion.d.ts +12 -0
- package/esm/parse/v3-2/union/toUnion.js +68 -0
- package/esm/parse/v3-2/unknown/toUnknown.d.ts +10 -0
- package/esm/parse/v3-2/unknown/toUnknown.js +19 -0
- package/esm/parse/v3-2/webhook/toWebhooksV3.d.ts +48 -0
- package/esm/parse/v3-2/webhook/toWebhooksV3.js +139 -0
- package/esm/types/Method.d.ts +7 -4
- package/esm/types/Method.js +17 -4
- package/esm/types/Preview.d.ts +2 -1
- package/esm/types/SkmtcDocument.d.ts +6 -6
- package/package.json +1 -1
- package/script/_dnt.polyfills.d.ts +11 -0
- package/script/_dnt.polyfills.js +14 -0
- package/script/context/ParseContext.js +9 -1
- package/script/context/generateTypes.d.ts +14 -2
- package/script/context/generateTypes.js +5 -1
- package/script/dsl/GeneratorKeys.d.ts +2 -2
- package/script/dsl/GeneratorKeys.js +6 -3
- package/script/helpers/naming.d.ts +2 -1
- package/script/helpers/naming.js +4 -2
- package/script/mod.d.ts +1 -0
- package/script/mod.js +1 -0
- package/script/oas/discriminator/Discriminator.d.ts +3 -0
- package/script/oas/discriminator/Discriminator.js +7 -0
- package/script/oas/document/Document.d.ts +7 -0
- package/script/oas/document/Document.js +8 -0
- package/script/oas/example/Example.d.ts +10 -1
- package/script/oas/example/Example.js +16 -0
- package/script/oas/header/Header.d.ts +4 -2
- package/script/oas/header/Header.js +12 -5
- package/script/oas/mediaType/MediaType.d.ts +12 -0
- package/script/oas/mediaType/MediaType.js +24 -0
- package/script/oas/mediaType/jsonMediaType.d.ts +50 -0
- package/script/oas/mediaType/jsonMediaType.js +71 -0
- package/script/oas/mediaType/toContentSchema.d.ts +8 -0
- package/script/oas/mediaType/toContentSchema.js +10 -0
- package/script/oas/operation/Operation.d.ts +10 -2
- package/script/oas/operation/Operation.js +20 -7
- package/script/oas/parameter/Parameter.d.ts +3 -2
- package/script/oas/parameter/Parameter.js +11 -5
- package/script/oas/parameter/parameter-types.d.ts +10 -2
- package/script/oas/parameter/parameter-types.js +3 -1
- package/script/oas/requestBody/RequestBody.d.ts +11 -0
- package/script/oas/requestBody/RequestBody.js +16 -2
- package/script/oas/response/Response.d.ts +17 -1
- package/script/oas/response/Response.js +24 -2
- package/script/oas/securitySchemes/SecurityScheme.d.ts +47 -4
- package/script/oas/securitySchemes/SecurityScheme.js +46 -1
- package/script/oas/securitySchemes/security-scheme-types.d.ts +21 -0
- package/script/oas/server/Server.d.ts +8 -2
- package/script/oas/server/Server.js +10 -1
- package/script/oas/tag/Tag.d.ts +9 -0
- package/script/oas/tag/Tag.js +9 -0
- package/script/oas/webhook/Webhook.d.ts +4 -4
- package/script/oas/webhook/Webhook.js +6 -6
- package/script/parse/logBodyMediaTypes.d.ts +27 -0
- package/script/parse/logBodyMediaTypes.js +54 -0
- package/script/parse/toOasDialect.d.ts +8 -7
- package/script/parse/toOasDialect.js +4 -2
- package/script/parse/v3-0/methods.d.ts +11 -0
- package/script/parse/v3-0/methods.js +20 -0
- package/script/parse/v3-0/operation/toOperationsV3.js +5 -5
- package/script/parse/v3-0/parameter/toParameterV3.d.ts +4 -2
- package/script/parse/v3-0/parameter/toParameterV3.js +17 -3
- package/script/parse/v3-0/requestBody/toRequestBodiesV3.js +4 -1
- package/script/parse/v3-0/response/toResponseV3.js +4 -1
- package/script/parse/v3-0/securitySchemes/toSecuritySchemes.js +49 -37
- package/script/parse/v3-0/webhook/toWebhooksV3.js +5 -5
- package/script/parse/v3-1/methods.d.ts +11 -0
- package/script/parse/v3-1/methods.js +20 -0
- package/script/parse/v3-1/operation/toOperationsV3.js +5 -5
- package/script/parse/v3-1/parameter/toParameterV3.d.ts +4 -2
- package/script/parse/v3-1/parameter/toParameterV3.js +17 -3
- package/script/parse/v3-1/requestBody/toRequestBodiesV3.js +4 -1
- package/script/parse/v3-1/response/toResponseV3.js +4 -1
- package/script/parse/v3-1/securitySchemes/toSecuritySchemes.js +49 -37
- package/script/parse/v3-1/webhook/toWebhooksV3.js +5 -5
- package/script/parse/v3-2/_helpers/parseDefault.d.ts +43 -0
- package/script/parse/v3-2/_helpers/parseDefault.js +43 -0
- package/script/parse/v3-2/_helpers/parseEnum.d.ts +13 -0
- package/script/parse/v3-2/_helpers/parseEnum.js +27 -0
- package/script/parse/v3-2/_helpers/parseExample.d.ts +41 -0
- package/script/parse/v3-2/_helpers/parseExample.js +41 -0
- package/script/parse/v3-2/_helpers/parseNullable.d.ts +141 -0
- package/script/parse/v3-2/_helpers/parseNullable.js +144 -0
- package/script/parse/v3-2/_merge-all-of/check-array-item-type-conflicts.d.ts +2 -0
- package/script/parse/v3-2/_merge-all-of/check-array-item-type-conflicts.js +13 -0
- package/script/parse/v3-2/_merge-all-of/check-at-least-one-type-match.d.ts +4 -0
- package/script/parse/v3-2/_merge-all-of/check-at-least-one-type-match.js +9 -0
- package/script/parse/v3-2/_merge-all-of/check-enum-conflicts.d.ts +2 -0
- package/script/parse/v3-2/_merge-all-of/check-enum-conflicts.js +15 -0
- package/script/parse/v3-2/_merge-all-of/check-format-conflicts.d.ts +2 -0
- package/script/parse/v3-2/_merge-all-of/check-format-conflicts.js +9 -0
- package/script/parse/v3-2/_merge-all-of/check-number-constraints-conflicts.d.ts +2 -0
- package/script/parse/v3-2/_merge-all-of/check-number-constraints-conflicts.js +15 -0
- package/script/parse/v3-2/_merge-all-of/check-read-only-write-only-conflicts.d.ts +2 -0
- package/script/parse/v3-2/_merge-all-of/check-read-only-write-only-conflicts.js +9 -0
- package/script/parse/v3-2/_merge-all-of/check-type-conflicts.d.ts +2 -0
- package/script/parse/v3-2/_merge-all-of/check-type-conflicts.js +9 -0
- package/script/parse/v3-2/_merge-all-of/cross-product.d.ts +2 -0
- package/script/parse/v3-2/_merge-all-of/cross-product.js +7 -0
- package/script/parse/v3-2/_merge-all-of/decompose-intersection.d.ts +6 -0
- package/script/parse/v3-2/_merge-all-of/decompose-intersection.js +31 -0
- package/script/parse/v3-2/_merge-all-of/decompose-union.d.ts +12 -0
- package/script/parse/v3-2/_merge-all-of/decompose-union.js +73 -0
- package/script/parse/v3-2/_merge-all-of/generic-merge.d.ts +3 -0
- package/script/parse/v3-2/_merge-all-of/generic-merge.js +16 -0
- package/script/parse/v3-2/_merge-all-of/is-equal.d.ts +1 -0
- package/script/parse/v3-2/_merge-all-of/is-equal.js +23 -0
- package/script/parse/v3-2/_merge-all-of/merge-array-constraints.d.ts +2 -0
- package/script/parse/v3-2/_merge-all-of/merge-array-constraints.js +80 -0
- package/script/parse/v3-2/_merge-all-of/merge-boolean-constraints.d.ts +3 -0
- package/script/parse/v3-2/_merge-all-of/merge-boolean-constraints.js +43 -0
- package/script/parse/v3-2/_merge-all-of/merge-enum-values.d.ts +3 -0
- package/script/parse/v3-2/_merge-all-of/merge-enum-values.js +68 -0
- package/script/parse/v3-2/_merge-all-of/merge-integer-constraints.d.ts +3 -0
- package/script/parse/v3-2/_merge-all-of/merge-integer-constraints.js +77 -0
- package/script/parse/v3-2/_merge-all-of/merge-intersection.d.ts +8 -0
- package/script/parse/v3-2/_merge-all-of/merge-intersection.js +20 -0
- package/script/parse/v3-2/_merge-all-of/merge-number-constraints.d.ts +3 -0
- package/script/parse/v3-2/_merge-all-of/merge-number-constraints.js +77 -0
- package/script/parse/v3-2/_merge-all-of/merge-object-constraints.d.ts +5 -0
- package/script/parse/v3-2/_merge-all-of/merge-object-constraints.js +65 -0
- package/script/parse/v3-2/_merge-all-of/merge-properties.d.ts +2 -0
- package/script/parse/v3-2/_merge-all-of/merge-properties.js +29 -0
- package/script/parse/v3-2/_merge-all-of/merge-required.d.ts +3 -0
- package/script/parse/v3-2/_merge-all-of/merge-required.js +15 -0
- package/script/parse/v3-2/_merge-all-of/merge-string-constraints.d.ts +3 -0
- package/script/parse/v3-2/_merge-all-of/merge-string-constraints.js +91 -0
- package/script/parse/v3-2/_merge-all-of/merge-union.d.ts +15 -0
- package/script/parse/v3-2/_merge-all-of/merge-union.js +58 -0
- package/script/parse/v3-2/_merge-all-of/merge.d.ts +2 -0
- package/script/parse/v3-2/_merge-all-of/merge.js +159 -0
- package/script/parse/v3-2/_merge-all-of/nullable-merge.d.ts +3 -0
- package/script/parse/v3-2/_merge-all-of/nullable-merge.js +17 -0
- package/script/parse/v3-2/_merge-all-of/types.d.ts +14 -0
- package/script/parse/v3-2/_merge-all-of/types.js +38 -0
- package/script/parse/v3-2/array/toArray.d.ts +80 -0
- package/script/parse/v3-2/array/toArray.js +203 -0
- package/script/parse/v3-2/boolean/toBoolean.d.ts +78 -0
- package/script/parse/v3-2/boolean/toBoolean.js +177 -0
- package/script/parse/v3-2/components/toComponentsV3.d.ts +14 -0
- package/script/parse/v3-2/components/toComponentsV3.js +47 -0
- package/script/parse/v3-2/contact/toContactV3.d.ts +5 -0
- package/script/parse/v3-2/contact/toContactV3.js +22 -0
- package/script/parse/v3-2/discriminator/toDiscriminatorV3.d.ts +14 -0
- package/script/parse/v3-2/discriminator/toDiscriminatorV3.js +25 -0
- package/script/parse/v3-2/document/toDocumentFieldsV3.d.ts +16 -0
- package/script/parse/v3-2/document/toDocumentFieldsV3.js +37 -0
- package/script/parse/v3-2/example/toExamplesV3.d.ts +77 -0
- package/script/parse/v3-2/example/toExamplesV3.js +149 -0
- package/script/parse/v3-2/externalDocs/toExternalDocs.d.ts +10 -0
- package/script/parse/v3-2/externalDocs/toExternalDocs.js +52 -0
- package/script/parse/v3-2/header/toHeadersV3.d.ts +18 -0
- package/script/parse/v3-2/header/toHeadersV3.js +51 -0
- package/script/parse/v3-2/info/toInfoV3.d.ts +10 -0
- package/script/parse/v3-2/info/toInfoV3.js +27 -0
- package/script/parse/v3-2/integer/toInteger.d.ts +21 -0
- package/script/parse/v3-2/integer/toInteger.js +153 -0
- package/script/parse/v3-2/license/toLicenseV3.d.ts +5 -0
- package/script/parse/v3-2/license/toLicenseV3.js +21 -0
- package/script/parse/v3-2/link/toLinksV3.d.ts +16 -0
- package/script/parse/v3-2/link/toLinksV3.js +44 -0
- package/script/parse/v3-2/mediaType/toMediaTypeItemV3.d.ts +323 -0
- package/script/parse/v3-2/mediaType/toMediaTypeItemV3.js +381 -0
- package/script/parse/v3-2/methods.d.ts +17 -0
- package/script/parse/v3-2/methods.js +25 -0
- package/script/parse/v3-2/number/toNumber.d.ts +10 -0
- package/script/parse/v3-2/number/toNumber.js +152 -0
- package/script/parse/v3-2/object/toAdditionalPropertiesV3.d.ts +11 -0
- package/script/parse/v3-2/object/toAdditionalPropertiesV3.js +14 -0
- package/script/parse/v3-2/object/toObject.d.ts +10 -0
- package/script/parse/v3-2/object/toObject.js +94 -0
- package/script/parse/v3-2/operation/toOperationsV3.d.ts +25 -0
- package/script/parse/v3-2/operation/toOperationsV3.js +134 -0
- package/script/parse/v3-2/parameter/toParameterV3.d.ts +39 -0
- package/script/parse/v3-2/parameter/toParameterV3.js +191 -0
- package/script/parse/v3-2/parameter/warnQuerystringConflictsV3.d.ts +22 -0
- package/script/parse/v3-2/parameter/warnQuerystringConflictsV3.js +43 -0
- package/script/parse/v3-2/pathItem/dropAdditionalOperationsV3.d.ts +17 -0
- package/script/parse/v3-2/pathItem/dropAdditionalOperationsV3.js +38 -0
- package/script/parse/v3-2/pathItem/toPathItemV3.d.ts +23 -0
- package/script/parse/v3-2/pathItem/toPathItemV3.js +50 -0
- package/script/parse/v3-2/ref/toRefV31.d.ts +19 -0
- package/script/parse/v3-2/ref/toRefV31.js +14 -0
- package/script/parse/v3-2/requestBody/toRequestBodiesV3.d.ts +18 -0
- package/script/parse/v3-2/requestBody/toRequestBodiesV3.js +52 -0
- package/script/parse/v3-2/response/toResponseV3.d.ts +29 -0
- package/script/parse/v3-2/response/toResponseV3.js +65 -0
- package/script/parse/v3-2/schema/toSchemasV3.d.ts +29 -0
- package/script/parse/v3-2/schema/toSchemasV3.js +518 -0
- package/script/parse/v3-2/securityRequirement/toSecurityRequirement.d.ts +9 -0
- package/script/parse/v3-2/securityRequirement/toSecurityRequirement.js +13 -0
- package/script/parse/v3-2/securitySchemes/toSecuritySchemes.d.ts +17 -0
- package/script/parse/v3-2/securitySchemes/toSecuritySchemes.js +189 -0
- package/script/parse/v3-2/server/toServerV3.d.ts +26 -0
- package/script/parse/v3-2/server/toServerV3.js +37 -0
- package/script/parse/v3-2/serverVariable/toServerVariableV3.d.ts +22 -0
- package/script/parse/v3-2/serverVariable/toServerVariableV3.js +36 -0
- package/script/parse/v3-2/specificationExtensions/toSpecificationExtensionsV3.d.ts +14 -0
- package/script/parse/v3-2/specificationExtensions/toSpecificationExtensionsV3.js +30 -0
- package/script/parse/v3-2/string/toString.d.ts +146 -0
- package/script/parse/v3-2/string/toString.js +249 -0
- package/script/parse/v3-2/tag/toTagsV3.d.ts +22 -0
- package/script/parse/v3-2/tag/toTagsV3.js +83 -0
- package/script/parse/v3-2/union/toUnion.d.ts +12 -0
- package/script/parse/v3-2/union/toUnion.js +72 -0
- package/script/parse/v3-2/unknown/toUnknown.d.ts +10 -0
- package/script/parse/v3-2/unknown/toUnknown.js +23 -0
- package/script/parse/v3-2/webhook/toWebhooksV3.d.ts +48 -0
- package/script/parse/v3-2/webhook/toWebhooksV3.js +144 -0
- package/script/types/Method.d.ts +7 -4
- package/script/types/Method.js +17 -4
- package/script/types/Preview.d.ts +2 -1
- package/script/types/SkmtcDocument.d.ts +6 -6
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { ParseContextType } from '../../../context/parseTypes.js';
|
|
2
|
+
import type { OpenAPIV3 } from 'openapi-types';
|
|
3
|
+
import { OasLink } from '../../../oas/link/Link.js';
|
|
4
|
+
import type { OasRef } from '../../../oas/ref/Ref.js';
|
|
5
|
+
import type { StackTrail } from '../../../context/StackTrail.js';
|
|
6
|
+
export type ToLinksV3Args = {
|
|
7
|
+
links: Record<string, OpenAPIV3.ReferenceObject | OpenAPIV3.LinkObject> | undefined;
|
|
8
|
+
stackTrail: StackTrail;
|
|
9
|
+
context: ParseContextType;
|
|
10
|
+
};
|
|
11
|
+
export declare const toLinksV3: ({ links, stackTrail, context }: ToLinksV3Args) => Record<string, OasLink | OasRef<"link">> | undefined;
|
|
12
|
+
export type ToLinkV3Args = {
|
|
13
|
+
link: OpenAPIV3.ReferenceObject | OpenAPIV3.LinkObject;
|
|
14
|
+
stackTrail: StackTrail;
|
|
15
|
+
context: ParseContextType;
|
|
16
|
+
};
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.toLinksV3 = void 0;
|
|
4
|
+
const toRefV31_js_1 = require("../ref/toRefV31.js");
|
|
5
|
+
const toServerV3_js_1 = require("../server/toServerV3.js");
|
|
6
|
+
const refFns_js_1 = require("../../../helpers/refFns.js");
|
|
7
|
+
const Link_js_1 = require("../../../oas/link/Link.js");
|
|
8
|
+
const toSpecificationExtensionsV3_js_1 = require("../specificationExtensions/toSpecificationExtensionsV3.js");
|
|
9
|
+
const toLinksV3 = ({ links, stackTrail, context }) => {
|
|
10
|
+
if (!links) {
|
|
11
|
+
return undefined;
|
|
12
|
+
}
|
|
13
|
+
const output = {};
|
|
14
|
+
for (const [key, value] of Object.entries(links)) {
|
|
15
|
+
output[key] = stackTrail.trace(key, st => toLinkV3({ link: value, stackTrail: st, context }));
|
|
16
|
+
}
|
|
17
|
+
return output;
|
|
18
|
+
};
|
|
19
|
+
exports.toLinksV3 = toLinksV3;
|
|
20
|
+
const toLinkV3 = ({ link, stackTrail, context }) => {
|
|
21
|
+
if ((0, refFns_js_1.isRef)(link)) {
|
|
22
|
+
return (0, toRefV31_js_1.toRefV31)({ ref: link, refType: 'link', stackTrail, context });
|
|
23
|
+
}
|
|
24
|
+
const { operationRef, operationId, parameters, requestBody, description, server, ...skipped } = link;
|
|
25
|
+
const extensionFields = (0, toSpecificationExtensionsV3_js_1.toSpecificationExtensionsV3)({
|
|
26
|
+
skipped,
|
|
27
|
+
parent: link,
|
|
28
|
+
context,
|
|
29
|
+
stackTrail,
|
|
30
|
+
parentType: 'link'
|
|
31
|
+
});
|
|
32
|
+
const fields = {
|
|
33
|
+
operationRef,
|
|
34
|
+
operationId,
|
|
35
|
+
parameters,
|
|
36
|
+
requestBody,
|
|
37
|
+
description,
|
|
38
|
+
server: server !== undefined
|
|
39
|
+
? stackTrail.trace('server', st => (0, toServerV3_js_1.toServerV3)({ server, stackTrail: st, context }))
|
|
40
|
+
: undefined,
|
|
41
|
+
extensionFields
|
|
42
|
+
};
|
|
43
|
+
return new Link_js_1.OasLink(fields);
|
|
44
|
+
};
|
|
@@ -0,0 +1,323 @@
|
|
|
1
|
+
import type { OpenAPIV3 } from 'openapi-types';
|
|
2
|
+
import type { ParseContextType } from '../../../context/parseTypes.js';
|
|
3
|
+
import { OasMediaType } from '../../../oas/mediaType/MediaType.js';
|
|
4
|
+
import type { StackTrail } from '../../../context/StackTrail.js';
|
|
5
|
+
/**
|
|
6
|
+
* An OpenAPI 3.2 Media Type Object: the 3.0/3.1 fields plus the fields for
|
|
7
|
+
* sequential and multipart array media types.
|
|
8
|
+
*/
|
|
9
|
+
export type MediaTypeObjectV32 = OpenAPIV3.MediaTypeObject & {
|
|
10
|
+
itemSchema?: OpenAPIV3.ReferenceObject | OpenAPIV3.SchemaObject;
|
|
11
|
+
prefixEncoding?: Record<string, unknown>[];
|
|
12
|
+
itemEncoding?: Record<string, unknown>;
|
|
13
|
+
};
|
|
14
|
+
/**
|
|
15
|
+
* Arguments for transforming an OpenAPI v3 media type item into an OAS media type.
|
|
16
|
+
*/
|
|
17
|
+
export type ToMediaTypeItemV3Args = {
|
|
18
|
+
/** The OpenAPI v3 media type object to transform */
|
|
19
|
+
mediaTypeItem: MediaTypeObjectV32;
|
|
20
|
+
/** The media type string (e.g., 'application/json', 'text/plain') */
|
|
21
|
+
mediaType: string;
|
|
22
|
+
/** The stack trail for tracing */
|
|
23
|
+
stackTrail: StackTrail;
|
|
24
|
+
/** The parsing context for tracing and processing */
|
|
25
|
+
context: ParseContextType;
|
|
26
|
+
};
|
|
27
|
+
/**
|
|
28
|
+
* Transforms an OpenAPI v3 media type object into an internal OAS media type representation.
|
|
29
|
+
*
|
|
30
|
+
* This function processes OpenAPI v3 MediaType objects, extracting schema definitions,
|
|
31
|
+
* examples, encoding information, and specification extensions. It creates a structured
|
|
32
|
+
* internal representation that can be used by the SKMTC pipeline for code generation
|
|
33
|
+
* and validation.
|
|
34
|
+
*
|
|
35
|
+
* The transformation handles all standard OpenAPI v3 MediaType properties including
|
|
36
|
+
* schema references, inline schemas, examples, encoding specifications, and custom
|
|
37
|
+
* extension fields that begin with 'x-'.
|
|
38
|
+
*
|
|
39
|
+
* @param args - Transformation arguments
|
|
40
|
+
* @param args.mediaTypeItem - The OpenAPI v3 media type object to process
|
|
41
|
+
* @param args.mediaType - The media type identifier (MIME type)
|
|
42
|
+
* @param args.context - Parsing context for tracing and error handling
|
|
43
|
+
* @returns Structured OAS media type object for internal processing
|
|
44
|
+
*
|
|
45
|
+
* @example Transforming JSON media type
|
|
46
|
+
* ```typescript
|
|
47
|
+
* import { toMediaTypeItemV3 } from '@skmtc/core/oas/mediaType';
|
|
48
|
+
*
|
|
49
|
+
* const jsonMediaType = {
|
|
50
|
+
* schema: {
|
|
51
|
+
* type: 'object',
|
|
52
|
+
* properties: {
|
|
53
|
+
* name: { type: 'string' },
|
|
54
|
+
* email: { type: 'string', format: 'email' }
|
|
55
|
+
* }
|
|
56
|
+
* },
|
|
57
|
+
* example: {
|
|
58
|
+
* name: 'John Doe',
|
|
59
|
+
* email: 'john@example.com'
|
|
60
|
+
* }
|
|
61
|
+
* };
|
|
62
|
+
*
|
|
63
|
+
* const result = toMediaTypeItemV3({
|
|
64
|
+
* mediaTypeItem: jsonMediaType,
|
|
65
|
+
* mediaType: 'application/json',
|
|
66
|
+
* context: parseContext
|
|
67
|
+
* });
|
|
68
|
+
*
|
|
69
|
+
* console.log(result.mediaType); // 'application/json'
|
|
70
|
+
* console.log(result.schema); // Processed schema object
|
|
71
|
+
* ```
|
|
72
|
+
*
|
|
73
|
+
* @example Processing form data with encoding
|
|
74
|
+
* ```typescript
|
|
75
|
+
* const formMediaType = {
|
|
76
|
+
* schema: {
|
|
77
|
+
* type: 'object',
|
|
78
|
+
* properties: {
|
|
79
|
+
* file: { type: 'string', format: 'binary' },
|
|
80
|
+
* metadata: { type: 'string' }
|
|
81
|
+
* }
|
|
82
|
+
* },
|
|
83
|
+
* encoding: {
|
|
84
|
+
* file: {
|
|
85
|
+
* contentType: 'image/png',
|
|
86
|
+
* headers: {
|
|
87
|
+
* 'X-Rate-Limit': {
|
|
88
|
+
* schema: { type: 'integer' }
|
|
89
|
+
* }
|
|
90
|
+
* }
|
|
91
|
+
* }
|
|
92
|
+
* }
|
|
93
|
+
* };
|
|
94
|
+
*
|
|
95
|
+
* const result = toMediaTypeItemV3({
|
|
96
|
+
* mediaTypeItem: formMediaType,
|
|
97
|
+
* mediaType: 'multipart/form-data',
|
|
98
|
+
* context: parseContext
|
|
99
|
+
* });
|
|
100
|
+
*
|
|
101
|
+
* console.log(result.encoding); // Processed encoding configuration
|
|
102
|
+
* ```
|
|
103
|
+
*
|
|
104
|
+
* @example Handling multiple examples
|
|
105
|
+
* ```typescript
|
|
106
|
+
* const mediaTypeWithExamples = {
|
|
107
|
+
* schema: { type: 'string' },
|
|
108
|
+
* examples: {
|
|
109
|
+
* success: {
|
|
110
|
+
* summary: 'Successful response',
|
|
111
|
+
* value: 'Operation completed'
|
|
112
|
+
* },
|
|
113
|
+
* error: {
|
|
114
|
+
* summary: 'Error response',
|
|
115
|
+
* value: 'Operation failed'
|
|
116
|
+
* }
|
|
117
|
+
* }
|
|
118
|
+
* };
|
|
119
|
+
*
|
|
120
|
+
* const result = toMediaTypeItemV3({
|
|
121
|
+
* mediaTypeItem: mediaTypeWithExamples,
|
|
122
|
+
* mediaType: 'text/plain',
|
|
123
|
+
* context: parseContext
|
|
124
|
+
* });
|
|
125
|
+
*
|
|
126
|
+
* console.log(Object.keys(result.examples)); // ['success', 'error']
|
|
127
|
+
* ```
|
|
128
|
+
*/
|
|
129
|
+
export declare const toMediaTypeItemV3: ({ mediaTypeItem, mediaType, stackTrail, context }: ToMediaTypeItemV3Args) => OasMediaType;
|
|
130
|
+
/**
|
|
131
|
+
* Arguments for transforming multiple OpenAPI v3 media type items.
|
|
132
|
+
*/
|
|
133
|
+
export type ToMediaTypeItemsV3Args = {
|
|
134
|
+
/** Map of media type strings to MediaType objects or `components.mediaTypes` references */
|
|
135
|
+
content: Record<string, MediaTypeObjectV32 | OpenAPIV3.ReferenceObject>;
|
|
136
|
+
/** The stack trail for tracing */
|
|
137
|
+
stackTrail: StackTrail;
|
|
138
|
+
/** The parsing context for tracing and processing */
|
|
139
|
+
context: ParseContextType;
|
|
140
|
+
};
|
|
141
|
+
/**
|
|
142
|
+
* Transforms multiple OpenAPI v3 media type objects into internal OAS representations.
|
|
143
|
+
*
|
|
144
|
+
* This function processes a complete content map from OpenAPI v3, transforming each
|
|
145
|
+
* media type entry into its internal OAS representation. It's commonly used to process
|
|
146
|
+
* the `content` property of request bodies, responses, and parameters that support
|
|
147
|
+
* multiple media types.
|
|
148
|
+
*
|
|
149
|
+
* The function maintains the original media type keys while transforming the values
|
|
150
|
+
* into structured OAS media type objects. Each transformation is traced for debugging
|
|
151
|
+
* and error tracking purposes.
|
|
152
|
+
*
|
|
153
|
+
* @param args - Transformation arguments
|
|
154
|
+
* @param args.content - Map of media types to OpenAPI MediaType objects
|
|
155
|
+
* @param args.context - Parsing context for tracing and error handling
|
|
156
|
+
* @returns Map of media type strings to processed OAS media type objects
|
|
157
|
+
*
|
|
158
|
+
* @example Processing multiple content types
|
|
159
|
+
* ```typescript
|
|
160
|
+
* import { toMediaTypeItemsV3 } from '@skmtc/core/oas/mediaType';
|
|
161
|
+
*
|
|
162
|
+
* const content = {
|
|
163
|
+
* 'application/json': {
|
|
164
|
+
* schema: {
|
|
165
|
+
* type: 'object',
|
|
166
|
+
* properties: { message: { type: 'string' } }
|
|
167
|
+
* }
|
|
168
|
+
* },
|
|
169
|
+
* 'application/xml': {
|
|
170
|
+
* schema: {
|
|
171
|
+
* type: 'string'
|
|
172
|
+
* }
|
|
173
|
+
* },
|
|
174
|
+
* 'text/plain': {
|
|
175
|
+
* schema: {
|
|
176
|
+
* type: 'string'
|
|
177
|
+
* },
|
|
178
|
+
* example: 'Plain text response'
|
|
179
|
+
* }
|
|
180
|
+
* };
|
|
181
|
+
*
|
|
182
|
+
* const result = toMediaTypeItemsV3({
|
|
183
|
+
* content,
|
|
184
|
+
* context: parseContext
|
|
185
|
+
* });
|
|
186
|
+
*
|
|
187
|
+
* console.log(Object.keys(result)); // ['application/json', 'application/xml', 'text/plain']
|
|
188
|
+
* console.log(result['application/json'].mediaType); // 'application/json'
|
|
189
|
+
* ```
|
|
190
|
+
*
|
|
191
|
+
* @example Processing request body content types
|
|
192
|
+
* ```typescript
|
|
193
|
+
* const requestBodyContent = {
|
|
194
|
+
* 'application/json': {
|
|
195
|
+
* schema: { $ref: '#/components/schemas/CreateUserRequest' }
|
|
196
|
+
* },
|
|
197
|
+
* 'application/x-www-form-urlencoded': {
|
|
198
|
+
* schema: {
|
|
199
|
+
* type: 'object',
|
|
200
|
+
* properties: {
|
|
201
|
+
* name: { type: 'string' },
|
|
202
|
+
* email: { type: 'string' }
|
|
203
|
+
* }
|
|
204
|
+
* },
|
|
205
|
+
* encoding: {
|
|
206
|
+
* email: {
|
|
207
|
+
* style: 'form',
|
|
208
|
+
* explode: false
|
|
209
|
+
* }
|
|
210
|
+
* }
|
|
211
|
+
* }
|
|
212
|
+
* };
|
|
213
|
+
*
|
|
214
|
+
* const processed = toMediaTypeItemsV3({
|
|
215
|
+
* content: requestBodyContent,
|
|
216
|
+
* context: parseContext
|
|
217
|
+
* });
|
|
218
|
+
*
|
|
219
|
+
* // Each media type is processed with its specific configuration
|
|
220
|
+
* console.log(processed['application/json'].schema); // Reference object
|
|
221
|
+
* console.log(processed['application/x-www-form-urlencoded'].encoding); // Form encoding config
|
|
222
|
+
* ```
|
|
223
|
+
*/
|
|
224
|
+
export declare const toMediaTypeItemsV3: ({ content, stackTrail, context }: ToMediaTypeItemsV3Args) => Record<string, OasMediaType>;
|
|
225
|
+
/**
|
|
226
|
+
* Arguments for optionally transforming OpenAPI v3 media type items.
|
|
227
|
+
*/
|
|
228
|
+
export type ToOptionalMediaTypeItemsV3Args = {
|
|
229
|
+
/** Optional map of media type strings to MediaType objects or `components.mediaTypes` references */
|
|
230
|
+
content: Record<string, MediaTypeObjectV32 | OpenAPIV3.ReferenceObject> | undefined;
|
|
231
|
+
/** The stack trail for tracing */
|
|
232
|
+
stackTrail: StackTrail;
|
|
233
|
+
/** The parsing context for tracing and processing */
|
|
234
|
+
context: ParseContextType;
|
|
235
|
+
};
|
|
236
|
+
/**
|
|
237
|
+
* Optionally transforms OpenAPI v3 media type objects when content is provided.
|
|
238
|
+
*
|
|
239
|
+
* This function provides a safe way to process media type content that may or may not
|
|
240
|
+
* be present in the OpenAPI specification. It handles the common pattern where content
|
|
241
|
+
* properties are optional in OpenAPI objects (like responses without bodies or
|
|
242
|
+
* operations without request bodies).
|
|
243
|
+
*
|
|
244
|
+
* When content is undefined, the function returns undefined without processing.
|
|
245
|
+
* When content is provided, it delegates to `toMediaTypeItemsV3` for full processing.
|
|
246
|
+
*
|
|
247
|
+
* @param args - Transformation arguments
|
|
248
|
+
* @param args.content - Optional map of media types to OpenAPI MediaType objects
|
|
249
|
+
* @param args.context - Parsing context for tracing and error handling
|
|
250
|
+
* @returns Map of processed media types if content exists, undefined otherwise
|
|
251
|
+
*
|
|
252
|
+
* @example Handling optional response content
|
|
253
|
+
* ```typescript
|
|
254
|
+
* import { toOptionalMediaTypeItemsV3 } from '@skmtc/core/oas/mediaType';
|
|
255
|
+
*
|
|
256
|
+
* // Response with content
|
|
257
|
+
* const responseWithContent = {
|
|
258
|
+
* description: 'Successful response',
|
|
259
|
+
* content: {
|
|
260
|
+
* 'application/json': {
|
|
261
|
+
* schema: { type: 'object' }
|
|
262
|
+
* }
|
|
263
|
+
* }
|
|
264
|
+
* };
|
|
265
|
+
*
|
|
266
|
+
* const withContent = toOptionalMediaTypeItemsV3({
|
|
267
|
+
* content: responseWithContent.content,
|
|
268
|
+
* context: parseContext
|
|
269
|
+
* });
|
|
270
|
+
* console.log(withContent); // { 'application/json': OasMediaType }
|
|
271
|
+
*
|
|
272
|
+
* // Response without content (like 204 No Content)
|
|
273
|
+
* const responseNoContent = {
|
|
274
|
+
* description: 'No content response'
|
|
275
|
+
* };
|
|
276
|
+
*
|
|
277
|
+
* const noContent = toOptionalMediaTypeItemsV3({
|
|
278
|
+
* content: responseNoContent.content, // undefined
|
|
279
|
+
* context: parseContext
|
|
280
|
+
* });
|
|
281
|
+
* console.log(noContent); // undefined
|
|
282
|
+
* ```
|
|
283
|
+
*
|
|
284
|
+
* @example Processing operations with optional request bodies
|
|
285
|
+
* ```typescript
|
|
286
|
+
* function processOperation(operation: OpenAPIV3.OperationObject) {
|
|
287
|
+
* const requestBodyContent = toOptionalMediaTypeItemsV3({
|
|
288
|
+
* content: operation.requestBody?.content,
|
|
289
|
+
* context: parseContext
|
|
290
|
+
* });
|
|
291
|
+
*
|
|
292
|
+
* if (requestBodyContent) {
|
|
293
|
+
* console.log('Operation has request body with media types:');
|
|
294
|
+
* console.log(Object.keys(requestBodyContent));
|
|
295
|
+
* } else {
|
|
296
|
+
* console.log('Operation has no request body');
|
|
297
|
+
* }
|
|
298
|
+
* }
|
|
299
|
+
* ```
|
|
300
|
+
*
|
|
301
|
+
* @example Safe processing in response handlers
|
|
302
|
+
* ```typescript
|
|
303
|
+
* class ResponseProcessor {
|
|
304
|
+
* processResponse(response: OpenAPIV3.ResponseObject) {
|
|
305
|
+
* const mediaTypes = toOptionalMediaTypeItemsV3({
|
|
306
|
+
* content: response.content,
|
|
307
|
+
* context: this.context
|
|
308
|
+
* });
|
|
309
|
+
*
|
|
310
|
+
* // Safe to check without worrying about undefined content
|
|
311
|
+
* const hasJsonResponse = mediaTypes && 'application/json' in mediaTypes;
|
|
312
|
+
*
|
|
313
|
+
* if (hasJsonResponse) {
|
|
314
|
+
* const jsonMediaType = mediaTypes['application/json'];
|
|
315
|
+
* return this.generateJsonResponseHandler(jsonMediaType);
|
|
316
|
+
* }
|
|
317
|
+
*
|
|
318
|
+
* return this.generateEmptyResponseHandler();
|
|
319
|
+
* }
|
|
320
|
+
* }
|
|
321
|
+
* ```
|
|
322
|
+
*/
|
|
323
|
+
export declare const toOptionalMediaTypeItemsV3: ({ content, stackTrail, context }: ToOptionalMediaTypeItemsV3Args) => Record<string, OasMediaType> | undefined;
|