@skmtc/core 0.28.7 → 0.30.1
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/GenerateContext.js +16 -16
- package/esm/context/ParseContext.js +9 -1
- package/esm/context/RenderContext.d.ts +7 -7
- package/esm/context/RenderContext.js +17 -12
- package/esm/context/generateTypes.d.ts +2 -2
- package/esm/context/generateTypes.js +3 -1
- package/esm/deps/jsr.io/@std/path/1.1.6/posix/is_absolute.d.ts +16 -0
- package/esm/deps/jsr.io/@std/path/1.1.6/posix/is_absolute.js +23 -0
- package/esm/deps/jsr.io/@std/path/1.1.6/windows/is_absolute.d.ts +16 -0
- package/esm/deps/jsr.io/@std/path/1.1.6/windows/is_absolute.js +38 -0
- package/esm/dsl/GeneratorKeys.d.ts +2 -2
- package/esm/dsl/GeneratorKeys.js +6 -3
- package/esm/dsl/model/ModelDriver.js +4 -3
- package/esm/dsl/operation/gql/GqlOperationDriver.js +4 -3
- package/esm/dsl/operation/oas/OasOperationDriver.js +4 -3
- package/esm/dsl/webhook/WebhookDriver.js +4 -3
- package/esm/helpers/applyGeneratedSuffix.js +1 -1
- package/esm/helpers/isImported.d.ts +10 -74
- package/esm/helpers/isImported.js +12 -76
- package/esm/helpers/naming.d.ts +2 -1
- package/esm/helpers/naming.js +4 -2
- package/esm/helpers/normalizeWorkspacePath.d.ts +64 -0
- package/esm/helpers/normalizeWorkspacePath.js +98 -0
- package/esm/helpers/toResolvedArtifactPath.d.ts +8 -5
- package/esm/helpers/toResolvedArtifactPath.js +11 -7
- package/esm/helpers/toWorkspacePath.d.ts +3 -3
- package/esm/helpers/toWorkspacePath.js +5 -5
- 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/mediaType/MediaType.d.ts +12 -0
- package/esm/oas/mediaType/MediaType.js +24 -0
- package/esm/oas/parameter/Parameter.d.ts +2 -1
- package/esm/oas/parameter/Parameter.js +5 -2
- package/esm/oas/parameter/parameter-types.d.ts +10 -2
- package/esm/oas/parameter/parameter-types.js +3 -1
- package/esm/oas/response/Response.d.ts +6 -1
- package/esm/oas/response/Response.js +8 -0
- 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/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/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/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 +44 -0
- package/esm/parse/v3-2/response/toResponseV3.d.ts +29 -0
- package/esm/parse/v3-2/response/toResponseV3.js +56 -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/Settings.js +6 -8
- 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/GenerateContext.js +16 -16
- package/script/context/ParseContext.js +9 -1
- package/script/context/RenderContext.d.ts +7 -7
- package/script/context/RenderContext.js +17 -12
- package/script/context/generateTypes.d.ts +2 -2
- package/script/context/generateTypes.js +3 -1
- package/script/deps/jsr.io/@std/path/1.1.6/posix/is_absolute.d.ts +16 -0
- package/script/deps/jsr.io/@std/path/1.1.6/posix/is_absolute.js +26 -0
- package/script/deps/jsr.io/@std/path/1.1.6/windows/is_absolute.d.ts +16 -0
- package/script/deps/jsr.io/@std/path/1.1.6/windows/is_absolute.js +41 -0
- package/script/dsl/GeneratorKeys.d.ts +2 -2
- package/script/dsl/GeneratorKeys.js +6 -3
- package/script/dsl/model/ModelDriver.js +4 -3
- package/script/dsl/operation/gql/GqlOperationDriver.js +4 -3
- package/script/dsl/operation/oas/OasOperationDriver.js +4 -3
- package/script/dsl/webhook/WebhookDriver.js +4 -3
- package/script/helpers/applyGeneratedSuffix.js +1 -1
- package/script/helpers/isImported.d.ts +10 -74
- package/script/helpers/isImported.js +12 -76
- package/script/helpers/naming.d.ts +2 -1
- package/script/helpers/naming.js +4 -2
- package/script/helpers/normalizeWorkspacePath.d.ts +64 -0
- package/script/helpers/normalizeWorkspacePath.js +107 -0
- package/script/helpers/toResolvedArtifactPath.d.ts +8 -5
- package/script/helpers/toResolvedArtifactPath.js +11 -7
- package/script/helpers/toWorkspacePath.d.ts +3 -3
- package/script/helpers/toWorkspacePath.js +5 -5
- 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/mediaType/MediaType.d.ts +12 -0
- package/script/oas/mediaType/MediaType.js +24 -0
- package/script/oas/parameter/Parameter.d.ts +2 -1
- package/script/oas/parameter/Parameter.js +5 -2
- package/script/oas/parameter/parameter-types.d.ts +10 -2
- package/script/oas/parameter/parameter-types.js +3 -1
- package/script/oas/response/Response.d.ts +6 -1
- package/script/oas/response/Response.js +8 -0
- 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/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/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/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 +49 -0
- package/script/parse/v3-2/response/toResponseV3.d.ts +29 -0
- package/script/parse/v3-2/response/toResponseV3.js +62 -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/Settings.js +7 -9
- package/script/types/SkmtcDocument.d.ts +6 -6
- package/esm/deps/jsr.io/@std/path/1.1.6/extname.d.ts +0 -24
- package/esm/deps/jsr.io/@std/path/1.1.6/extname.js +0 -31
- package/esm/deps/jsr.io/@std/path/1.1.6/normalize.d.ts +0 -25
- package/esm/deps/jsr.io/@std/path/1.1.6/normalize.js +0 -32
- package/esm/deps/jsr.io/@std/path/1.1.6/windows/extname.d.ts +0 -17
- package/esm/deps/jsr.io/@std/path/1.1.6/windows/extname.js +0 -83
- package/script/deps/jsr.io/@std/path/1.1.6/extname.d.ts +0 -24
- package/script/deps/jsr.io/@std/path/1.1.6/extname.js +0 -34
- package/script/deps/jsr.io/@std/path/1.1.6/normalize.d.ts +0 -25
- package/script/deps/jsr.io/@std/path/1.1.6/normalize.js +0 -35
- package/script/deps/jsr.io/@std/path/1.1.6/windows/extname.d.ts +0 -17
- package/script/deps/jsr.io/@std/path/1.1.6/windows/extname.js +0 -86
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
import { OasHttpSecurityScheme, OasApiKeySecurityScheme, OasOAuth2SecurityScheme, OasOpenIdSecurityScheme } from '../../../oas/securitySchemes/SecurityScheme.js';
|
|
2
|
+
import * as v from 'valibot';
|
|
3
|
+
import { oasApiKeySecuritySchemeData, oasHttpSecuritySchemeData, oasOAuth2FlowsData, oasOAuth2SecuritySchemeData, oasOpenIdSecuritySchemeData } from '../../../oas/securitySchemes/security-scheme-types.js';
|
|
4
|
+
import { toRefV31 } from '../ref/toRefV31.js';
|
|
5
|
+
import { isRef } from '../../../helpers/refFns.js';
|
|
6
|
+
import { tryParseAt } from '../../../context/tryParseAt.js';
|
|
7
|
+
import { toSpecificationExtensionsV3 } from '../specificationExtensions/toSpecificationExtensionsV3.js';
|
|
8
|
+
// The shared schemas are the 3.0/3.1 shape; these add the 3.2 fields.
|
|
9
|
+
const deprecatedField = v.optional(v.boolean());
|
|
10
|
+
const httpSecuritySchemeData = v.object({
|
|
11
|
+
...oasHttpSecuritySchemeData.entries,
|
|
12
|
+
deprecated: deprecatedField
|
|
13
|
+
});
|
|
14
|
+
const apiKeySecuritySchemeData = v.object({
|
|
15
|
+
...oasApiKeySecuritySchemeData.entries,
|
|
16
|
+
deprecated: deprecatedField
|
|
17
|
+
});
|
|
18
|
+
const deviceAuthorizationOAuth2FlowData = v.object({
|
|
19
|
+
deviceAuthorizationUrl: v.string(),
|
|
20
|
+
tokenUrl: v.string(),
|
|
21
|
+
refreshUrl: v.optional(v.string()),
|
|
22
|
+
scopes: v.optional(v.record(v.string(), v.string()))
|
|
23
|
+
});
|
|
24
|
+
const oAuth2FlowsData = v.object({
|
|
25
|
+
...oasOAuth2FlowsData.entries,
|
|
26
|
+
deviceAuthorization: v.optional(deviceAuthorizationOAuth2FlowData)
|
|
27
|
+
});
|
|
28
|
+
const oAuth2SecuritySchemeData = v.object({
|
|
29
|
+
...oasOAuth2SecuritySchemeData.entries,
|
|
30
|
+
deprecated: deprecatedField,
|
|
31
|
+
oauth2MetadataUrl: v.optional(v.string()),
|
|
32
|
+
flows: oAuth2FlowsData
|
|
33
|
+
});
|
|
34
|
+
const openIdSecuritySchemeData = v.object({
|
|
35
|
+
...oasOpenIdSecuritySchemeData.entries,
|
|
36
|
+
deprecated: deprecatedField
|
|
37
|
+
});
|
|
38
|
+
export const toSecuritySchemesV3 = ({ securitySchemes, stackTrail, context }) => {
|
|
39
|
+
if (!securitySchemes) {
|
|
40
|
+
return undefined;
|
|
41
|
+
}
|
|
42
|
+
const output = {};
|
|
43
|
+
for (const [key, value] of Object.entries(securitySchemes)) {
|
|
44
|
+
// Isolate per scheme: a single malformed security scheme is logged and
|
|
45
|
+
// skipped, the rest of the record continues (parity with toSchemasV3).
|
|
46
|
+
const parsed = tryParseAt({
|
|
47
|
+
stackTrail,
|
|
48
|
+
key,
|
|
49
|
+
context,
|
|
50
|
+
type: 'INVALID_SECURITY_SCHEME',
|
|
51
|
+
parent: value,
|
|
52
|
+
fn: st => toSecuritySchemeV3({ securityScheme: value, stackTrail: st, context })
|
|
53
|
+
});
|
|
54
|
+
if (parsed !== undefined) {
|
|
55
|
+
output[key] = parsed;
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
return output;
|
|
59
|
+
};
|
|
60
|
+
/**
|
|
61
|
+
* Log the keys of `value` that `known` does not name as skipped fields.
|
|
62
|
+
* `v.parse` on a `v.object` schema strips unknown keys, so they are read
|
|
63
|
+
* off the raw object. `x-` extensions are not logged.
|
|
64
|
+
*/
|
|
65
|
+
const logSkippedKeys = ({ value, known, parentType, stackTrail, context }) => {
|
|
66
|
+
const skipped = Object.fromEntries(Object.entries(value).filter(([key]) => !Object.hasOwn(known, key)));
|
|
67
|
+
toSpecificationExtensionsV3({ skipped, parent: value, parentType, stackTrail, context });
|
|
68
|
+
};
|
|
69
|
+
const toSecuritySchemeV3 = ({ securityScheme, stackTrail, context }) => {
|
|
70
|
+
if (isRef(securityScheme)) {
|
|
71
|
+
return toRefV31({ ref: securityScheme, refType: 'securityScheme', stackTrail, context });
|
|
72
|
+
}
|
|
73
|
+
switch (securityScheme.type) {
|
|
74
|
+
case 'http': {
|
|
75
|
+
const { description, deprecated, scheme, bearerFormat } = v.parse(httpSecuritySchemeData, securityScheme);
|
|
76
|
+
logSkippedKeys({
|
|
77
|
+
value: securityScheme,
|
|
78
|
+
known: httpSecuritySchemeData.entries,
|
|
79
|
+
parentType: 'securityScheme:http',
|
|
80
|
+
stackTrail,
|
|
81
|
+
context
|
|
82
|
+
});
|
|
83
|
+
return new OasHttpSecurityScheme({
|
|
84
|
+
description,
|
|
85
|
+
deprecated,
|
|
86
|
+
scheme,
|
|
87
|
+
bearerFormat
|
|
88
|
+
});
|
|
89
|
+
}
|
|
90
|
+
case 'apiKey': {
|
|
91
|
+
const { in: location, description, deprecated, name } = v.parse(apiKeySecuritySchemeData, securityScheme);
|
|
92
|
+
logSkippedKeys({
|
|
93
|
+
value: securityScheme,
|
|
94
|
+
known: apiKeySecuritySchemeData.entries,
|
|
95
|
+
parentType: 'securityScheme:apiKey',
|
|
96
|
+
stackTrail,
|
|
97
|
+
context
|
|
98
|
+
});
|
|
99
|
+
return new OasApiKeySecurityScheme({
|
|
100
|
+
description,
|
|
101
|
+
deprecated,
|
|
102
|
+
name,
|
|
103
|
+
in: location
|
|
104
|
+
});
|
|
105
|
+
}
|
|
106
|
+
case 'oauth2': {
|
|
107
|
+
const { flows, description, deprecated, oauth2MetadataUrl } = v.parse(oAuth2SecuritySchemeData, securityScheme);
|
|
108
|
+
logSkippedKeys({
|
|
109
|
+
value: securityScheme,
|
|
110
|
+
known: oAuth2SecuritySchemeData.entries,
|
|
111
|
+
parentType: 'securityScheme:oauth2',
|
|
112
|
+
stackTrail,
|
|
113
|
+
context
|
|
114
|
+
});
|
|
115
|
+
stackTrail.trace('flows', st => logSkippedKeys({
|
|
116
|
+
value: securityScheme.flows,
|
|
117
|
+
known: oAuth2FlowsData.entries,
|
|
118
|
+
parentType: 'oauthFlows',
|
|
119
|
+
stackTrail: st,
|
|
120
|
+
context
|
|
121
|
+
}));
|
|
122
|
+
return new OasOAuth2SecurityScheme({
|
|
123
|
+
description,
|
|
124
|
+
deprecated,
|
|
125
|
+
oauth2MetadataUrl,
|
|
126
|
+
flows
|
|
127
|
+
});
|
|
128
|
+
}
|
|
129
|
+
case 'openIdConnect': {
|
|
130
|
+
const { description, deprecated, openIdConnectUrl } = v.parse(openIdSecuritySchemeData, securityScheme);
|
|
131
|
+
logSkippedKeys({
|
|
132
|
+
value: securityScheme,
|
|
133
|
+
known: openIdSecuritySchemeData.entries,
|
|
134
|
+
parentType: 'securityScheme:openIdConnect',
|
|
135
|
+
stackTrail,
|
|
136
|
+
context
|
|
137
|
+
});
|
|
138
|
+
return new OasOpenIdSecurityScheme({
|
|
139
|
+
description,
|
|
140
|
+
deprecated,
|
|
141
|
+
openIdConnectUrl
|
|
142
|
+
});
|
|
143
|
+
}
|
|
144
|
+
default: {
|
|
145
|
+
// Exhaustive over the discriminated union: a value reaching here has a
|
|
146
|
+
// `type` outside the OpenAPI set. `tryParseAt` isolates the throw to
|
|
147
|
+
// this one scheme.
|
|
148
|
+
const _exhaustiveCheck = securityScheme;
|
|
149
|
+
throw new Error(`Unknown security scheme type: ${JSON.stringify(_exhaustiveCheck)}`);
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { ParseContextType } from '../../../context/parseTypes.js';
|
|
2
|
+
import type { OpenAPIV3 } from 'openapi-types';
|
|
3
|
+
import { OasServer } from '../../../oas/server/Server.js';
|
|
4
|
+
import type { StackTrail } from '../../../context/StackTrail.js';
|
|
5
|
+
/** A 3.2 Server Object: the 3.0 shape plus `name`. */
|
|
6
|
+
export type ServerObjectV32 = OpenAPIV3.ServerObject & {
|
|
7
|
+
name?: string;
|
|
8
|
+
};
|
|
9
|
+
export type ToServersV3Args = {
|
|
10
|
+
servers: ServerObjectV32[];
|
|
11
|
+
stackTrail: StackTrail;
|
|
12
|
+
context: ParseContextType;
|
|
13
|
+
};
|
|
14
|
+
export declare const toServersV3: ({ servers, stackTrail, context }: ToServersV3Args) => OasServer[];
|
|
15
|
+
export type ToOptionalServersV3Args = {
|
|
16
|
+
servers: ServerObjectV32[] | undefined;
|
|
17
|
+
stackTrail: StackTrail;
|
|
18
|
+
context: ParseContextType;
|
|
19
|
+
};
|
|
20
|
+
export declare const toOptionalServersV3: ({ servers, stackTrail, context }: ToOptionalServersV3Args) => OasServer[] | undefined;
|
|
21
|
+
export type ToServerV3Args = {
|
|
22
|
+
server: ServerObjectV32;
|
|
23
|
+
stackTrail: StackTrail;
|
|
24
|
+
context: ParseContextType;
|
|
25
|
+
};
|
|
26
|
+
export declare const toServerV3: ({ server, stackTrail, context }: ToServerV3Args) => OasServer;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { OasServer } from '../../../oas/server/Server.js';
|
|
2
|
+
import { toSpecificationExtensionsV3 } from '../specificationExtensions/toSpecificationExtensionsV3.js';
|
|
3
|
+
import { toOptionalServerVariablesV3 } from '../serverVariable/toServerVariableV3.js';
|
|
4
|
+
export const toServersV3 = ({ servers, stackTrail, context }) => {
|
|
5
|
+
return servers.map((server, index) => {
|
|
6
|
+
return stackTrail.trace(server.url ?? index, st => toServerV3({ server, stackTrail: st, context }));
|
|
7
|
+
});
|
|
8
|
+
};
|
|
9
|
+
export const toOptionalServersV3 = ({ servers, stackTrail, context }) => {
|
|
10
|
+
if (!servers) {
|
|
11
|
+
return undefined;
|
|
12
|
+
}
|
|
13
|
+
return toServersV3({ servers, stackTrail, context });
|
|
14
|
+
};
|
|
15
|
+
export const toServerV3 = ({ server, stackTrail, context }) => {
|
|
16
|
+
const { description, name, url, variables, ...skipped } = server;
|
|
17
|
+
const extensionFields = toSpecificationExtensionsV3({
|
|
18
|
+
skipped,
|
|
19
|
+
parent: server,
|
|
20
|
+
context,
|
|
21
|
+
stackTrail,
|
|
22
|
+
parentType: 'server'
|
|
23
|
+
});
|
|
24
|
+
return new OasServer({
|
|
25
|
+
description,
|
|
26
|
+
name,
|
|
27
|
+
url,
|
|
28
|
+
variables: toOptionalServerVariablesV3({ serverVariables: variables, stackTrail, context }),
|
|
29
|
+
extensionFields
|
|
30
|
+
});
|
|
31
|
+
};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { ParseContextType } from '../../../context/parseTypes.js';
|
|
2
|
+
import type { OpenAPIV3 } from 'openapi-types';
|
|
3
|
+
import { OasServerVariable } from '../../../oas/serverVariable/ServerVariable.js';
|
|
4
|
+
import type { StackTrail } from '../../../context/StackTrail.js';
|
|
5
|
+
export type ToServerVariablesV3Args = {
|
|
6
|
+
serverVariables: Record<string, OpenAPIV3.ServerVariableObject>;
|
|
7
|
+
stackTrail: StackTrail;
|
|
8
|
+
context: ParseContextType;
|
|
9
|
+
};
|
|
10
|
+
export declare const toServerVariablesV3: ({ serverVariables, stackTrail, context }: ToServerVariablesV3Args) => Record<string, OasServerVariable>;
|
|
11
|
+
export type ToOptionalServerVariablesV3Args = {
|
|
12
|
+
serverVariables: Record<string, OpenAPIV3.ServerVariableObject> | undefined;
|
|
13
|
+
stackTrail: StackTrail;
|
|
14
|
+
context: ParseContextType;
|
|
15
|
+
};
|
|
16
|
+
export declare const toOptionalServerVariablesV3: ({ serverVariables, stackTrail, context }: ToOptionalServerVariablesV3Args) => Record<string, OasServerVariable> | undefined;
|
|
17
|
+
export type ToServerVariableV3Args = {
|
|
18
|
+
serverVariable: OpenAPIV3.ServerVariableObject;
|
|
19
|
+
stackTrail: StackTrail;
|
|
20
|
+
context: ParseContextType;
|
|
21
|
+
};
|
|
22
|
+
export declare const toServerVariableV3: ({ serverVariable, stackTrail, context }: ToServerVariableV3Args) => OasServerVariable;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { toSpecificationExtensionsV3 } from '../specificationExtensions/toSpecificationExtensionsV3.js';
|
|
2
|
+
import { OasServerVariable } from '../../../oas/serverVariable/ServerVariable.js';
|
|
3
|
+
export const toServerVariablesV3 = ({ serverVariables, stackTrail, context }) => {
|
|
4
|
+
return Object.fromEntries(Object.entries(serverVariables).map(([key, serverVariable]) => [
|
|
5
|
+
key,
|
|
6
|
+
toServerVariableV3({ serverVariable, stackTrail, context })
|
|
7
|
+
]));
|
|
8
|
+
};
|
|
9
|
+
export const toOptionalServerVariablesV3 = ({ serverVariables, stackTrail, context }) => {
|
|
10
|
+
if (!serverVariables) {
|
|
11
|
+
return undefined;
|
|
12
|
+
}
|
|
13
|
+
return toServerVariablesV3({ serverVariables, stackTrail, context });
|
|
14
|
+
};
|
|
15
|
+
export const toServerVariableV3 = ({ serverVariable, stackTrail, context }) => {
|
|
16
|
+
const { description, default: defaultValue, enum: enums, ...skipped } = serverVariable;
|
|
17
|
+
const extensionFields = toSpecificationExtensionsV3({
|
|
18
|
+
skipped,
|
|
19
|
+
parent: serverVariable,
|
|
20
|
+
context,
|
|
21
|
+
stackTrail,
|
|
22
|
+
parentType: 'serverVariable'
|
|
23
|
+
});
|
|
24
|
+
return new OasServerVariable({
|
|
25
|
+
description,
|
|
26
|
+
default: defaultValue,
|
|
27
|
+
enums,
|
|
28
|
+
extensionFields
|
|
29
|
+
});
|
|
30
|
+
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { ParseContextType } from '../../../context/parseTypes.js';
|
|
2
|
+
import type { StackTrail } from '../../../context/StackTrail.js';
|
|
3
|
+
export type ToSpecificationExtensionsV3Args = {
|
|
4
|
+
skipped: Record<string, unknown>;
|
|
5
|
+
parent: unknown;
|
|
6
|
+
parentType: string;
|
|
7
|
+
stackTrail: StackTrail;
|
|
8
|
+
context: ParseContextType;
|
|
9
|
+
};
|
|
10
|
+
export declare const toSpecificationExtensionsV3: ({ skipped: s, parent, parentType, stackTrail, context }: ToSpecificationExtensionsV3Args) => Record<string, unknown> | undefined;
|
|
11
|
+
export declare const extractExtensions: (item: Record<string, unknown>) => {
|
|
12
|
+
skipped: Record<string, unknown> | undefined;
|
|
13
|
+
extensionFields: Record<string, unknown> | undefined;
|
|
14
|
+
};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { isEmpty } from '../../../helpers/isEmpty.js';
|
|
2
|
+
export const toSpecificationExtensionsV3 = ({ skipped: s, parent, parentType, stackTrail, context }) => {
|
|
3
|
+
const { skipped, extensionFields } = extractExtensions(s);
|
|
4
|
+
if (skipped) {
|
|
5
|
+
context.logSkippedFields({ skipped, parent, stackTrail, parentType });
|
|
6
|
+
}
|
|
7
|
+
return extensionFields;
|
|
8
|
+
};
|
|
9
|
+
export const extractExtensions = (item) => {
|
|
10
|
+
const entries = Object.entries(item);
|
|
11
|
+
const skipped = {};
|
|
12
|
+
const extensionFields = {};
|
|
13
|
+
for (const [key, value] of entries) {
|
|
14
|
+
if (!key.startsWith('x-')) {
|
|
15
|
+
skipped[key] = value;
|
|
16
|
+
}
|
|
17
|
+
else {
|
|
18
|
+
extensionFields[key] = value;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
return {
|
|
22
|
+
skipped: isEmpty(skipped) ? undefined : skipped,
|
|
23
|
+
extensionFields: isEmpty(extensionFields) ? undefined : extensionFields
|
|
24
|
+
};
|
|
25
|
+
};
|
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
import type { OpenAPIV3 } from 'openapi-types';
|
|
2
|
+
import type { ParseContextType } from '../../../context/parseTypes.js';
|
|
3
|
+
import { OasString } from '../../../oas/string/String.js';
|
|
4
|
+
import type { StackTrail } from '../../../context/StackTrail.js';
|
|
5
|
+
/**
|
|
6
|
+
* Arguments for transforming an OpenAPI string schema into OAS representation.
|
|
7
|
+
*/
|
|
8
|
+
export type ToStringArgs = {
|
|
9
|
+
/** The OpenAPI v3 schema object to transform (must be type 'string') */
|
|
10
|
+
value: OpenAPIV3.SchemaObject;
|
|
11
|
+
/** The stack trail for tracing */
|
|
12
|
+
stackTrail: StackTrail;
|
|
13
|
+
/** Parse context providing utilities and tracing capabilities */
|
|
14
|
+
context: ParseContextType;
|
|
15
|
+
};
|
|
16
|
+
/**
|
|
17
|
+
* Transforms an OpenAPI v3 string schema object into an internal OAS string representation.
|
|
18
|
+
*
|
|
19
|
+
* This function processes OpenAPI string schemas by extracting and parsing nullable values,
|
|
20
|
+
* examples, enumerations, and default values. It handles the complete transformation from
|
|
21
|
+
* raw OpenAPI JSON to the SKMTC internal string representation with proper validation
|
|
22
|
+
* of string formats and constraints.
|
|
23
|
+
*
|
|
24
|
+
* The transformation follows a pipeline approach:
|
|
25
|
+
* 1. Parse nullable flag and extract base value
|
|
26
|
+
* 2. Parse example values with nullable support
|
|
27
|
+
* 3. Parse enumeration constraints
|
|
28
|
+
* 4. Parse default values
|
|
29
|
+
* 5. Create final OasString instance with format validation
|
|
30
|
+
*
|
|
31
|
+
* @param args - Transformation arguments
|
|
32
|
+
* @param args.context - Parse context providing utilities and tracing
|
|
33
|
+
* @param args.value - The OpenAPI v3 string schema object to transform
|
|
34
|
+
* @returns Transformed OAS string object with parsed properties
|
|
35
|
+
*
|
|
36
|
+
* @example Basic string transformation
|
|
37
|
+
* ```typescript
|
|
38
|
+
* import { toString } from '@skmtc/core';
|
|
39
|
+
*
|
|
40
|
+
* const openApiString = {
|
|
41
|
+
* type: 'string',
|
|
42
|
+
* format: 'email',
|
|
43
|
+
* maxLength: 255,
|
|
44
|
+
* pattern: '^[\\w.-]+@[\\w.-]+\\.[a-zA-Z]{2,}$'
|
|
45
|
+
* };
|
|
46
|
+
*
|
|
47
|
+
* const oasString = toString({
|
|
48
|
+
* context: parseContext,
|
|
49
|
+
* value: openApiString
|
|
50
|
+
* });
|
|
51
|
+
*
|
|
52
|
+
* console.log(oasString.format); // 'email'
|
|
53
|
+
* console.log(oasString.maxLength); // 255
|
|
54
|
+
* ```
|
|
55
|
+
*
|
|
56
|
+
* @example String with nullable and enums
|
|
57
|
+
* ```typescript
|
|
58
|
+
* const statusString = {
|
|
59
|
+
* type: 'string',
|
|
60
|
+
* nullable: true,
|
|
61
|
+
* enum: ['active', 'inactive', 'pending', null],
|
|
62
|
+
* default: 'active',
|
|
63
|
+
* example: 'pending'
|
|
64
|
+
* };
|
|
65
|
+
*
|
|
66
|
+
* const oasString = toString({
|
|
67
|
+
* context: parseContext,
|
|
68
|
+
* value: statusString
|
|
69
|
+
* });
|
|
70
|
+
*
|
|
71
|
+
* console.log(oasString.nullable); // true
|
|
72
|
+
* console.log(oasString.enums); // ['active', 'inactive', 'pending', null]
|
|
73
|
+
* ```
|
|
74
|
+
*/
|
|
75
|
+
export declare const toString: ({ context, value, stackTrail }: ToStringArgs) => OasString;
|
|
76
|
+
type ToParsedStringArgs<Nullable extends boolean | undefined> = {
|
|
77
|
+
value: Omit<OpenAPIV3.SchemaObject, 'nullable' | 'example' | 'enums' | 'default'>;
|
|
78
|
+
context: ParseContextType;
|
|
79
|
+
nullable: Nullable;
|
|
80
|
+
example: Nullable extends true ? string | null | undefined : string | undefined;
|
|
81
|
+
enums: Nullable extends true ? (string | null)[] | undefined : string[] | undefined;
|
|
82
|
+
defaultValue: Nullable extends true ? string | null | undefined : string | undefined;
|
|
83
|
+
stackTrail: StackTrail;
|
|
84
|
+
};
|
|
85
|
+
/**
|
|
86
|
+
* Creates an OAS string instance from pre-parsed string schema components.
|
|
87
|
+
*
|
|
88
|
+
* This function is the final step in the string transformation pipeline, taking
|
|
89
|
+
* already-parsed nullable, example, enum, and default values and combining them
|
|
90
|
+
* with the remaining string properties to create the complete OasString instance.
|
|
91
|
+
*
|
|
92
|
+
* The function handles format validation against known OpenAPI string formats,
|
|
93
|
+
* length constraints parsing, pattern validation, and specification extension
|
|
94
|
+
* processing. It logs warnings for unrecognized formats while still preserving
|
|
95
|
+
* them in the output.
|
|
96
|
+
*
|
|
97
|
+
* @template Nullable - Boolean type indicating if the string can be null
|
|
98
|
+
* @param args - Pre-parsed string components
|
|
99
|
+
* @param args.context - Parse context for tracing and issue logging
|
|
100
|
+
* @param args.nullable - Parsed nullable flag
|
|
101
|
+
* @param args.example - Parsed example value (type-safe with nullable)
|
|
102
|
+
* @param args.enums - Parsed enumeration constraints (type-safe with nullable)
|
|
103
|
+
* @param args.defaultValue - Parsed default value (type-safe with nullable)
|
|
104
|
+
* @param args.value - OpenAPI string object without parsed fields
|
|
105
|
+
* @returns Complete OAS string instance with all properties and validation
|
|
106
|
+
*
|
|
107
|
+
* @example Date-time string with validation
|
|
108
|
+
* ```typescript
|
|
109
|
+
* const dateTimeString = toParsedString({
|
|
110
|
+
* context: parseContext,
|
|
111
|
+
* nullable: false,
|
|
112
|
+
* example: '2023-12-25T10:00:00Z',
|
|
113
|
+
* enums: undefined,
|
|
114
|
+
* defaultValue: undefined,
|
|
115
|
+
* value: {
|
|
116
|
+
* type: 'string',
|
|
117
|
+
* format: 'date-time',
|
|
118
|
+
* title: 'Event Date',
|
|
119
|
+
* description: 'When the event occurs'
|
|
120
|
+
* }
|
|
121
|
+
* });
|
|
122
|
+
*
|
|
123
|
+
* console.log(dateTimeString.format); // 'date-time'
|
|
124
|
+
* ```
|
|
125
|
+
*
|
|
126
|
+
* @example String with custom format (generates warning)
|
|
127
|
+
* ```typescript
|
|
128
|
+
* const customFormatString = toParsedString({
|
|
129
|
+
* context: parseContext,
|
|
130
|
+
* nullable: false,
|
|
131
|
+
* example: 'ABC123',
|
|
132
|
+
* enums: undefined,
|
|
133
|
+
* defaultValue: undefined,
|
|
134
|
+
* value: {
|
|
135
|
+
* type: 'string',
|
|
136
|
+
* format: 'custom-id', // Unknown format, will log warning
|
|
137
|
+
* pattern: '^[A-Z]{3}[0-9]{3}$'
|
|
138
|
+
* }
|
|
139
|
+
* });
|
|
140
|
+
*
|
|
141
|
+
* // Logs: "Unexpected format: custom-id"
|
|
142
|
+
* console.log(customFormatString.format); // 'custom-id' (still preserved)
|
|
143
|
+
* ```
|
|
144
|
+
*/
|
|
145
|
+
export declare const toParsedString: <Nullable extends boolean | undefined>({ context, nullable, example, enums, defaultValue, value, stackTrail }: ToParsedStringArgs<Nullable>) => OasString<Nullable>;
|
|
146
|
+
export {};
|
|
@@ -0,0 +1,211 @@
|
|
|
1
|
+
import { OasString } from '../../../oas/string/String.js';
|
|
2
|
+
import { toSpecificationExtensionsV3 } from '../specificationExtensions/toSpecificationExtensionsV3.js';
|
|
3
|
+
import { oasStringData } from '../../../oas/string/string-types.js';
|
|
4
|
+
import * as v from 'valibot';
|
|
5
|
+
import { parseNullable } from '../_helpers/parseNullable.js';
|
|
6
|
+
import { parseEnum } from '../_helpers/parseEnum.js';
|
|
7
|
+
import { parseExample } from '../_helpers/parseExample.js';
|
|
8
|
+
import { parseDefault } from '../_helpers/parseDefault.js';
|
|
9
|
+
/**
|
|
10
|
+
* Transforms an OpenAPI v3 string schema object into an internal OAS string representation.
|
|
11
|
+
*
|
|
12
|
+
* This function processes OpenAPI string schemas by extracting and parsing nullable values,
|
|
13
|
+
* examples, enumerations, and default values. It handles the complete transformation from
|
|
14
|
+
* raw OpenAPI JSON to the SKMTC internal string representation with proper validation
|
|
15
|
+
* of string formats and constraints.
|
|
16
|
+
*
|
|
17
|
+
* The transformation follows a pipeline approach:
|
|
18
|
+
* 1. Parse nullable flag and extract base value
|
|
19
|
+
* 2. Parse example values with nullable support
|
|
20
|
+
* 3. Parse enumeration constraints
|
|
21
|
+
* 4. Parse default values
|
|
22
|
+
* 5. Create final OasString instance with format validation
|
|
23
|
+
*
|
|
24
|
+
* @param args - Transformation arguments
|
|
25
|
+
* @param args.context - Parse context providing utilities and tracing
|
|
26
|
+
* @param args.value - The OpenAPI v3 string schema object to transform
|
|
27
|
+
* @returns Transformed OAS string object with parsed properties
|
|
28
|
+
*
|
|
29
|
+
* @example Basic string transformation
|
|
30
|
+
* ```typescript
|
|
31
|
+
* import { toString } from '@skmtc/core';
|
|
32
|
+
*
|
|
33
|
+
* const openApiString = {
|
|
34
|
+
* type: 'string',
|
|
35
|
+
* format: 'email',
|
|
36
|
+
* maxLength: 255,
|
|
37
|
+
* pattern: '^[\\w.-]+@[\\w.-]+\\.[a-zA-Z]{2,}$'
|
|
38
|
+
* };
|
|
39
|
+
*
|
|
40
|
+
* const oasString = toString({
|
|
41
|
+
* context: parseContext,
|
|
42
|
+
* value: openApiString
|
|
43
|
+
* });
|
|
44
|
+
*
|
|
45
|
+
* console.log(oasString.format); // 'email'
|
|
46
|
+
* console.log(oasString.maxLength); // 255
|
|
47
|
+
* ```
|
|
48
|
+
*
|
|
49
|
+
* @example String with nullable and enums
|
|
50
|
+
* ```typescript
|
|
51
|
+
* const statusString = {
|
|
52
|
+
* type: 'string',
|
|
53
|
+
* nullable: true,
|
|
54
|
+
* enum: ['active', 'inactive', 'pending', null],
|
|
55
|
+
* default: 'active',
|
|
56
|
+
* example: 'pending'
|
|
57
|
+
* };
|
|
58
|
+
*
|
|
59
|
+
* const oasString = toString({
|
|
60
|
+
* context: parseContext,
|
|
61
|
+
* value: statusString
|
|
62
|
+
* });
|
|
63
|
+
*
|
|
64
|
+
* console.log(oasString.nullable); // true
|
|
65
|
+
* console.log(oasString.enums); // ['active', 'inactive', 'pending', null]
|
|
66
|
+
* ```
|
|
67
|
+
*/
|
|
68
|
+
export const toString = ({ context, value, stackTrail }) => {
|
|
69
|
+
if (value.type === 'string' && Object.keys(value).length === 1) {
|
|
70
|
+
return context.withStackTrail(stackTrail, () => new OasString({}, context));
|
|
71
|
+
}
|
|
72
|
+
const { nullable, value: valueWithoutNullable } = parseNullable({
|
|
73
|
+
value,
|
|
74
|
+
context,
|
|
75
|
+
stackTrail
|
|
76
|
+
});
|
|
77
|
+
const { example: unparsedExample, ...valueWithoutExample } = valueWithoutNullable;
|
|
78
|
+
const example = parseExample({
|
|
79
|
+
value: unparsedExample,
|
|
80
|
+
context,
|
|
81
|
+
parent: valueWithoutNullable,
|
|
82
|
+
nullable,
|
|
83
|
+
check: isString,
|
|
84
|
+
toMessage: item => `Removed invalid example. Expected "string", got: ${item}`,
|
|
85
|
+
stackTrail
|
|
86
|
+
});
|
|
87
|
+
const { enum: unparsedEnums, ...valueWithoutEnums } = valueWithoutExample;
|
|
88
|
+
const enums = parseEnum({
|
|
89
|
+
value: unparsedEnums,
|
|
90
|
+
nullable,
|
|
91
|
+
parent: valueWithoutExample,
|
|
92
|
+
context,
|
|
93
|
+
check: isString,
|
|
94
|
+
toMessage: item => `Removed invalid enum. Expected "string", got: ${item}`,
|
|
95
|
+
stackTrail
|
|
96
|
+
});
|
|
97
|
+
const { default: unparsedDefaultValue, ...valueWithoutDefault } = valueWithoutEnums;
|
|
98
|
+
const defaultValue = parseDefault({
|
|
99
|
+
value: unparsedDefaultValue,
|
|
100
|
+
context,
|
|
101
|
+
parent: valueWithoutEnums,
|
|
102
|
+
nullable,
|
|
103
|
+
check: isString,
|
|
104
|
+
toMessage: item => `Removed invalid default. Expected "string", got: ${item}`,
|
|
105
|
+
stackTrail
|
|
106
|
+
});
|
|
107
|
+
return toParsedString({
|
|
108
|
+
context,
|
|
109
|
+
nullable,
|
|
110
|
+
example,
|
|
111
|
+
enums,
|
|
112
|
+
defaultValue,
|
|
113
|
+
value: valueWithoutDefault,
|
|
114
|
+
stackTrail
|
|
115
|
+
});
|
|
116
|
+
};
|
|
117
|
+
/**
|
|
118
|
+
* Creates an OAS string instance from pre-parsed string schema components.
|
|
119
|
+
*
|
|
120
|
+
* This function is the final step in the string transformation pipeline, taking
|
|
121
|
+
* already-parsed nullable, example, enum, and default values and combining them
|
|
122
|
+
* with the remaining string properties to create the complete OasString instance.
|
|
123
|
+
*
|
|
124
|
+
* The function handles format validation against known OpenAPI string formats,
|
|
125
|
+
* length constraints parsing, pattern validation, and specification extension
|
|
126
|
+
* processing. It logs warnings for unrecognized formats while still preserving
|
|
127
|
+
* them in the output.
|
|
128
|
+
*
|
|
129
|
+
* @template Nullable - Boolean type indicating if the string can be null
|
|
130
|
+
* @param args - Pre-parsed string components
|
|
131
|
+
* @param args.context - Parse context for tracing and issue logging
|
|
132
|
+
* @param args.nullable - Parsed nullable flag
|
|
133
|
+
* @param args.example - Parsed example value (type-safe with nullable)
|
|
134
|
+
* @param args.enums - Parsed enumeration constraints (type-safe with nullable)
|
|
135
|
+
* @param args.defaultValue - Parsed default value (type-safe with nullable)
|
|
136
|
+
* @param args.value - OpenAPI string object without parsed fields
|
|
137
|
+
* @returns Complete OAS string instance with all properties and validation
|
|
138
|
+
*
|
|
139
|
+
* @example Date-time string with validation
|
|
140
|
+
* ```typescript
|
|
141
|
+
* const dateTimeString = toParsedString({
|
|
142
|
+
* context: parseContext,
|
|
143
|
+
* nullable: false,
|
|
144
|
+
* example: '2023-12-25T10:00:00Z',
|
|
145
|
+
* enums: undefined,
|
|
146
|
+
* defaultValue: undefined,
|
|
147
|
+
* value: {
|
|
148
|
+
* type: 'string',
|
|
149
|
+
* format: 'date-time',
|
|
150
|
+
* title: 'Event Date',
|
|
151
|
+
* description: 'When the event occurs'
|
|
152
|
+
* }
|
|
153
|
+
* });
|
|
154
|
+
*
|
|
155
|
+
* console.log(dateTimeString.format); // 'date-time'
|
|
156
|
+
* ```
|
|
157
|
+
*
|
|
158
|
+
* @example String with custom format (generates warning)
|
|
159
|
+
* ```typescript
|
|
160
|
+
* const customFormatString = toParsedString({
|
|
161
|
+
* context: parseContext,
|
|
162
|
+
* nullable: false,
|
|
163
|
+
* example: 'ABC123',
|
|
164
|
+
* enums: undefined,
|
|
165
|
+
* defaultValue: undefined,
|
|
166
|
+
* value: {
|
|
167
|
+
* type: 'string',
|
|
168
|
+
* format: 'custom-id', // Unknown format, will log warning
|
|
169
|
+
* pattern: '^[A-Z]{3}[0-9]{3}$'
|
|
170
|
+
* }
|
|
171
|
+
* });
|
|
172
|
+
*
|
|
173
|
+
* // Logs: "Unexpected format: custom-id"
|
|
174
|
+
* console.log(customFormatString.format); // 'custom-id' (still preserved)
|
|
175
|
+
* ```
|
|
176
|
+
*/
|
|
177
|
+
export const toParsedString = ({ context, nullable, example, enums, defaultValue, value, stackTrail }) => {
|
|
178
|
+
if (!v.is(oasStringData, value)) {
|
|
179
|
+
v.parse(oasStringData, value);
|
|
180
|
+
}
|
|
181
|
+
const { type: _type, title, description, format, maxLength, minLength, pattern, readOnly, writeOnly, deprecated, ...skipped } = value;
|
|
182
|
+
const extensionFields = toSpecificationExtensionsV3({
|
|
183
|
+
skipped,
|
|
184
|
+
parent: value,
|
|
185
|
+
context,
|
|
186
|
+
stackTrail,
|
|
187
|
+
parentType: 'schema:string'
|
|
188
|
+
});
|
|
189
|
+
// `format` is an open vocabulary — custom string formats (e.g. `decimal`,
|
|
190
|
+
// `utc_datetime`) are spec-legal. The value is preserved on the OasString
|
|
191
|
+
// below, so an unrecognised format is passed through, not warned.
|
|
192
|
+
return context.withStackTrail(stackTrail, () => new OasString({
|
|
193
|
+
title,
|
|
194
|
+
description,
|
|
195
|
+
enums,
|
|
196
|
+
nullable,
|
|
197
|
+
example,
|
|
198
|
+
format,
|
|
199
|
+
maxLength,
|
|
200
|
+
minLength,
|
|
201
|
+
pattern,
|
|
202
|
+
readOnly,
|
|
203
|
+
writeOnly,
|
|
204
|
+
default: defaultValue,
|
|
205
|
+
extensionFields,
|
|
206
|
+
deprecated
|
|
207
|
+
}, context));
|
|
208
|
+
};
|
|
209
|
+
const isString = (value) => {
|
|
210
|
+
return typeof value === 'string';
|
|
211
|
+
};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { OpenAPIV3 } from 'openapi-types';
|
|
2
|
+
import type { ParseContextType } from '../../../context/parseTypes.js';
|
|
3
|
+
import { OasTag } from '../../../oas/tag/Tag.js';
|
|
4
|
+
import type { StackTrail } from '../../../context/StackTrail.js';
|
|
5
|
+
/** A 3.2 Tag Object: the 3.0 shape plus `summary`, `parent` and `kind`. */
|
|
6
|
+
export type TagObjectV32 = OpenAPIV3.TagObject & {
|
|
7
|
+
summary?: string;
|
|
8
|
+
parent?: string;
|
|
9
|
+
kind?: string;
|
|
10
|
+
};
|
|
11
|
+
export type ToTagsV3Args = {
|
|
12
|
+
tags: TagObjectV32[] | undefined;
|
|
13
|
+
stackTrail: StackTrail;
|
|
14
|
+
context: ParseContextType;
|
|
15
|
+
};
|
|
16
|
+
export declare const toTagsV3: ({ tags, stackTrail, context }: ToTagsV3Args) => OasTag[] | undefined;
|
|
17
|
+
export type ToTagV3Args = {
|
|
18
|
+
tag: TagObjectV32;
|
|
19
|
+
stackTrail: StackTrail;
|
|
20
|
+
context: ParseContextType;
|
|
21
|
+
};
|
|
22
|
+
export declare const toTagV3: ({ tag, stackTrail, context }: ToTagV3Args) => OasTag;
|