@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,129 @@
|
|
|
1
|
+
import { toRequestBodyV3 } from '../requestBody/toRequestBodiesV3.js';
|
|
2
|
+
import { toResponsesV3 } from '../response/toResponseV3.js';
|
|
3
|
+
import { toParameterListV3 } from '../parameter/toParameterV3.js';
|
|
4
|
+
import { OasOperation } from '../../../oas/operation/Operation.js';
|
|
5
|
+
import { toPathItemResultV3 } from '../pathItem/toPathItemV3.js';
|
|
6
|
+
import { toPathItemMethod } from '../methods.js';
|
|
7
|
+
import { dropAdditionalOperationsV3 } from '../pathItem/dropAdditionalOperationsV3.js';
|
|
8
|
+
import { warnQuerystringConflictsV3 } from '../parameter/warnQuerystringConflictsV3.js';
|
|
9
|
+
import { toSpecificationExtensionsV3 } from '../specificationExtensions/toSpecificationExtensionsV3.js';
|
|
10
|
+
import { toSecurityRequirementsV3 } from '../securityRequirement/toSecurityRequirement.js';
|
|
11
|
+
import { toExternalDocs } from '../externalDocs/toExternalDocs.js';
|
|
12
|
+
import { toOptionalServersV3 } from '../server/toServerV3.js';
|
|
13
|
+
export const toOperationV3 = ({ operation, operationInfo, stackTrail, context }) => {
|
|
14
|
+
const { method, path, pathItem } = operationInfo;
|
|
15
|
+
const { operationId, tags, summary, description, parameters, requestBody, responses, deprecated, security, externalDocs, servers,
|
|
16
|
+
// Callbacks are a deliberate non-goal (no out-of-band callback codegen).
|
|
17
|
+
// Pull it out so it is dropped silently instead of warned as an
|
|
18
|
+
// unexpected property on every operation that declares one.
|
|
19
|
+
callbacks: _callbacks, ...skipped } = operation;
|
|
20
|
+
const extensionFields = toSpecificationExtensionsV3({
|
|
21
|
+
skipped,
|
|
22
|
+
parent: operation,
|
|
23
|
+
context,
|
|
24
|
+
stackTrail,
|
|
25
|
+
parentType: 'operation'
|
|
26
|
+
});
|
|
27
|
+
const parsedParameters = stackTrail.trace('parameters', st => toParameterListV3({ parameters, stackTrail: st, context }));
|
|
28
|
+
warnQuerystringConflictsV3({ parameters: parsedParameters, pathItem, stackTrail, context });
|
|
29
|
+
const parsedRequestBody = stackTrail.trace('requestBody', st => toRequestBodyV3({ requestBody, stackTrail: st, context }));
|
|
30
|
+
const parsedResponses = stackTrail.trace('responses', st => toResponsesV3({ responses, stackTrail: st, context }));
|
|
31
|
+
const parsedSecurity = stackTrail.trace('security', st => toSecurityRequirementsV3({ security, stackTrail: st, context }));
|
|
32
|
+
const parsedExternalDocs = stackTrail.trace('externalDocs', st => toExternalDocs({ externalDocs, stackTrail: st, context }));
|
|
33
|
+
const parsedServers = stackTrail.trace('servers', st => toOptionalServersV3({ servers, stackTrail: st, context }));
|
|
34
|
+
return context.withStackTrail(stackTrail, () => new OasOperation({
|
|
35
|
+
pathItem,
|
|
36
|
+
path,
|
|
37
|
+
method,
|
|
38
|
+
operationId,
|
|
39
|
+
summary,
|
|
40
|
+
tags,
|
|
41
|
+
description,
|
|
42
|
+
parameters: parsedParameters,
|
|
43
|
+
requestBody: parsedRequestBody,
|
|
44
|
+
responses: parsedResponses,
|
|
45
|
+
deprecated,
|
|
46
|
+
security: parsedSecurity,
|
|
47
|
+
externalDocs: parsedExternalDocs,
|
|
48
|
+
servers: parsedServers,
|
|
49
|
+
extensionFields
|
|
50
|
+
}, context));
|
|
51
|
+
};
|
|
52
|
+
export const toOperationsV3 = ({ paths, stackTrail, context }) => {
|
|
53
|
+
if (!paths) {
|
|
54
|
+
return [];
|
|
55
|
+
}
|
|
56
|
+
return Object.entries(paths).flatMap(([path, pathItem]) => {
|
|
57
|
+
return stackTrail.trace(path, pathStack => {
|
|
58
|
+
if (!pathItem) {
|
|
59
|
+
return [];
|
|
60
|
+
}
|
|
61
|
+
const fixedFields = dropAdditionalOperationsV3({ pathItem, stackTrail: pathStack, context });
|
|
62
|
+
const cleaned = Object.entries(fixedFields).reduce(({ rest, methodObject }, [key, operation]) => {
|
|
63
|
+
const method = toPathItemMethod(key);
|
|
64
|
+
if (method) {
|
|
65
|
+
const { [method]: _deleted, ...remaining } = rest;
|
|
66
|
+
return {
|
|
67
|
+
rest: remaining,
|
|
68
|
+
methodObject: {
|
|
69
|
+
...methodObject,
|
|
70
|
+
[method]: operation
|
|
71
|
+
}
|
|
72
|
+
};
|
|
73
|
+
}
|
|
74
|
+
return { rest, methodObject };
|
|
75
|
+
}, {
|
|
76
|
+
rest: fixedFields,
|
|
77
|
+
methodObject: {}
|
|
78
|
+
});
|
|
79
|
+
const pathItemResult = toPathItemResultV3({
|
|
80
|
+
pathItem: cleaned.rest,
|
|
81
|
+
stackTrail: pathStack,
|
|
82
|
+
context
|
|
83
|
+
});
|
|
84
|
+
if (!pathItemResult.valid) {
|
|
85
|
+
return [];
|
|
86
|
+
}
|
|
87
|
+
const pathItemObject = pathItemResult.pathItem;
|
|
88
|
+
return Object.entries(cleaned.methodObject)
|
|
89
|
+
.map(([method, operation]) => {
|
|
90
|
+
// Use `pathStack` (the trail with `path` already pushed),
|
|
91
|
+
// not the outer `stackTrail` — otherwise downstream traces
|
|
92
|
+
// record paths:<method>:... and lose the actual path
|
|
93
|
+
// segment, which breaks `OasDocument.removeItem` and the
|
|
94
|
+
// dependency-ref invalidation it backs.
|
|
95
|
+
return pathStack.trace(method, st => {
|
|
96
|
+
if (!operation) {
|
|
97
|
+
return;
|
|
98
|
+
}
|
|
99
|
+
try {
|
|
100
|
+
return toOperationV3({
|
|
101
|
+
operation,
|
|
102
|
+
operationInfo: {
|
|
103
|
+
method: method,
|
|
104
|
+
path,
|
|
105
|
+
pathItem: pathItemObject
|
|
106
|
+
},
|
|
107
|
+
stackTrail: st,
|
|
108
|
+
context
|
|
109
|
+
});
|
|
110
|
+
}
|
|
111
|
+
catch (error) {
|
|
112
|
+
const normalized = error instanceof Error ? error : new Error(String(error));
|
|
113
|
+
context.logIssue({
|
|
114
|
+
key: method,
|
|
115
|
+
parent: operation,
|
|
116
|
+
level: 'error',
|
|
117
|
+
message: normalized.message,
|
|
118
|
+
cause: normalized,
|
|
119
|
+
stackTrail: st,
|
|
120
|
+
type: 'INVALID_OPERATION'
|
|
121
|
+
});
|
|
122
|
+
return undefined;
|
|
123
|
+
}
|
|
124
|
+
});
|
|
125
|
+
})
|
|
126
|
+
.filter((item) => Boolean(item));
|
|
127
|
+
});
|
|
128
|
+
});
|
|
129
|
+
};
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import type { ParseContextType } from '../../../context/parseTypes.js';
|
|
2
|
+
import { type OasParameterLocation } from '../../../oas/parameter/parameter-types.js';
|
|
3
|
+
import type { OpenAPIV3 } from 'openapi-types';
|
|
4
|
+
import { OasParameter } from '../../../oas/parameter/Parameter.js';
|
|
5
|
+
import type { OasRef } from '../../../oas/ref/Ref.js';
|
|
6
|
+
import type { StackTrail } from '../../../context/StackTrail.js';
|
|
7
|
+
export type ToParameterListV3Args = {
|
|
8
|
+
parameters: (OpenAPIV3.ParameterObject | OpenAPIV3.ReferenceObject)[] | undefined;
|
|
9
|
+
stackTrail: StackTrail;
|
|
10
|
+
context: ParseContextType;
|
|
11
|
+
};
|
|
12
|
+
export declare const toParameterListV3: ({ parameters, stackTrail, context }: ToParameterListV3Args) => (OasParameter | OasRef<"parameter">)[] | undefined;
|
|
13
|
+
export type ToParametersV3Args = {
|
|
14
|
+
parameters: Record<string, OpenAPIV3.ParameterObject | OpenAPIV3.ReferenceObject>;
|
|
15
|
+
stackTrail: StackTrail;
|
|
16
|
+
context: ParseContextType;
|
|
17
|
+
};
|
|
18
|
+
export declare const toParametersV3: ({ parameters, stackTrail, context }: ToParametersV3Args) => Record<string, OasParameter | OasRef<"parameter">>;
|
|
19
|
+
export type ToOptionalParametersV3Args = {
|
|
20
|
+
parameters: Record<string, OpenAPIV3.ParameterObject | OpenAPIV3.ReferenceObject> | undefined;
|
|
21
|
+
stackTrail: StackTrail;
|
|
22
|
+
context: ParseContextType;
|
|
23
|
+
};
|
|
24
|
+
export declare const toOptionalParametersV3: ({ parameters, stackTrail, context }: ToOptionalParametersV3Args) => Record<string, OasParameter | OasRef<"parameter">> | undefined;
|
|
25
|
+
export type ToParameterV3Args = {
|
|
26
|
+
parameter: OpenAPIV3.ParameterObject | OpenAPIV3.ReferenceObject;
|
|
27
|
+
stackTrail: StackTrail;
|
|
28
|
+
context: ParseContextType;
|
|
29
|
+
};
|
|
30
|
+
export type ToStyleArgs = {
|
|
31
|
+
style: string | undefined;
|
|
32
|
+
location: OasParameterLocation;
|
|
33
|
+
stackTrail: StackTrail;
|
|
34
|
+
};
|
|
35
|
+
export type ToExplodeArgs = {
|
|
36
|
+
explode: boolean | undefined;
|
|
37
|
+
style: string | undefined;
|
|
38
|
+
stackTrail: StackTrail;
|
|
39
|
+
};
|
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
import { tryParseAt } from '../../../context/tryParseAt.js';
|
|
2
|
+
import { isRef } from '../../../helpers/refFns.js';
|
|
3
|
+
import { oasParameterLocation, oasParameterStyle } from '../../../oas/parameter/parameter-types.js';
|
|
4
|
+
import { toExamplesV3 } from '../example/toExamplesV3.js';
|
|
5
|
+
import { toRefV31 } from '../ref/toRefV31.js';
|
|
6
|
+
import { toOptionalSchemaV3 } from '../schema/toSchemasV3.js';
|
|
7
|
+
import { toOptionalMediaTypeItemsV3 } from '../mediaType/toMediaTypeItemV3.js';
|
|
8
|
+
import { OasParameter } from '../../../oas/parameter/Parameter.js';
|
|
9
|
+
import { toSpecificationExtensionsV3 } from '../specificationExtensions/toSpecificationExtensionsV3.js';
|
|
10
|
+
import * as v from 'valibot';
|
|
11
|
+
export const toParameterListV3 = ({ parameters, stackTrail, context }) => {
|
|
12
|
+
if (!parameters) {
|
|
13
|
+
return undefined;
|
|
14
|
+
}
|
|
15
|
+
return parameters.flatMap((parameter, index) => {
|
|
16
|
+
const querystringIssue = toQuerystringIssue(parameter);
|
|
17
|
+
if (querystringIssue) {
|
|
18
|
+
context.logIssue({
|
|
19
|
+
key: `${index}`,
|
|
20
|
+
parent: parameter,
|
|
21
|
+
level: 'error',
|
|
22
|
+
message: querystringIssue,
|
|
23
|
+
stackTrail,
|
|
24
|
+
type: 'INVALID_PARAMETER'
|
|
25
|
+
});
|
|
26
|
+
return [];
|
|
27
|
+
}
|
|
28
|
+
return [
|
|
29
|
+
stackTrail.trace(`${index}`, st => toParameterV3({ parameter, stackTrail: st, context }))
|
|
30
|
+
];
|
|
31
|
+
});
|
|
32
|
+
};
|
|
33
|
+
/**
|
|
34
|
+
* A `querystring` parameter describes the whole query string, so it must
|
|
35
|
+
* carry `content` with exactly one media type, and no `schema`. Returns
|
|
36
|
+
* the problem, or `undefined` when the parameter is valid or is not a
|
|
37
|
+
* `querystring` parameter.
|
|
38
|
+
*/
|
|
39
|
+
const toQuerystringIssue = (parameter) => {
|
|
40
|
+
if (isRef(parameter) || parameter.in !== 'querystring') {
|
|
41
|
+
return undefined;
|
|
42
|
+
}
|
|
43
|
+
if (parameter.schema || Object.keys(parameter.content ?? {}).length !== 1) {
|
|
44
|
+
return `Parameter '${parameter.name}' in querystring must define content with exactly one media type, and no schema`;
|
|
45
|
+
}
|
|
46
|
+
return undefined;
|
|
47
|
+
};
|
|
48
|
+
export const toParametersV3 = ({ parameters, stackTrail, context }) => {
|
|
49
|
+
const output = {};
|
|
50
|
+
const entries = Object.entries(parameters);
|
|
51
|
+
for (const [key, parameter] of entries) {
|
|
52
|
+
const parsed = tryParseAt({
|
|
53
|
+
stackTrail,
|
|
54
|
+
key,
|
|
55
|
+
context,
|
|
56
|
+
type: 'INVALID_PARAMETER',
|
|
57
|
+
parent: parameter,
|
|
58
|
+
fn: st => toParameterV3({ parameter, stackTrail: st, context })
|
|
59
|
+
});
|
|
60
|
+
if (parsed !== undefined) {
|
|
61
|
+
output[key] = parsed;
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
return output;
|
|
65
|
+
};
|
|
66
|
+
export const toOptionalParametersV3 = ({ parameters, stackTrail, context }) => {
|
|
67
|
+
if (!parameters) {
|
|
68
|
+
return undefined;
|
|
69
|
+
}
|
|
70
|
+
return toParametersV3({ parameters, stackTrail, context });
|
|
71
|
+
};
|
|
72
|
+
const toParameterV3 = ({ parameter, stackTrail, context }) => {
|
|
73
|
+
if (isRef(parameter)) {
|
|
74
|
+
return toRefV31({ ref: parameter, refType: 'parameter', stackTrail, context });
|
|
75
|
+
}
|
|
76
|
+
const querystringIssue = toQuerystringIssue(parameter);
|
|
77
|
+
if (querystringIssue) {
|
|
78
|
+
throw new Error(querystringIssue);
|
|
79
|
+
}
|
|
80
|
+
const { name, in: location, description, required, deprecated, allowEmptyValue, allowReserved, schema, example, examples, content, style, explode, ...skipped } = parameter;
|
|
81
|
+
const extensionFields = toSpecificationExtensionsV3({
|
|
82
|
+
skipped,
|
|
83
|
+
parent: parameter,
|
|
84
|
+
context,
|
|
85
|
+
stackTrail,
|
|
86
|
+
parentType: 'parameter'
|
|
87
|
+
});
|
|
88
|
+
const parsedLocation = v.parse(oasParameterLocation, location);
|
|
89
|
+
if (parsedLocation === 'path' && !required) {
|
|
90
|
+
console.warn(`Path parameters must be required`);
|
|
91
|
+
}
|
|
92
|
+
// Set missing 'required' to true for path parameters and false for others
|
|
93
|
+
const defaultRequired = typeof required === 'undefined' ? (parsedLocation === 'path' ? true : false) : required;
|
|
94
|
+
const fields = {
|
|
95
|
+
name,
|
|
96
|
+
location: parsedLocation,
|
|
97
|
+
description,
|
|
98
|
+
required: defaultRequired,
|
|
99
|
+
deprecated,
|
|
100
|
+
style: stackTrail.trace('style', st => toStyle({ style, location: parsedLocation, stackTrail: st })),
|
|
101
|
+
explode: stackTrail.trace('explode', st => toExplode({ explode, style, stackTrail: st })),
|
|
102
|
+
allowEmptyValue,
|
|
103
|
+
allowReserved,
|
|
104
|
+
schema: stackTrail.trace('schema', st => toOptionalSchemaV3({ schema, stackTrail: st, context })),
|
|
105
|
+
examples: stackTrail.trace('examples', st => toExamplesV3({
|
|
106
|
+
examples,
|
|
107
|
+
example,
|
|
108
|
+
exampleKey: `${name}-${parsedLocation}`,
|
|
109
|
+
stackTrail: st,
|
|
110
|
+
context
|
|
111
|
+
})),
|
|
112
|
+
content: stackTrail.trace('content', st => toOptionalMediaTypeItemsV3({ content, stackTrail: st, context })),
|
|
113
|
+
extensionFields
|
|
114
|
+
};
|
|
115
|
+
return context.withStackTrail(stackTrail, () => new OasParameter(fields, context));
|
|
116
|
+
};
|
|
117
|
+
const toStyle = ({ style, location, stackTrail }) => {
|
|
118
|
+
const parsed = v.parse(v.optional(oasParameterStyle), style);
|
|
119
|
+
if (parsed === 'cookie' && location !== 'cookie') {
|
|
120
|
+
throw new Error(`Style 'cookie' is only allowed for cookie parameters, not ${location}`);
|
|
121
|
+
}
|
|
122
|
+
if (parsed !== undefined) {
|
|
123
|
+
return parsed;
|
|
124
|
+
}
|
|
125
|
+
switch (location) {
|
|
126
|
+
case 'path':
|
|
127
|
+
case 'header':
|
|
128
|
+
return 'simple';
|
|
129
|
+
case 'query':
|
|
130
|
+
case 'cookie':
|
|
131
|
+
return 'form';
|
|
132
|
+
case 'querystring':
|
|
133
|
+
// A querystring parameter is serialized by its `content` media type.
|
|
134
|
+
return undefined;
|
|
135
|
+
default: {
|
|
136
|
+
const _exhaustive = location;
|
|
137
|
+
throw new Error(`Unhandled location: ${_exhaustive}`);
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
};
|
|
141
|
+
const toExplode = ({ explode, style, stackTrail }) => {
|
|
142
|
+
if (explode !== undefined) {
|
|
143
|
+
return explode;
|
|
144
|
+
}
|
|
145
|
+
switch (style) {
|
|
146
|
+
case 'form':
|
|
147
|
+
case 'cookie':
|
|
148
|
+
return true;
|
|
149
|
+
default:
|
|
150
|
+
return false;
|
|
151
|
+
}
|
|
152
|
+
};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { ParseContextType } from '../../../context/parseTypes.js';
|
|
2
|
+
import type { StackTrail } from '../../../context/StackTrail.js';
|
|
3
|
+
import type { OasParameter } from '../../../oas/parameter/Parameter.js';
|
|
4
|
+
import type { OasPathItem } from '../../../oas/pathItem/PathItem.js';
|
|
5
|
+
import type { OasRef } from '../../../oas/ref/Ref.js';
|
|
6
|
+
export type WarnQuerystringConflictsV3Args = {
|
|
7
|
+
parameters: (OasParameter | OasRef<'parameter'>)[] | undefined;
|
|
8
|
+
pathItem: OasPathItem | undefined;
|
|
9
|
+
stackTrail: StackTrail;
|
|
10
|
+
context: ParseContextType;
|
|
11
|
+
};
|
|
12
|
+
/**
|
|
13
|
+
* Logs an `INVALID_PARAMETER` warning on the operation's `parameters` when
|
|
14
|
+
* the operation and its path item together declare more than one
|
|
15
|
+
* `querystring` parameter, or a `querystring` parameter alongside an
|
|
16
|
+
* `in: query` parameter. An operation parameter replaces a path item
|
|
17
|
+
* parameter with the same name and location. The parameters are kept.
|
|
18
|
+
*
|
|
19
|
+
* Only inline parameters are checked: a `$ref` parameter cannot be
|
|
20
|
+
* resolved while the document is still being parsed.
|
|
21
|
+
*/
|
|
22
|
+
export declare const warnQuerystringConflictsV3: ({ parameters, pathItem, stackTrail, context }: WarnQuerystringConflictsV3Args) => void;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Logs an `INVALID_PARAMETER` warning on the operation's `parameters` when
|
|
3
|
+
* the operation and its path item together declare more than one
|
|
4
|
+
* `querystring` parameter, or a `querystring` parameter alongside an
|
|
5
|
+
* `in: query` parameter. An operation parameter replaces a path item
|
|
6
|
+
* parameter with the same name and location. The parameters are kept.
|
|
7
|
+
*
|
|
8
|
+
* Only inline parameters are checked: a `$ref` parameter cannot be
|
|
9
|
+
* resolved while the document is still being parsed.
|
|
10
|
+
*/
|
|
11
|
+
export const warnQuerystringConflictsV3 = ({ parameters, pathItem, stackTrail, context }) => {
|
|
12
|
+
const inlineParameters = [...(pathItem?.parameters ?? []), ...(parameters ?? [])].filter((parameter) => !parameter.isRef());
|
|
13
|
+
const merged = [
|
|
14
|
+
...new Map(inlineParameters.map(parameter => [`${parameter.location}:${parameter.name}`, parameter])).values()
|
|
15
|
+
];
|
|
16
|
+
const querystringCount = merged.filter(({ location }) => location === 'querystring').length;
|
|
17
|
+
if (querystringCount === 0) {
|
|
18
|
+
return;
|
|
19
|
+
}
|
|
20
|
+
const queryNames = merged.filter(({ location }) => location === 'query').map(({ name }) => name);
|
|
21
|
+
const messages = [
|
|
22
|
+
querystringCount > 1
|
|
23
|
+
? `Operation has ${querystringCount} querystring parameters. At most one is allowed.`
|
|
24
|
+
: undefined,
|
|
25
|
+
queryNames.length
|
|
26
|
+
? `A querystring parameter must not appear with query parameters (${queryNames.join(', ')}).`
|
|
27
|
+
: undefined
|
|
28
|
+
].filter((message) => Boolean(message));
|
|
29
|
+
messages.forEach(message => {
|
|
30
|
+
context.logIssue({
|
|
31
|
+
key: 'parameters',
|
|
32
|
+
parent: parameters,
|
|
33
|
+
level: 'warning',
|
|
34
|
+
message,
|
|
35
|
+
stackTrail,
|
|
36
|
+
type: 'INVALID_PARAMETER'
|
|
37
|
+
});
|
|
38
|
+
});
|
|
39
|
+
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { OpenAPIV3 } from 'openapi-types';
|
|
2
|
+
import type { ParseContextType } from '../../../context/parseTypes.js';
|
|
3
|
+
import type { StackTrail } from '../../../context/StackTrail.js';
|
|
4
|
+
export type DropAdditionalOperationsV3Args = {
|
|
5
|
+
pathItem: OpenAPIV3.PathItemObject;
|
|
6
|
+
stackTrail: StackTrail;
|
|
7
|
+
context: ParseContextType;
|
|
8
|
+
};
|
|
9
|
+
/**
|
|
10
|
+
* Removes the 3.2 `additionalOperations` map from a path item and logs one
|
|
11
|
+
* `UNSUPPORTED_OPERATION_METHOD` warning per entry, naming the method. The
|
|
12
|
+
* operations are dropped: no generator renders an arbitrary method yet.
|
|
13
|
+
*
|
|
14
|
+
* A value that is not a map (a primitive or an array) stays on the path
|
|
15
|
+
* item, so the path item parser reports it as a skipped field.
|
|
16
|
+
*/
|
|
17
|
+
export declare const dropAdditionalOperationsV3: ({ pathItem, stackTrail, context }: DropAdditionalOperationsV3Args) => OpenAPIV3.PathItemObject;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Removes the 3.2 `additionalOperations` map from a path item and logs one
|
|
3
|
+
* `UNSUPPORTED_OPERATION_METHOD` warning per entry, naming the method. The
|
|
4
|
+
* operations are dropped: no generator renders an arbitrary method yet.
|
|
5
|
+
*
|
|
6
|
+
* A value that is not a map (a primitive or an array) stays on the path
|
|
7
|
+
* item, so the path item parser reports it as a skipped field.
|
|
8
|
+
*/
|
|
9
|
+
export const dropAdditionalOperationsV3 = ({ pathItem, stackTrail, context }) => {
|
|
10
|
+
// `Object.hasOwn` is false for a primitive path item value, which the
|
|
11
|
+
// path item parser then reports as a skipped field.
|
|
12
|
+
if (!Object.hasOwn(pathItem, 'additionalOperations') || !('additionalOperations' in pathItem)) {
|
|
13
|
+
return pathItem;
|
|
14
|
+
}
|
|
15
|
+
const { additionalOperations, ...rest } = pathItem;
|
|
16
|
+
if (typeof additionalOperations !== 'object' ||
|
|
17
|
+
additionalOperations === null ||
|
|
18
|
+
Array.isArray(additionalOperations)) {
|
|
19
|
+
return pathItem;
|
|
20
|
+
}
|
|
21
|
+
stackTrail.trace('additionalOperations', st => {
|
|
22
|
+
Object.entries(additionalOperations).forEach(([method, operation]) => {
|
|
23
|
+
context.logIssue({
|
|
24
|
+
key: method,
|
|
25
|
+
parent: operation,
|
|
26
|
+
level: 'warning',
|
|
27
|
+
message: `Operation method '${method}' in additionalOperations is not supported. The operation is dropped.`,
|
|
28
|
+
stackTrail: st,
|
|
29
|
+
type: 'UNSUPPORTED_OPERATION_METHOD'
|
|
30
|
+
});
|
|
31
|
+
});
|
|
32
|
+
});
|
|
33
|
+
return rest;
|
|
34
|
+
};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { OpenAPIV3 } from 'openapi-types';
|
|
2
|
+
import type { ParseContextType } from '../../../context/parseTypes.js';
|
|
3
|
+
import { OasPathItem } from '../../../oas/pathItem/PathItem.js';
|
|
4
|
+
import type { StackTrail } from '../../../context/StackTrail.js';
|
|
5
|
+
export type ToPathItemV3Args = {
|
|
6
|
+
pathItem: OpenAPIV3.PathItemObject;
|
|
7
|
+
stackTrail: StackTrail;
|
|
8
|
+
context: ParseContextType;
|
|
9
|
+
};
|
|
10
|
+
export declare const toPathItemV3: ({ pathItem, stackTrail, context }: ToPathItemV3Args) => OasPathItem;
|
|
11
|
+
export type PathItemResult = {
|
|
12
|
+
valid: true;
|
|
13
|
+
pathItem: OasPathItem | undefined;
|
|
14
|
+
} | {
|
|
15
|
+
valid: false;
|
|
16
|
+
};
|
|
17
|
+
/**
|
|
18
|
+
* Parses a path item's shared fields without letting a throw escape. A
|
|
19
|
+
* path-level parameter that fails validation (for example `in: body`) logs
|
|
20
|
+
* one `INVALID_OPERATION` at the path and returns `{ valid: false }`, so
|
|
21
|
+
* the caller skips that path and keeps the rest.
|
|
22
|
+
*/
|
|
23
|
+
export declare const toPathItemResultV3: ({ pathItem, stackTrail, context }: ToPathItemV3Args) => PathItemResult;
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { toParameterListV3 } from '../parameter/toParameterV3.js';
|
|
2
|
+
import { OasPathItem } from '../../../oas/pathItem/PathItem.js';
|
|
3
|
+
import { toSpecificationExtensionsV3 } from '../specificationExtensions/toSpecificationExtensionsV3.js';
|
|
4
|
+
import { isEmpty } from '../../../helpers/isEmpty.js';
|
|
5
|
+
export const toPathItemV3 = ({ pathItem, stackTrail, context }) => {
|
|
6
|
+
const { summary, description, parameters, ...skipped } = pathItem;
|
|
7
|
+
return new OasPathItem({
|
|
8
|
+
summary,
|
|
9
|
+
description,
|
|
10
|
+
parameters: stackTrail.trace('parameters', st => toParameterListV3({ parameters, stackTrail: st, context })),
|
|
11
|
+
extensionFields: toSpecificationExtensionsV3({
|
|
12
|
+
skipped,
|
|
13
|
+
parent: pathItem,
|
|
14
|
+
context,
|
|
15
|
+
stackTrail,
|
|
16
|
+
parentType: 'pathItem'
|
|
17
|
+
})
|
|
18
|
+
});
|
|
19
|
+
};
|
|
20
|
+
/**
|
|
21
|
+
* Parses a path item's shared fields without letting a throw escape. A
|
|
22
|
+
* path-level parameter that fails validation (for example `in: body`) logs
|
|
23
|
+
* one `INVALID_OPERATION` at the path and returns `{ valid: false }`, so
|
|
24
|
+
* the caller skips that path and keeps the rest.
|
|
25
|
+
*/
|
|
26
|
+
export const toPathItemResultV3 = ({ pathItem, stackTrail, context }) => {
|
|
27
|
+
if (isEmpty(pathItem)) {
|
|
28
|
+
return { valid: true, pathItem: undefined };
|
|
29
|
+
}
|
|
30
|
+
try {
|
|
31
|
+
return { valid: true, pathItem: toPathItemV3({ pathItem, stackTrail, context }) };
|
|
32
|
+
}
|
|
33
|
+
catch (error) {
|
|
34
|
+
const normalized = error instanceof Error ? error : new Error(String(error));
|
|
35
|
+
context.logIssueNoKey({
|
|
36
|
+
parent: pathItem,
|
|
37
|
+
level: 'error',
|
|
38
|
+
message: normalized.message,
|
|
39
|
+
cause: normalized,
|
|
40
|
+
stackTrail,
|
|
41
|
+
type: 'INVALID_OPERATION'
|
|
42
|
+
});
|
|
43
|
+
return { valid: false };
|
|
44
|
+
}
|
|
45
|
+
};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { OpenAPIV3_1 } from 'openapi-types';
|
|
2
|
+
import type { OasRefData } from '../../../oas/ref/ref-types.js';
|
|
3
|
+
import type { ParseContextType } from '../../../context/parseTypes.js';
|
|
4
|
+
import { OasRef } from '../../../oas/ref/Ref.js';
|
|
5
|
+
import type { StackTrail } from '../../../context/StackTrail.js';
|
|
6
|
+
type ToRefV31Args<T extends OasRefData['refType']> = {
|
|
7
|
+
ref: OpenAPIV3_1.ReferenceObject;
|
|
8
|
+
refType: T;
|
|
9
|
+
stackTrail: StackTrail;
|
|
10
|
+
context: ParseContextType;
|
|
11
|
+
/**
|
|
12
|
+
* Use-site nullability to stamp on the OasRef node. Passed explicitly
|
|
13
|
+
* by the single-member `oneOf`/`anyOf` collapse for a nullable
|
|
14
|
+
* reference; omitted everywhere else (a plain `$ref` is non-nullable).
|
|
15
|
+
*/
|
|
16
|
+
nullable?: boolean;
|
|
17
|
+
};
|
|
18
|
+
export declare const toRefV31: <T extends OasRefData["refType"]>({ ref, refType, stackTrail, context, nullable }: ToRefV31Args<T>) => OasRef<T>;
|
|
19
|
+
export {};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { OasRef } from '../../../oas/ref/Ref.js';
|
|
2
|
+
import { isEmpty } from '../../../helpers/isEmpty.js';
|
|
3
|
+
export const toRefV31 = ({ ref, refType, stackTrail, context, nullable }) => {
|
|
4
|
+
const { $ref, ...skipped } = ref;
|
|
5
|
+
if (!isEmpty(skipped)) {
|
|
6
|
+
context.logSkippedFields({ skipped, parent: ref, parentType: 'ref', stackTrail });
|
|
7
|
+
}
|
|
8
|
+
context.registerRef(stackTrail.clone(), $ref);
|
|
9
|
+
return context.withStackTrail(stackTrail, () => new OasRef({ refType, $ref, nullable }, context));
|
|
10
|
+
};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { OpenAPIV3 } from 'openapi-types';
|
|
2
|
+
import type { ParseContextType } from '../../../context/parseTypes.js';
|
|
3
|
+
import { OasRequestBody } from '../../../oas/requestBody/RequestBody.js';
|
|
4
|
+
import type { OasRef } from '../../../oas/ref/Ref.js';
|
|
5
|
+
import type { StackTrail } from '../../../context/StackTrail.js';
|
|
6
|
+
export type ToRequestBodyV3Args = {
|
|
7
|
+
requestBody: OpenAPIV3.ReferenceObject | OpenAPIV3.RequestBodyObject | undefined;
|
|
8
|
+
forceRef?: boolean;
|
|
9
|
+
stackTrail: StackTrail;
|
|
10
|
+
context: ParseContextType;
|
|
11
|
+
};
|
|
12
|
+
export declare const toRequestBodyV3: ({ requestBody, stackTrail, context }: ToRequestBodyV3Args) => OasRequestBody | OasRef<"requestBody"> | undefined;
|
|
13
|
+
export type ToRequestBodiesV3Args = {
|
|
14
|
+
requestBodies: Record<string, OpenAPIV3.ReferenceObject | OpenAPIV3.RequestBodyObject> | undefined;
|
|
15
|
+
stackTrail: StackTrail;
|
|
16
|
+
context: ParseContextType;
|
|
17
|
+
};
|
|
18
|
+
export declare const toRequestBodiesV3: ({ requestBodies, stackTrail, context }: ToRequestBodiesV3Args) => Record<string, OasRequestBody | OasRef<"requestBody">> | undefined;
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { isRef } from '../../../helpers/refFns.js';
|
|
2
|
+
import { toRefV31 } from '../ref/toRefV31.js';
|
|
3
|
+
import { toMediaTypeItemsV3 } from '../mediaType/toMediaTypeItemV3.js';
|
|
4
|
+
import { OasRequestBody } from '../../../oas/requestBody/RequestBody.js';
|
|
5
|
+
import { toSpecificationExtensionsV3 } from '../specificationExtensions/toSpecificationExtensionsV3.js';
|
|
6
|
+
export const toRequestBodyV3 = ({ requestBody, stackTrail, context }) => {
|
|
7
|
+
if (!requestBody) {
|
|
8
|
+
return undefined;
|
|
9
|
+
}
|
|
10
|
+
if (isRef(requestBody)) {
|
|
11
|
+
return toRefV31({ ref: requestBody, refType: 'requestBody', stackTrail, context });
|
|
12
|
+
}
|
|
13
|
+
const { description, content, required, ...skipped } = requestBody;
|
|
14
|
+
const extensionFields = toSpecificationExtensionsV3({
|
|
15
|
+
skipped,
|
|
16
|
+
parent: requestBody,
|
|
17
|
+
context,
|
|
18
|
+
stackTrail,
|
|
19
|
+
parentType: 'requestBody'
|
|
20
|
+
});
|
|
21
|
+
const fields = {
|
|
22
|
+
description,
|
|
23
|
+
content: stackTrail.trace('content', st => {
|
|
24
|
+
return toMediaTypeItemsV3({ content, stackTrail: st, context });
|
|
25
|
+
}),
|
|
26
|
+
required,
|
|
27
|
+
extensionFields
|
|
28
|
+
};
|
|
29
|
+
return context.withStackTrail(stackTrail, () => new OasRequestBody(fields, context));
|
|
30
|
+
};
|
|
31
|
+
export const toRequestBodiesV3 = ({ requestBodies, stackTrail, context }) => {
|
|
32
|
+
if (!requestBodies) {
|
|
33
|
+
return undefined;
|
|
34
|
+
}
|
|
35
|
+
const entries = Object.entries(requestBodies)
|
|
36
|
+
.map(([key, value]) => {
|
|
37
|
+
return [
|
|
38
|
+
key,
|
|
39
|
+
stackTrail.trace(key, st => toRequestBodyV3({ requestBody: value, stackTrail: st, context }))
|
|
40
|
+
];
|
|
41
|
+
})
|
|
42
|
+
.filter(([, value]) => Boolean(value));
|
|
43
|
+
return Object.fromEntries(entries);
|
|
44
|
+
};
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import type { ParseContextType } from '../../../context/parseTypes.js';
|
|
2
|
+
import type { OpenAPIV3 } from 'openapi-types';
|
|
3
|
+
import { OasResponse } from '../../../oas/response/Response.js';
|
|
4
|
+
import type { OasRef } from '../../../oas/ref/Ref.js';
|
|
5
|
+
import type { StackTrail } from '../../../context/StackTrail.js';
|
|
6
|
+
/** A 3.2 Response Object: the 3.0 shape plus `summary`. */
|
|
7
|
+
export type ResponseObjectV32 = OpenAPIV3.ResponseObject & {
|
|
8
|
+
summary?: string;
|
|
9
|
+
};
|
|
10
|
+
/** A 3.2 Responses Object: status code to a 3.2 Response Object or a reference. */
|
|
11
|
+
export type ResponsesObjectV32 = Record<string, OpenAPIV3.ReferenceObject | ResponseObjectV32>;
|
|
12
|
+
export type ToResponsesV3Args = {
|
|
13
|
+
responses: ResponsesObjectV32;
|
|
14
|
+
stackTrail: StackTrail;
|
|
15
|
+
context: ParseContextType;
|
|
16
|
+
};
|
|
17
|
+
export declare const toResponsesV3: ({ responses, stackTrail, context }: ToResponsesV3Args) => Record<string, OasResponse | OasRef<"response">>;
|
|
18
|
+
export type ToOptionalResponsesV3Args = {
|
|
19
|
+
responses: ResponsesObjectV32 | undefined;
|
|
20
|
+
stackTrail: StackTrail;
|
|
21
|
+
context: ParseContextType;
|
|
22
|
+
};
|
|
23
|
+
export declare const toOptionalResponsesV3: ({ responses, stackTrail, context }: ToOptionalResponsesV3Args) => Record<string, OasResponse | OasRef<"response">> | undefined;
|
|
24
|
+
export type ToResponseV3Args = {
|
|
25
|
+
response: OpenAPIV3.ReferenceObject | ResponseObjectV32;
|
|
26
|
+
stackTrail: StackTrail;
|
|
27
|
+
context: ParseContextType;
|
|
28
|
+
};
|
|
29
|
+
export declare const toResponseV3: ({ response, stackTrail, context }: ToResponseV3Args) => OasResponse | OasRef<"response">;
|