@skmtc/core 0.29.0 → 0.31.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/esm/_dnt.polyfills.d.ts +11 -0
- package/esm/_dnt.polyfills.js +14 -0
- package/esm/context/ParseContext.js +9 -1
- package/esm/context/generateTypes.d.ts +14 -2
- package/esm/context/generateTypes.js +5 -1
- package/esm/dsl/GeneratorKeys.d.ts +2 -2
- package/esm/dsl/GeneratorKeys.js +6 -3
- package/esm/helpers/naming.d.ts +2 -1
- package/esm/helpers/naming.js +4 -2
- package/esm/mod.d.ts +1 -0
- package/esm/mod.js +1 -0
- package/esm/oas/discriminator/Discriminator.d.ts +3 -0
- package/esm/oas/discriminator/Discriminator.js +7 -0
- package/esm/oas/document/Document.d.ts +7 -0
- package/esm/oas/document/Document.js +8 -0
- package/esm/oas/example/Example.d.ts +10 -1
- package/esm/oas/example/Example.js +16 -0
- package/esm/oas/header/Header.d.ts +4 -2
- package/esm/oas/header/Header.js +12 -5
- package/esm/oas/mediaType/MediaType.d.ts +12 -0
- package/esm/oas/mediaType/MediaType.js +24 -0
- package/esm/oas/mediaType/jsonMediaType.d.ts +50 -0
- package/esm/oas/mediaType/jsonMediaType.js +64 -0
- package/esm/oas/mediaType/toContentSchema.d.ts +8 -0
- package/esm/oas/mediaType/toContentSchema.js +6 -0
- package/esm/oas/operation/Operation.d.ts +10 -2
- package/esm/oas/operation/Operation.js +20 -7
- package/esm/oas/parameter/Parameter.d.ts +3 -2
- package/esm/oas/parameter/Parameter.js +11 -5
- package/esm/oas/parameter/parameter-types.d.ts +10 -2
- package/esm/oas/parameter/parameter-types.js +3 -1
- package/esm/oas/requestBody/RequestBody.d.ts +11 -0
- package/esm/oas/requestBody/RequestBody.js +16 -2
- package/esm/oas/response/Response.d.ts +17 -1
- package/esm/oas/response/Response.js +24 -2
- package/esm/oas/securitySchemes/SecurityScheme.d.ts +47 -4
- package/esm/oas/securitySchemes/SecurityScheme.js +46 -1
- package/esm/oas/securitySchemes/security-scheme-types.d.ts +21 -0
- package/esm/oas/server/Server.d.ts +8 -2
- package/esm/oas/server/Server.js +10 -1
- package/esm/oas/tag/Tag.d.ts +9 -0
- package/esm/oas/tag/Tag.js +9 -0
- package/esm/oas/webhook/Webhook.d.ts +4 -4
- package/esm/oas/webhook/Webhook.js +6 -6
- package/esm/parse/logBodyMediaTypes.d.ts +27 -0
- package/esm/parse/logBodyMediaTypes.js +50 -0
- package/esm/parse/toOasDialect.d.ts +8 -7
- package/esm/parse/toOasDialect.js +4 -2
- package/esm/parse/v3-0/methods.d.ts +11 -0
- package/esm/parse/v3-0/methods.js +16 -0
- package/esm/parse/v3-0/operation/toOperationsV3.js +5 -5
- package/esm/parse/v3-0/parameter/toParameterV3.d.ts +4 -2
- package/esm/parse/v3-0/parameter/toParameterV3.js +17 -3
- package/esm/parse/v3-0/requestBody/toRequestBodiesV3.js +4 -1
- package/esm/parse/v3-0/response/toResponseV3.js +4 -1
- package/esm/parse/v3-0/securitySchemes/toSecuritySchemes.js +50 -38
- package/esm/parse/v3-0/webhook/toWebhooksV3.js +5 -5
- package/esm/parse/v3-1/methods.d.ts +11 -0
- package/esm/parse/v3-1/methods.js +16 -0
- package/esm/parse/v3-1/operation/toOperationsV3.js +5 -5
- package/esm/parse/v3-1/parameter/toParameterV3.d.ts +4 -2
- package/esm/parse/v3-1/parameter/toParameterV3.js +17 -3
- package/esm/parse/v3-1/requestBody/toRequestBodiesV3.js +4 -1
- package/esm/parse/v3-1/response/toResponseV3.js +4 -1
- package/esm/parse/v3-1/securitySchemes/toSecuritySchemes.js +50 -38
- package/esm/parse/v3-1/webhook/toWebhooksV3.js +5 -5
- package/esm/parse/v3-2/_helpers/parseDefault.d.ts +43 -0
- package/esm/parse/v3-2/_helpers/parseDefault.js +39 -0
- package/esm/parse/v3-2/_helpers/parseEnum.d.ts +13 -0
- package/esm/parse/v3-2/_helpers/parseEnum.js +23 -0
- package/esm/parse/v3-2/_helpers/parseExample.d.ts +41 -0
- package/esm/parse/v3-2/_helpers/parseExample.js +37 -0
- package/esm/parse/v3-2/_helpers/parseNullable.d.ts +141 -0
- package/esm/parse/v3-2/_helpers/parseNullable.js +140 -0
- package/esm/parse/v3-2/_merge-all-of/check-array-item-type-conflicts.d.ts +2 -0
- package/esm/parse/v3-2/_merge-all-of/check-array-item-type-conflicts.js +9 -0
- package/esm/parse/v3-2/_merge-all-of/check-at-least-one-type-match.d.ts +4 -0
- package/esm/parse/v3-2/_merge-all-of/check-at-least-one-type-match.js +5 -0
- package/esm/parse/v3-2/_merge-all-of/check-enum-conflicts.d.ts +2 -0
- package/esm/parse/v3-2/_merge-all-of/check-enum-conflicts.js +11 -0
- package/esm/parse/v3-2/_merge-all-of/check-format-conflicts.d.ts +2 -0
- package/esm/parse/v3-2/_merge-all-of/check-format-conflicts.js +5 -0
- package/esm/parse/v3-2/_merge-all-of/check-number-constraints-conflicts.d.ts +2 -0
- package/esm/parse/v3-2/_merge-all-of/check-number-constraints-conflicts.js +11 -0
- package/esm/parse/v3-2/_merge-all-of/check-read-only-write-only-conflicts.d.ts +2 -0
- package/esm/parse/v3-2/_merge-all-of/check-read-only-write-only-conflicts.js +5 -0
- package/esm/parse/v3-2/_merge-all-of/check-type-conflicts.d.ts +2 -0
- package/esm/parse/v3-2/_merge-all-of/check-type-conflicts.js +5 -0
- package/esm/parse/v3-2/_merge-all-of/cross-product.d.ts +2 -0
- package/esm/parse/v3-2/_merge-all-of/cross-product.js +3 -0
- package/esm/parse/v3-2/_merge-all-of/decompose-intersection.d.ts +6 -0
- package/esm/parse/v3-2/_merge-all-of/decompose-intersection.js +27 -0
- package/esm/parse/v3-2/_merge-all-of/decompose-union.d.ts +12 -0
- package/esm/parse/v3-2/_merge-all-of/decompose-union.js +69 -0
- package/esm/parse/v3-2/_merge-all-of/generic-merge.d.ts +3 -0
- package/esm/parse/v3-2/_merge-all-of/generic-merge.js +12 -0
- package/esm/parse/v3-2/_merge-all-of/is-equal.d.ts +1 -0
- package/esm/parse/v3-2/_merge-all-of/is-equal.js +19 -0
- package/esm/parse/v3-2/_merge-all-of/merge-array-constraints.d.ts +2 -0
- package/esm/parse/v3-2/_merge-all-of/merge-array-constraints.js +44 -0
- package/esm/parse/v3-2/_merge-all-of/merge-boolean-constraints.d.ts +3 -0
- package/esm/parse/v3-2/_merge-all-of/merge-boolean-constraints.js +7 -0
- package/esm/parse/v3-2/_merge-all-of/merge-enum-values.d.ts +3 -0
- package/esm/parse/v3-2/_merge-all-of/merge-enum-values.js +32 -0
- package/esm/parse/v3-2/_merge-all-of/merge-integer-constraints.d.ts +3 -0
- package/esm/parse/v3-2/_merge-all-of/merge-integer-constraints.js +41 -0
- package/esm/parse/v3-2/_merge-all-of/merge-intersection.d.ts +8 -0
- package/esm/parse/v3-2/_merge-all-of/merge-intersection.js +16 -0
- package/esm/parse/v3-2/_merge-all-of/merge-number-constraints.d.ts +3 -0
- package/esm/parse/v3-2/_merge-all-of/merge-number-constraints.js +41 -0
- package/esm/parse/v3-2/_merge-all-of/merge-object-constraints.d.ts +5 -0
- package/esm/parse/v3-2/_merge-all-of/merge-object-constraints.js +28 -0
- package/esm/parse/v3-2/_merge-all-of/merge-properties.d.ts +2 -0
- package/esm/parse/v3-2/_merge-all-of/merge-properties.js +25 -0
- package/esm/parse/v3-2/_merge-all-of/merge-required.d.ts +3 -0
- package/esm/parse/v3-2/_merge-all-of/merge-required.js +10 -0
- package/esm/parse/v3-2/_merge-all-of/merge-string-constraints.d.ts +3 -0
- package/esm/parse/v3-2/_merge-all-of/merge-string-constraints.js +55 -0
- package/esm/parse/v3-2/_merge-all-of/merge-union.d.ts +15 -0
- package/esm/parse/v3-2/_merge-all-of/merge-union.js +53 -0
- package/esm/parse/v3-2/_merge-all-of/merge.d.ts +2 -0
- package/esm/parse/v3-2/_merge-all-of/merge.js +155 -0
- package/esm/parse/v3-2/_merge-all-of/nullable-merge.d.ts +3 -0
- package/esm/parse/v3-2/_merge-all-of/nullable-merge.js +12 -0
- package/esm/parse/v3-2/_merge-all-of/types.d.ts +14 -0
- package/esm/parse/v3-2/_merge-all-of/types.js +2 -0
- package/esm/parse/v3-2/array/toArray.d.ts +80 -0
- package/esm/parse/v3-2/array/toArray.js +165 -0
- package/esm/parse/v3-2/boolean/toBoolean.d.ts +78 -0
- package/esm/parse/v3-2/boolean/toBoolean.js +139 -0
- package/esm/parse/v3-2/components/toComponentsV3.d.ts +14 -0
- package/esm/parse/v3-2/components/toComponentsV3.js +43 -0
- package/esm/parse/v3-2/contact/toContactV3.d.ts +5 -0
- package/esm/parse/v3-2/contact/toContactV3.js +18 -0
- package/esm/parse/v3-2/discriminator/toDiscriminatorV3.d.ts +14 -0
- package/esm/parse/v3-2/discriminator/toDiscriminatorV3.js +21 -0
- package/esm/parse/v3-2/document/toDocumentFieldsV3.d.ts +16 -0
- package/esm/parse/v3-2/document/toDocumentFieldsV3.js +33 -0
- package/esm/parse/v3-2/example/toExamplesV3.d.ts +77 -0
- package/esm/parse/v3-2/example/toExamplesV3.js +143 -0
- package/esm/parse/v3-2/externalDocs/toExternalDocs.d.ts +10 -0
- package/esm/parse/v3-2/externalDocs/toExternalDocs.js +15 -0
- package/esm/parse/v3-2/header/toHeadersV3.d.ts +18 -0
- package/esm/parse/v3-2/header/toHeadersV3.js +47 -0
- package/esm/parse/v3-2/info/toInfoV3.d.ts +10 -0
- package/esm/parse/v3-2/info/toInfoV3.js +23 -0
- package/esm/parse/v3-2/integer/toInteger.d.ts +21 -0
- package/esm/parse/v3-2/integer/toInteger.js +115 -0
- package/esm/parse/v3-2/license/toLicenseV3.d.ts +5 -0
- package/esm/parse/v3-2/license/toLicenseV3.js +17 -0
- package/esm/parse/v3-2/link/toLinksV3.d.ts +16 -0
- package/esm/parse/v3-2/link/toLinksV3.js +40 -0
- package/esm/parse/v3-2/mediaType/toMediaTypeItemV3.d.ts +323 -0
- package/esm/parse/v3-2/mediaType/toMediaTypeItemV3.js +375 -0
- package/esm/parse/v3-2/methods.d.ts +17 -0
- package/esm/parse/v3-2/methods.js +21 -0
- package/esm/parse/v3-2/number/toNumber.d.ts +10 -0
- package/esm/parse/v3-2/number/toNumber.js +115 -0
- package/esm/parse/v3-2/object/toAdditionalPropertiesV3.d.ts +11 -0
- package/esm/parse/v3-2/object/toAdditionalPropertiesV3.js +10 -0
- package/esm/parse/v3-2/object/toObject.d.ts +10 -0
- package/esm/parse/v3-2/object/toObject.js +90 -0
- package/esm/parse/v3-2/operation/toOperationsV3.d.ts +25 -0
- package/esm/parse/v3-2/operation/toOperationsV3.js +129 -0
- package/esm/parse/v3-2/parameter/toParameterV3.d.ts +39 -0
- package/esm/parse/v3-2/parameter/toParameterV3.js +152 -0
- package/esm/parse/v3-2/parameter/warnQuerystringConflictsV3.d.ts +22 -0
- package/esm/parse/v3-2/parameter/warnQuerystringConflictsV3.js +39 -0
- package/esm/parse/v3-2/pathItem/dropAdditionalOperationsV3.d.ts +17 -0
- package/esm/parse/v3-2/pathItem/dropAdditionalOperationsV3.js +34 -0
- package/esm/parse/v3-2/pathItem/toPathItemV3.d.ts +23 -0
- package/esm/parse/v3-2/pathItem/toPathItemV3.js +45 -0
- package/esm/parse/v3-2/ref/toRefV31.d.ts +19 -0
- package/esm/parse/v3-2/ref/toRefV31.js +10 -0
- package/esm/parse/v3-2/requestBody/toRequestBodiesV3.d.ts +18 -0
- package/esm/parse/v3-2/requestBody/toRequestBodiesV3.js +47 -0
- package/esm/parse/v3-2/response/toResponseV3.d.ts +29 -0
- package/esm/parse/v3-2/response/toResponseV3.js +59 -0
- package/esm/parse/v3-2/schema/toSchemasV3.d.ts +29 -0
- package/esm/parse/v3-2/schema/toSchemasV3.js +511 -0
- package/esm/parse/v3-2/securityRequirement/toSecurityRequirement.d.ts +9 -0
- package/esm/parse/v3-2/securityRequirement/toSecurityRequirement.js +9 -0
- package/esm/parse/v3-2/securitySchemes/toSecuritySchemes.d.ts +17 -0
- package/esm/parse/v3-2/securitySchemes/toSecuritySchemes.js +152 -0
- package/esm/parse/v3-2/server/toServerV3.d.ts +26 -0
- package/esm/parse/v3-2/server/toServerV3.js +31 -0
- package/esm/parse/v3-2/serverVariable/toServerVariableV3.d.ts +22 -0
- package/esm/parse/v3-2/serverVariable/toServerVariableV3.js +30 -0
- package/esm/parse/v3-2/specificationExtensions/toSpecificationExtensionsV3.d.ts +14 -0
- package/esm/parse/v3-2/specificationExtensions/toSpecificationExtensionsV3.js +25 -0
- package/esm/parse/v3-2/string/toString.d.ts +146 -0
- package/esm/parse/v3-2/string/toString.js +211 -0
- package/esm/parse/v3-2/tag/toTagsV3.d.ts +22 -0
- package/esm/parse/v3-2/tag/toTagsV3.js +78 -0
- package/esm/parse/v3-2/union/toUnion.d.ts +12 -0
- package/esm/parse/v3-2/union/toUnion.js +68 -0
- package/esm/parse/v3-2/unknown/toUnknown.d.ts +10 -0
- package/esm/parse/v3-2/unknown/toUnknown.js +19 -0
- package/esm/parse/v3-2/webhook/toWebhooksV3.d.ts +48 -0
- package/esm/parse/v3-2/webhook/toWebhooksV3.js +139 -0
- package/esm/types/Method.d.ts +7 -4
- package/esm/types/Method.js +17 -4
- package/esm/types/Preview.d.ts +2 -1
- package/esm/types/SkmtcDocument.d.ts +6 -6
- package/package.json +1 -1
- package/script/_dnt.polyfills.d.ts +11 -0
- package/script/_dnt.polyfills.js +14 -0
- package/script/context/ParseContext.js +9 -1
- package/script/context/generateTypes.d.ts +14 -2
- package/script/context/generateTypes.js +5 -1
- package/script/dsl/GeneratorKeys.d.ts +2 -2
- package/script/dsl/GeneratorKeys.js +6 -3
- package/script/helpers/naming.d.ts +2 -1
- package/script/helpers/naming.js +4 -2
- package/script/mod.d.ts +1 -0
- package/script/mod.js +1 -0
- package/script/oas/discriminator/Discriminator.d.ts +3 -0
- package/script/oas/discriminator/Discriminator.js +7 -0
- package/script/oas/document/Document.d.ts +7 -0
- package/script/oas/document/Document.js +8 -0
- package/script/oas/example/Example.d.ts +10 -1
- package/script/oas/example/Example.js +16 -0
- package/script/oas/header/Header.d.ts +4 -2
- package/script/oas/header/Header.js +12 -5
- package/script/oas/mediaType/MediaType.d.ts +12 -0
- package/script/oas/mediaType/MediaType.js +24 -0
- package/script/oas/mediaType/jsonMediaType.d.ts +50 -0
- package/script/oas/mediaType/jsonMediaType.js +71 -0
- package/script/oas/mediaType/toContentSchema.d.ts +8 -0
- package/script/oas/mediaType/toContentSchema.js +10 -0
- package/script/oas/operation/Operation.d.ts +10 -2
- package/script/oas/operation/Operation.js +20 -7
- package/script/oas/parameter/Parameter.d.ts +3 -2
- package/script/oas/parameter/Parameter.js +11 -5
- package/script/oas/parameter/parameter-types.d.ts +10 -2
- package/script/oas/parameter/parameter-types.js +3 -1
- package/script/oas/requestBody/RequestBody.d.ts +11 -0
- package/script/oas/requestBody/RequestBody.js +16 -2
- package/script/oas/response/Response.d.ts +17 -1
- package/script/oas/response/Response.js +24 -2
- package/script/oas/securitySchemes/SecurityScheme.d.ts +47 -4
- package/script/oas/securitySchemes/SecurityScheme.js +46 -1
- package/script/oas/securitySchemes/security-scheme-types.d.ts +21 -0
- package/script/oas/server/Server.d.ts +8 -2
- package/script/oas/server/Server.js +10 -1
- package/script/oas/tag/Tag.d.ts +9 -0
- package/script/oas/tag/Tag.js +9 -0
- package/script/oas/webhook/Webhook.d.ts +4 -4
- package/script/oas/webhook/Webhook.js +6 -6
- package/script/parse/logBodyMediaTypes.d.ts +27 -0
- package/script/parse/logBodyMediaTypes.js +54 -0
- package/script/parse/toOasDialect.d.ts +8 -7
- package/script/parse/toOasDialect.js +4 -2
- package/script/parse/v3-0/methods.d.ts +11 -0
- package/script/parse/v3-0/methods.js +20 -0
- package/script/parse/v3-0/operation/toOperationsV3.js +5 -5
- package/script/parse/v3-0/parameter/toParameterV3.d.ts +4 -2
- package/script/parse/v3-0/parameter/toParameterV3.js +17 -3
- package/script/parse/v3-0/requestBody/toRequestBodiesV3.js +4 -1
- package/script/parse/v3-0/response/toResponseV3.js +4 -1
- package/script/parse/v3-0/securitySchemes/toSecuritySchemes.js +49 -37
- package/script/parse/v3-0/webhook/toWebhooksV3.js +5 -5
- package/script/parse/v3-1/methods.d.ts +11 -0
- package/script/parse/v3-1/methods.js +20 -0
- package/script/parse/v3-1/operation/toOperationsV3.js +5 -5
- package/script/parse/v3-1/parameter/toParameterV3.d.ts +4 -2
- package/script/parse/v3-1/parameter/toParameterV3.js +17 -3
- package/script/parse/v3-1/requestBody/toRequestBodiesV3.js +4 -1
- package/script/parse/v3-1/response/toResponseV3.js +4 -1
- package/script/parse/v3-1/securitySchemes/toSecuritySchemes.js +49 -37
- package/script/parse/v3-1/webhook/toWebhooksV3.js +5 -5
- package/script/parse/v3-2/_helpers/parseDefault.d.ts +43 -0
- package/script/parse/v3-2/_helpers/parseDefault.js +43 -0
- package/script/parse/v3-2/_helpers/parseEnum.d.ts +13 -0
- package/script/parse/v3-2/_helpers/parseEnum.js +27 -0
- package/script/parse/v3-2/_helpers/parseExample.d.ts +41 -0
- package/script/parse/v3-2/_helpers/parseExample.js +41 -0
- package/script/parse/v3-2/_helpers/parseNullable.d.ts +141 -0
- package/script/parse/v3-2/_helpers/parseNullable.js +144 -0
- package/script/parse/v3-2/_merge-all-of/check-array-item-type-conflicts.d.ts +2 -0
- package/script/parse/v3-2/_merge-all-of/check-array-item-type-conflicts.js +13 -0
- package/script/parse/v3-2/_merge-all-of/check-at-least-one-type-match.d.ts +4 -0
- package/script/parse/v3-2/_merge-all-of/check-at-least-one-type-match.js +9 -0
- package/script/parse/v3-2/_merge-all-of/check-enum-conflicts.d.ts +2 -0
- package/script/parse/v3-2/_merge-all-of/check-enum-conflicts.js +15 -0
- package/script/parse/v3-2/_merge-all-of/check-format-conflicts.d.ts +2 -0
- package/script/parse/v3-2/_merge-all-of/check-format-conflicts.js +9 -0
- package/script/parse/v3-2/_merge-all-of/check-number-constraints-conflicts.d.ts +2 -0
- package/script/parse/v3-2/_merge-all-of/check-number-constraints-conflicts.js +15 -0
- package/script/parse/v3-2/_merge-all-of/check-read-only-write-only-conflicts.d.ts +2 -0
- package/script/parse/v3-2/_merge-all-of/check-read-only-write-only-conflicts.js +9 -0
- package/script/parse/v3-2/_merge-all-of/check-type-conflicts.d.ts +2 -0
- package/script/parse/v3-2/_merge-all-of/check-type-conflicts.js +9 -0
- package/script/parse/v3-2/_merge-all-of/cross-product.d.ts +2 -0
- package/script/parse/v3-2/_merge-all-of/cross-product.js +7 -0
- package/script/parse/v3-2/_merge-all-of/decompose-intersection.d.ts +6 -0
- package/script/parse/v3-2/_merge-all-of/decompose-intersection.js +31 -0
- package/script/parse/v3-2/_merge-all-of/decompose-union.d.ts +12 -0
- package/script/parse/v3-2/_merge-all-of/decompose-union.js +73 -0
- package/script/parse/v3-2/_merge-all-of/generic-merge.d.ts +3 -0
- package/script/parse/v3-2/_merge-all-of/generic-merge.js +16 -0
- package/script/parse/v3-2/_merge-all-of/is-equal.d.ts +1 -0
- package/script/parse/v3-2/_merge-all-of/is-equal.js +23 -0
- package/script/parse/v3-2/_merge-all-of/merge-array-constraints.d.ts +2 -0
- package/script/parse/v3-2/_merge-all-of/merge-array-constraints.js +80 -0
- package/script/parse/v3-2/_merge-all-of/merge-boolean-constraints.d.ts +3 -0
- package/script/parse/v3-2/_merge-all-of/merge-boolean-constraints.js +43 -0
- package/script/parse/v3-2/_merge-all-of/merge-enum-values.d.ts +3 -0
- package/script/parse/v3-2/_merge-all-of/merge-enum-values.js +68 -0
- package/script/parse/v3-2/_merge-all-of/merge-integer-constraints.d.ts +3 -0
- package/script/parse/v3-2/_merge-all-of/merge-integer-constraints.js +77 -0
- package/script/parse/v3-2/_merge-all-of/merge-intersection.d.ts +8 -0
- package/script/parse/v3-2/_merge-all-of/merge-intersection.js +20 -0
- package/script/parse/v3-2/_merge-all-of/merge-number-constraints.d.ts +3 -0
- package/script/parse/v3-2/_merge-all-of/merge-number-constraints.js +77 -0
- package/script/parse/v3-2/_merge-all-of/merge-object-constraints.d.ts +5 -0
- package/script/parse/v3-2/_merge-all-of/merge-object-constraints.js +65 -0
- package/script/parse/v3-2/_merge-all-of/merge-properties.d.ts +2 -0
- package/script/parse/v3-2/_merge-all-of/merge-properties.js +29 -0
- package/script/parse/v3-2/_merge-all-of/merge-required.d.ts +3 -0
- package/script/parse/v3-2/_merge-all-of/merge-required.js +15 -0
- package/script/parse/v3-2/_merge-all-of/merge-string-constraints.d.ts +3 -0
- package/script/parse/v3-2/_merge-all-of/merge-string-constraints.js +91 -0
- package/script/parse/v3-2/_merge-all-of/merge-union.d.ts +15 -0
- package/script/parse/v3-2/_merge-all-of/merge-union.js +58 -0
- package/script/parse/v3-2/_merge-all-of/merge.d.ts +2 -0
- package/script/parse/v3-2/_merge-all-of/merge.js +159 -0
- package/script/parse/v3-2/_merge-all-of/nullable-merge.d.ts +3 -0
- package/script/parse/v3-2/_merge-all-of/nullable-merge.js +17 -0
- package/script/parse/v3-2/_merge-all-of/types.d.ts +14 -0
- package/script/parse/v3-2/_merge-all-of/types.js +38 -0
- package/script/parse/v3-2/array/toArray.d.ts +80 -0
- package/script/parse/v3-2/array/toArray.js +203 -0
- package/script/parse/v3-2/boolean/toBoolean.d.ts +78 -0
- package/script/parse/v3-2/boolean/toBoolean.js +177 -0
- package/script/parse/v3-2/components/toComponentsV3.d.ts +14 -0
- package/script/parse/v3-2/components/toComponentsV3.js +47 -0
- package/script/parse/v3-2/contact/toContactV3.d.ts +5 -0
- package/script/parse/v3-2/contact/toContactV3.js +22 -0
- package/script/parse/v3-2/discriminator/toDiscriminatorV3.d.ts +14 -0
- package/script/parse/v3-2/discriminator/toDiscriminatorV3.js +25 -0
- package/script/parse/v3-2/document/toDocumentFieldsV3.d.ts +16 -0
- package/script/parse/v3-2/document/toDocumentFieldsV3.js +37 -0
- package/script/parse/v3-2/example/toExamplesV3.d.ts +77 -0
- package/script/parse/v3-2/example/toExamplesV3.js +149 -0
- package/script/parse/v3-2/externalDocs/toExternalDocs.d.ts +10 -0
- package/script/parse/v3-2/externalDocs/toExternalDocs.js +52 -0
- package/script/parse/v3-2/header/toHeadersV3.d.ts +18 -0
- package/script/parse/v3-2/header/toHeadersV3.js +51 -0
- package/script/parse/v3-2/info/toInfoV3.d.ts +10 -0
- package/script/parse/v3-2/info/toInfoV3.js +27 -0
- package/script/parse/v3-2/integer/toInteger.d.ts +21 -0
- package/script/parse/v3-2/integer/toInteger.js +153 -0
- package/script/parse/v3-2/license/toLicenseV3.d.ts +5 -0
- package/script/parse/v3-2/license/toLicenseV3.js +21 -0
- package/script/parse/v3-2/link/toLinksV3.d.ts +16 -0
- package/script/parse/v3-2/link/toLinksV3.js +44 -0
- package/script/parse/v3-2/mediaType/toMediaTypeItemV3.d.ts +323 -0
- package/script/parse/v3-2/mediaType/toMediaTypeItemV3.js +381 -0
- package/script/parse/v3-2/methods.d.ts +17 -0
- package/script/parse/v3-2/methods.js +25 -0
- package/script/parse/v3-2/number/toNumber.d.ts +10 -0
- package/script/parse/v3-2/number/toNumber.js +152 -0
- package/script/parse/v3-2/object/toAdditionalPropertiesV3.d.ts +11 -0
- package/script/parse/v3-2/object/toAdditionalPropertiesV3.js +14 -0
- package/script/parse/v3-2/object/toObject.d.ts +10 -0
- package/script/parse/v3-2/object/toObject.js +94 -0
- package/script/parse/v3-2/operation/toOperationsV3.d.ts +25 -0
- package/script/parse/v3-2/operation/toOperationsV3.js +134 -0
- package/script/parse/v3-2/parameter/toParameterV3.d.ts +39 -0
- package/script/parse/v3-2/parameter/toParameterV3.js +191 -0
- package/script/parse/v3-2/parameter/warnQuerystringConflictsV3.d.ts +22 -0
- package/script/parse/v3-2/parameter/warnQuerystringConflictsV3.js +43 -0
- package/script/parse/v3-2/pathItem/dropAdditionalOperationsV3.d.ts +17 -0
- package/script/parse/v3-2/pathItem/dropAdditionalOperationsV3.js +38 -0
- package/script/parse/v3-2/pathItem/toPathItemV3.d.ts +23 -0
- package/script/parse/v3-2/pathItem/toPathItemV3.js +50 -0
- package/script/parse/v3-2/ref/toRefV31.d.ts +19 -0
- package/script/parse/v3-2/ref/toRefV31.js +14 -0
- package/script/parse/v3-2/requestBody/toRequestBodiesV3.d.ts +18 -0
- package/script/parse/v3-2/requestBody/toRequestBodiesV3.js +52 -0
- package/script/parse/v3-2/response/toResponseV3.d.ts +29 -0
- package/script/parse/v3-2/response/toResponseV3.js +65 -0
- package/script/parse/v3-2/schema/toSchemasV3.d.ts +29 -0
- package/script/parse/v3-2/schema/toSchemasV3.js +518 -0
- package/script/parse/v3-2/securityRequirement/toSecurityRequirement.d.ts +9 -0
- package/script/parse/v3-2/securityRequirement/toSecurityRequirement.js +13 -0
- package/script/parse/v3-2/securitySchemes/toSecuritySchemes.d.ts +17 -0
- package/script/parse/v3-2/securitySchemes/toSecuritySchemes.js +189 -0
- package/script/parse/v3-2/server/toServerV3.d.ts +26 -0
- package/script/parse/v3-2/server/toServerV3.js +37 -0
- package/script/parse/v3-2/serverVariable/toServerVariableV3.d.ts +22 -0
- package/script/parse/v3-2/serverVariable/toServerVariableV3.js +36 -0
- package/script/parse/v3-2/specificationExtensions/toSpecificationExtensionsV3.d.ts +14 -0
- package/script/parse/v3-2/specificationExtensions/toSpecificationExtensionsV3.js +30 -0
- package/script/parse/v3-2/string/toString.d.ts +146 -0
- package/script/parse/v3-2/string/toString.js +249 -0
- package/script/parse/v3-2/tag/toTagsV3.d.ts +22 -0
- package/script/parse/v3-2/tag/toTagsV3.js +83 -0
- package/script/parse/v3-2/union/toUnion.d.ts +12 -0
- package/script/parse/v3-2/union/toUnion.js +72 -0
- package/script/parse/v3-2/unknown/toUnknown.d.ts +10 -0
- package/script/parse/v3-2/unknown/toUnknown.js +23 -0
- package/script/parse/v3-2/webhook/toWebhooksV3.d.ts +48 -0
- package/script/parse/v3-2/webhook/toWebhooksV3.js +144 -0
- package/script/types/Method.d.ts +7 -4
- package/script/types/Method.js +17 -4
- package/script/types/Preview.d.ts +2 -1
- package/script/types/SkmtcDocument.d.ts +6 -6
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import { OasTag } from '../../../oas/tag/Tag.js';
|
|
2
|
+
import { toSpecificationExtensionsV3 } from '../specificationExtensions/toSpecificationExtensionsV3.js';
|
|
3
|
+
import { toExternalDocs } from '../externalDocs/toExternalDocs.js';
|
|
4
|
+
export const toTagsV3 = ({ tags, stackTrail, context }) => {
|
|
5
|
+
if (!tags) {
|
|
6
|
+
return undefined;
|
|
7
|
+
}
|
|
8
|
+
const parents = new Map(tags.map(({ name, parent }) => [name, parent]));
|
|
9
|
+
return tags.map(tag => {
|
|
10
|
+
const parentError = toParentError({ name: tag.name, parent: tag.parent, parents });
|
|
11
|
+
if (!parentError) {
|
|
12
|
+
return toTagV3({ tag, stackTrail, context });
|
|
13
|
+
}
|
|
14
|
+
context.logIssue({
|
|
15
|
+
key: 'parent',
|
|
16
|
+
level: 'warning',
|
|
17
|
+
message: `Tag '${tag.name}' ${parentError}; dropping 'parent'`,
|
|
18
|
+
parent: tag,
|
|
19
|
+
stackTrail,
|
|
20
|
+
type: 'INVALID_TAG_PARENT'
|
|
21
|
+
});
|
|
22
|
+
return toTagV3({ tag: { ...tag, parent: undefined }, stackTrail, context });
|
|
23
|
+
});
|
|
24
|
+
};
|
|
25
|
+
/** Describes why the tag's `parent` is invalid, or returns undefined when it is valid. */
|
|
26
|
+
const toParentError = ({ name, parent, parents }) => {
|
|
27
|
+
if (parent === undefined) {
|
|
28
|
+
return undefined;
|
|
29
|
+
}
|
|
30
|
+
if (!parents.has(parent)) {
|
|
31
|
+
return `names parent '${parent}', which is not a tag`;
|
|
32
|
+
}
|
|
33
|
+
if (leadsBackTo({ name, current: parent, parents, visited: new Set() })) {
|
|
34
|
+
return `is in a parent cycle through '${parent}'`;
|
|
35
|
+
}
|
|
36
|
+
return undefined;
|
|
37
|
+
};
|
|
38
|
+
/** Follows the parent chain from `current` and reports whether it reaches `name`. */
|
|
39
|
+
const leadsBackTo = ({ name, current, parents, visited }) => {
|
|
40
|
+
if (current === undefined) {
|
|
41
|
+
return false;
|
|
42
|
+
}
|
|
43
|
+
if (current === name) {
|
|
44
|
+
return true;
|
|
45
|
+
}
|
|
46
|
+
// The chain loops without reaching `name`: the cycle is above this tag, and
|
|
47
|
+
// the tags in it report it.
|
|
48
|
+
if (visited.has(current)) {
|
|
49
|
+
return false;
|
|
50
|
+
}
|
|
51
|
+
return leadsBackTo({
|
|
52
|
+
name,
|
|
53
|
+
current: parents.get(current),
|
|
54
|
+
parents,
|
|
55
|
+
visited: new Set([...visited, current])
|
|
56
|
+
});
|
|
57
|
+
};
|
|
58
|
+
export const toTagV3 = ({ tag, stackTrail, context }) => {
|
|
59
|
+
const { name, description, summary, parent, kind, externalDocs, ...skipped } = tag;
|
|
60
|
+
const parsedExternalDocs = stackTrail.trace('externalDocs', st => toExternalDocs({ externalDocs, stackTrail: st, context }));
|
|
61
|
+
const extensionFields = toSpecificationExtensionsV3({
|
|
62
|
+
skipped,
|
|
63
|
+
parent: tag,
|
|
64
|
+
context,
|
|
65
|
+
stackTrail,
|
|
66
|
+
parentType: 'tag'
|
|
67
|
+
});
|
|
68
|
+
const fields = {
|
|
69
|
+
name,
|
|
70
|
+
description,
|
|
71
|
+
summary,
|
|
72
|
+
parent,
|
|
73
|
+
kind,
|
|
74
|
+
externalDocs: parsedExternalDocs,
|
|
75
|
+
extensionFields
|
|
76
|
+
};
|
|
77
|
+
return new OasTag(fields);
|
|
78
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { OpenAPIV3 } from 'openapi-types';
|
|
2
|
+
import type { ParseContextType } from '../../../context/parseTypes.js';
|
|
3
|
+
import { OasUnion } from '../../../oas/union/Union.js';
|
|
4
|
+
import type { StackTrail } from '../../../context/StackTrail.js';
|
|
5
|
+
export type ToUnionArgs = {
|
|
6
|
+
value: OpenAPIV3.SchemaObject;
|
|
7
|
+
members: (OpenAPIV3.ReferenceObject | OpenAPIV3.SchemaObject)[];
|
|
8
|
+
parentType: 'anyOf' | 'oneOf';
|
|
9
|
+
stackTrail: StackTrail;
|
|
10
|
+
context: ParseContextType;
|
|
11
|
+
};
|
|
12
|
+
export declare const toUnion: ({ value, members, parentType, stackTrail, context }: ToUnionArgs) => OasUnion;
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { OasUnion } from '../../../oas/union/Union.js';
|
|
2
|
+
import { toDiscriminatorV3 } from '../discriminator/toDiscriminatorV3.js';
|
|
3
|
+
import { toSchemaV3 } from '../schema/toSchemasV3.js';
|
|
4
|
+
import { toSpecificationExtensionsV3 } from '../specificationExtensions/toSpecificationExtensionsV3.js';
|
|
5
|
+
import { parseNullable } from '../_helpers/parseNullable.js';
|
|
6
|
+
import { parseExample } from '../_helpers/parseExample.js';
|
|
7
|
+
import { parseDefault } from '../_helpers/parseDefault.js';
|
|
8
|
+
import { toExternalDocs } from '../externalDocs/toExternalDocs.js';
|
|
9
|
+
export const toUnion = ({ value, members, parentType, stackTrail, context }) => {
|
|
10
|
+
const { nullable, value: valueWithoutNullable } = parseNullable({
|
|
11
|
+
value,
|
|
12
|
+
context,
|
|
13
|
+
stackTrail
|
|
14
|
+
});
|
|
15
|
+
const { discriminator, title, description, externalDocs, example: unparsedExample, default: unparsedDefaultValue, ...skipped } = valueWithoutNullable;
|
|
16
|
+
const example = parseExample({
|
|
17
|
+
value: unparsedExample,
|
|
18
|
+
context,
|
|
19
|
+
parent: value,
|
|
20
|
+
nullable,
|
|
21
|
+
check: isPresent,
|
|
22
|
+
toMessage: item => `Removed invalid example. Expected a non-null value, got: ${item}`,
|
|
23
|
+
stackTrail
|
|
24
|
+
});
|
|
25
|
+
const defaultValue = parseDefault({
|
|
26
|
+
value: unparsedDefaultValue,
|
|
27
|
+
context,
|
|
28
|
+
parent: value,
|
|
29
|
+
nullable,
|
|
30
|
+
check: isPresent,
|
|
31
|
+
toMessage: item => `Removed invalid default. Expected a non-null value, got: ${item}`,
|
|
32
|
+
stackTrail
|
|
33
|
+
});
|
|
34
|
+
const extensionFields = toSpecificationExtensionsV3({
|
|
35
|
+
skipped,
|
|
36
|
+
parent: value,
|
|
37
|
+
context,
|
|
38
|
+
stackTrail,
|
|
39
|
+
parentType: `schema:${parentType}`
|
|
40
|
+
});
|
|
41
|
+
const discriminatorParsed = stackTrail.trace('discriminator', st => toDiscriminatorV3({ discriminator, stackTrail: st, context }));
|
|
42
|
+
const membersParsed = members.reduce((acc, item, index) => {
|
|
43
|
+
if (item === undefined || item === null) {
|
|
44
|
+
return acc;
|
|
45
|
+
}
|
|
46
|
+
return [
|
|
47
|
+
...acc,
|
|
48
|
+
stackTrail.trace(`${index}`, st => toSchemaV3({ schema: item, stackTrail: st, context }))
|
|
49
|
+
];
|
|
50
|
+
}, []);
|
|
51
|
+
return context.withStackTrail(stackTrail, () => new OasUnion({
|
|
52
|
+
title,
|
|
53
|
+
description,
|
|
54
|
+
externalDocs: stackTrail.trace('externalDocs', st => toExternalDocs({ externalDocs, stackTrail: st, context })),
|
|
55
|
+
nullable,
|
|
56
|
+
default: defaultValue,
|
|
57
|
+
discriminator: discriminatorParsed,
|
|
58
|
+
members: membersParsed,
|
|
59
|
+
example,
|
|
60
|
+
extensionFields
|
|
61
|
+
}, context));
|
|
62
|
+
};
|
|
63
|
+
// A union (anyOf/oneOf) value may match any of its members, so the most we
|
|
64
|
+
// can validate without resolving members is that a present default/example
|
|
65
|
+
// is not a bare `null` on a non-nullable schema.
|
|
66
|
+
const isPresent = (value) => {
|
|
67
|
+
return value !== null && value !== undefined;
|
|
68
|
+
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { OpenAPIV3 } from 'openapi-types';
|
|
2
|
+
import type { ParseContextType } from '../../../context/parseTypes.js';
|
|
3
|
+
import { OasUnknown } from '../../../oas/unknown/Unknown.js';
|
|
4
|
+
import type { StackTrail } from '../../../context/StackTrail.js';
|
|
5
|
+
export type ToUnknownArgs = {
|
|
6
|
+
value: OpenAPIV3.SchemaObject;
|
|
7
|
+
stackTrail: StackTrail;
|
|
8
|
+
context: ParseContextType;
|
|
9
|
+
};
|
|
10
|
+
export declare const toUnknown: ({ value, stackTrail, context }: ToUnknownArgs) => OasUnknown;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { OasUnknown } from '../../../oas/unknown/Unknown.js';
|
|
2
|
+
import { toSpecificationExtensionsV3 } from '../specificationExtensions/toSpecificationExtensionsV3.js';
|
|
3
|
+
export const toUnknown = ({ value, stackTrail, context }) => {
|
|
4
|
+
const { type: _type, title, description, example, nullable, ...skipped } = value;
|
|
5
|
+
const extensionFields = toSpecificationExtensionsV3({
|
|
6
|
+
skipped,
|
|
7
|
+
parent: value,
|
|
8
|
+
context,
|
|
9
|
+
stackTrail,
|
|
10
|
+
parentType: 'schema:unknown'
|
|
11
|
+
});
|
|
12
|
+
return context.withStackTrail(stackTrail, () => new OasUnknown({
|
|
13
|
+
title,
|
|
14
|
+
description,
|
|
15
|
+
nullable,
|
|
16
|
+
extensionFields,
|
|
17
|
+
example
|
|
18
|
+
}, context));
|
|
19
|
+
};
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import type { OpenAPIV3 } from 'openapi-types';
|
|
2
|
+
import type { Method } from '../../../types/Method.js';
|
|
3
|
+
import type { ParseContextType } from '../../../context/parseTypes.js';
|
|
4
|
+
import { OasWebhook } from '../../../oas/webhook/Webhook.js';
|
|
5
|
+
import type { OasPathItem } from '../../../oas/pathItem/PathItem.js';
|
|
6
|
+
import type { StackTrail } from '../../../context/StackTrail.js';
|
|
7
|
+
/**
|
|
8
|
+
* The 3.1 `webhooks` object: a map of webhook NAME → PathItem, identical
|
|
9
|
+
* in shape to `paths` but keyed by name rather than URL path. Inline
|
|
10
|
+
* PathItems only — a webhook PathItem `$ref` is a 3.1 edge case not yet
|
|
11
|
+
* handled (see the arc note §5 Refs).
|
|
12
|
+
*/
|
|
13
|
+
export type WebhooksObject = Record<string, OpenAPIV3.PathItemObject>;
|
|
14
|
+
type WebhookInfo = {
|
|
15
|
+
method: Method;
|
|
16
|
+
name: string;
|
|
17
|
+
pathItem: OasPathItem | undefined;
|
|
18
|
+
};
|
|
19
|
+
export type ToWebhookV3Args = {
|
|
20
|
+
operation: OpenAPIV3.OperationObject;
|
|
21
|
+
webhookInfo: WebhookInfo;
|
|
22
|
+
stackTrail: StackTrail;
|
|
23
|
+
context: ParseContextType;
|
|
24
|
+
};
|
|
25
|
+
/**
|
|
26
|
+
* Parses a single webhook Operation Object into an {@link OasWebhook}.
|
|
27
|
+
*
|
|
28
|
+
* Mirrors `toOperationV3` and reuses the same leaf field parsers
|
|
29
|
+
* (`toParameterListV3` / `toRequestBodyV3` / `toResponsesV3` / …) — the
|
|
30
|
+
* inner Operation Object is structurally identical. Only the orchestration
|
|
31
|
+
* is duplicated (the dialect-shaped glue), and the output is an
|
|
32
|
+
* `OasWebhook` carrying a `name`, not an `OasOperation` carrying a `path`.
|
|
33
|
+
*/
|
|
34
|
+
export declare const toWebhookV3: ({ operation, webhookInfo, stackTrail, context }: ToWebhookV3Args) => OasWebhook;
|
|
35
|
+
export type ToWebhooksV3Args = {
|
|
36
|
+
webhooks: WebhooksObject | undefined;
|
|
37
|
+
stackTrail: StackTrail;
|
|
38
|
+
context: ParseContextType;
|
|
39
|
+
};
|
|
40
|
+
/**
|
|
41
|
+
* Flattens the 3.1 `webhooks` map into `OasWebhook[]`, mirroring
|
|
42
|
+
* `toOperationsV3`'s `paths` → `OasOperation[]` flattening. Returns `[]`
|
|
43
|
+
* when no `webhooks` object is present (the common 3.0 / no-webhook case).
|
|
44
|
+
* The stack trail nests `webhooks` → `<name>` → `<method>` so
|
|
45
|
+
* `OasDocument.removeItem` can locate a webhook by name.
|
|
46
|
+
*/
|
|
47
|
+
export declare const toWebhooksV3: ({ webhooks, stackTrail, context }: ToWebhooksV3Args) => OasWebhook[];
|
|
48
|
+
export {};
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
import { toRequestBodyV3 } from '../requestBody/toRequestBodiesV3.js';
|
|
2
|
+
import { toResponsesV3 } from '../response/toResponseV3.js';
|
|
3
|
+
import { toParameterListV3 } from '../parameter/toParameterV3.js';
|
|
4
|
+
import { OasWebhook } from '../../../oas/webhook/Webhook.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
|
+
/**
|
|
14
|
+
* Parses a single webhook Operation Object into an {@link OasWebhook}.
|
|
15
|
+
*
|
|
16
|
+
* Mirrors `toOperationV3` and reuses the same leaf field parsers
|
|
17
|
+
* (`toParameterListV3` / `toRequestBodyV3` / `toResponsesV3` / …) — the
|
|
18
|
+
* inner Operation Object is structurally identical. Only the orchestration
|
|
19
|
+
* is duplicated (the dialect-shaped glue), and the output is an
|
|
20
|
+
* `OasWebhook` carrying a `name`, not an `OasOperation` carrying a `path`.
|
|
21
|
+
*/
|
|
22
|
+
export const toWebhookV3 = ({ operation, webhookInfo, stackTrail, context }) => {
|
|
23
|
+
const { method, name, pathItem } = webhookInfo;
|
|
24
|
+
const { operationId, tags, summary, description, parameters, requestBody, responses, deprecated, security, externalDocs, servers, ...skipped } = operation;
|
|
25
|
+
const extensionFields = toSpecificationExtensionsV3({
|
|
26
|
+
skipped,
|
|
27
|
+
parent: operation,
|
|
28
|
+
context,
|
|
29
|
+
stackTrail,
|
|
30
|
+
parentType: 'operation'
|
|
31
|
+
});
|
|
32
|
+
const parsedParameters = stackTrail.trace('parameters', st => toParameterListV3({ parameters, stackTrail: st, context }));
|
|
33
|
+
warnQuerystringConflictsV3({ parameters: parsedParameters, pathItem, stackTrail, context });
|
|
34
|
+
const parsedRequestBody = stackTrail.trace('requestBody', st => toRequestBodyV3({ requestBody, stackTrail: st, context }));
|
|
35
|
+
const parsedResponses = stackTrail.trace('responses', st => toResponsesV3({ responses, stackTrail: st, context }));
|
|
36
|
+
const parsedSecurity = stackTrail.trace('security', st => toSecurityRequirementsV3({ security, stackTrail: st, context }));
|
|
37
|
+
const parsedExternalDocs = stackTrail.trace('externalDocs', st => toExternalDocs({ externalDocs, stackTrail: st, context }));
|
|
38
|
+
const parsedServers = stackTrail.trace('servers', st => toOptionalServersV3({ servers, stackTrail: st, context }));
|
|
39
|
+
return context.withStackTrail(stackTrail, () => new OasWebhook({
|
|
40
|
+
pathItem,
|
|
41
|
+
name,
|
|
42
|
+
method,
|
|
43
|
+
operationId,
|
|
44
|
+
summary,
|
|
45
|
+
tags,
|
|
46
|
+
description,
|
|
47
|
+
parameters: parsedParameters,
|
|
48
|
+
requestBody: parsedRequestBody,
|
|
49
|
+
responses: parsedResponses,
|
|
50
|
+
deprecated,
|
|
51
|
+
security: parsedSecurity,
|
|
52
|
+
externalDocs: parsedExternalDocs,
|
|
53
|
+
servers: parsedServers,
|
|
54
|
+
extensionFields
|
|
55
|
+
}, context));
|
|
56
|
+
};
|
|
57
|
+
/**
|
|
58
|
+
* Flattens the 3.1 `webhooks` map into `OasWebhook[]`, mirroring
|
|
59
|
+
* `toOperationsV3`'s `paths` → `OasOperation[]` flattening. Returns `[]`
|
|
60
|
+
* when no `webhooks` object is present (the common 3.0 / no-webhook case).
|
|
61
|
+
* The stack trail nests `webhooks` → `<name>` → `<method>` so
|
|
62
|
+
* `OasDocument.removeItem` can locate a webhook by name.
|
|
63
|
+
*/
|
|
64
|
+
export const toWebhooksV3 = ({ webhooks, stackTrail, context }) => {
|
|
65
|
+
if (!webhooks) {
|
|
66
|
+
return [];
|
|
67
|
+
}
|
|
68
|
+
return Object.entries(webhooks).flatMap(([name, pathItem]) => {
|
|
69
|
+
return stackTrail.trace(name, nameStack => {
|
|
70
|
+
if (!pathItem) {
|
|
71
|
+
return [];
|
|
72
|
+
}
|
|
73
|
+
const fixedFields = dropAdditionalOperationsV3({ pathItem, stackTrail: nameStack, context });
|
|
74
|
+
const cleaned = Object.entries(fixedFields).reduce(({ rest, methodObject }, [key, operation]) => {
|
|
75
|
+
const method = toPathItemMethod(key);
|
|
76
|
+
if (method) {
|
|
77
|
+
const { [method]: _deleted, ...remaining } = rest;
|
|
78
|
+
return {
|
|
79
|
+
rest: remaining,
|
|
80
|
+
methodObject: {
|
|
81
|
+
...methodObject,
|
|
82
|
+
[method]: operation
|
|
83
|
+
}
|
|
84
|
+
};
|
|
85
|
+
}
|
|
86
|
+
return { rest, methodObject };
|
|
87
|
+
}, {
|
|
88
|
+
rest: fixedFields,
|
|
89
|
+
methodObject: {}
|
|
90
|
+
});
|
|
91
|
+
const pathItemResult = toPathItemResultV3({
|
|
92
|
+
pathItem: cleaned.rest,
|
|
93
|
+
stackTrail: nameStack,
|
|
94
|
+
context
|
|
95
|
+
});
|
|
96
|
+
if (!pathItemResult.valid) {
|
|
97
|
+
return [];
|
|
98
|
+
}
|
|
99
|
+
const pathItemObject = pathItemResult.pathItem;
|
|
100
|
+
return Object.entries(cleaned.methodObject)
|
|
101
|
+
.map(([method, operation]) => {
|
|
102
|
+
// Use `nameStack` (the trail with the webhook name already
|
|
103
|
+
// pushed) so downstream traces record webhooks:<name>:<method>:…
|
|
104
|
+
// — the trail `OasDocument.removeItem` matches a webhook on.
|
|
105
|
+
return nameStack.trace(method, st => {
|
|
106
|
+
if (!operation) {
|
|
107
|
+
return;
|
|
108
|
+
}
|
|
109
|
+
try {
|
|
110
|
+
return toWebhookV3({
|
|
111
|
+
operation,
|
|
112
|
+
webhookInfo: {
|
|
113
|
+
method: method,
|
|
114
|
+
name,
|
|
115
|
+
pathItem: pathItemObject
|
|
116
|
+
},
|
|
117
|
+
stackTrail: st,
|
|
118
|
+
context
|
|
119
|
+
});
|
|
120
|
+
}
|
|
121
|
+
catch (error) {
|
|
122
|
+
const normalized = error instanceof Error ? error : new Error(String(error));
|
|
123
|
+
context.logIssue({
|
|
124
|
+
key: method,
|
|
125
|
+
parent: operation,
|
|
126
|
+
level: 'error',
|
|
127
|
+
message: normalized.message,
|
|
128
|
+
cause: normalized,
|
|
129
|
+
stackTrail: st,
|
|
130
|
+
type: 'INVALID_OPERATION'
|
|
131
|
+
});
|
|
132
|
+
return undefined;
|
|
133
|
+
}
|
|
134
|
+
});
|
|
135
|
+
})
|
|
136
|
+
.filter((item) => Boolean(item));
|
|
137
|
+
});
|
|
138
|
+
});
|
|
139
|
+
};
|
package/esm/types/Method.d.ts
CHANGED
|
@@ -5,9 +5,11 @@ import * as v from 'valibot';
|
|
|
5
5
|
*
|
|
6
6
|
* This constant array includes all HTTP methods that can be used
|
|
7
7
|
* in OpenAPI path operations, as defined by the OpenAPI specification.
|
|
8
|
-
* All methods are in lowercase to match OpenAPI conventions.
|
|
8
|
+
* All methods are in lowercase to match OpenAPI conventions. `query` is
|
|
9
|
+
* an OpenAPI 3.2 method; each parser tree reads its own list from
|
|
10
|
+
* `parse/v3-X/methods.ts`.
|
|
9
11
|
*/
|
|
10
|
-
export declare const methodValues: readonly ["get", "put", "post", "delete", "options", "head", "patch", "trace"];
|
|
12
|
+
export declare const methodValues: readonly ["get", "put", "post", "delete", "options", "head", "patch", "trace", "query"];
|
|
11
13
|
/**
|
|
12
14
|
* Array of HTTP methods excluding TRACE.
|
|
13
15
|
*
|
|
@@ -23,8 +25,9 @@ export declare const method: v.UnionSchema<[
|
|
|
23
25
|
v.LiteralSchema<'delete', undefined>,
|
|
24
26
|
v.LiteralSchema<'head', undefined>,
|
|
25
27
|
v.LiteralSchema<'options', undefined>,
|
|
26
|
-
v.LiteralSchema<'trace', undefined
|
|
28
|
+
v.LiteralSchema<'trace', undefined>,
|
|
29
|
+
v.LiteralSchema<'query', undefined>
|
|
27
30
|
], undefined>;
|
|
28
|
-
export type Method = 'get' | 'put' | 'post' | 'delete' | 'options' | 'head' | 'patch' | 'trace';
|
|
31
|
+
export type Method = 'get' | 'put' | 'post' | 'delete' | 'options' | 'head' | 'patch' | 'trace' | 'query';
|
|
29
32
|
export declare const methods: v.ArraySchema<typeof method, undefined>;
|
|
30
33
|
export declare const isMethod: (arg: unknown) => arg is Method;
|
package/esm/types/Method.js
CHANGED
|
@@ -5,7 +5,9 @@ import * as v from 'valibot';
|
|
|
5
5
|
*
|
|
6
6
|
* This constant array includes all HTTP methods that can be used
|
|
7
7
|
* in OpenAPI path operations, as defined by the OpenAPI specification.
|
|
8
|
-
* All methods are in lowercase to match OpenAPI conventions.
|
|
8
|
+
* All methods are in lowercase to match OpenAPI conventions. `query` is
|
|
9
|
+
* an OpenAPI 3.2 method; each parser tree reads its own list from
|
|
10
|
+
* `parse/v3-X/methods.ts`.
|
|
9
11
|
*/
|
|
10
12
|
export const methodValues = [
|
|
11
13
|
'get',
|
|
@@ -15,7 +17,8 @@ export const methodValues = [
|
|
|
15
17
|
'options',
|
|
16
18
|
'head',
|
|
17
19
|
'patch',
|
|
18
|
-
'trace'
|
|
20
|
+
'trace',
|
|
21
|
+
'query'
|
|
19
22
|
];
|
|
20
23
|
/**
|
|
21
24
|
* Array of HTTP methods excluding TRACE.
|
|
@@ -23,7 +26,16 @@ export const methodValues = [
|
|
|
23
26
|
* This is a filtered version of {@link methodValues} that excludes the TRACE method,
|
|
24
27
|
* which is sometimes excluded from API operations for security reasons.
|
|
25
28
|
*/
|
|
26
|
-
export const methodValuesNoTrace = [
|
|
29
|
+
export const methodValuesNoTrace = [
|
|
30
|
+
'get',
|
|
31
|
+
'put',
|
|
32
|
+
'post',
|
|
33
|
+
'delete',
|
|
34
|
+
'options',
|
|
35
|
+
'head',
|
|
36
|
+
'patch',
|
|
37
|
+
'query'
|
|
38
|
+
];
|
|
27
39
|
export const method = v.union([
|
|
28
40
|
v.literal('get'),
|
|
29
41
|
v.literal('post'),
|
|
@@ -32,7 +44,8 @@ export const method = v.union([
|
|
|
32
44
|
v.literal('delete'),
|
|
33
45
|
v.literal('head'),
|
|
34
46
|
v.literal('options'),
|
|
35
|
-
v.literal('trace')
|
|
47
|
+
v.literal('trace'),
|
|
48
|
+
v.literal('query')
|
|
36
49
|
]);
|
|
37
50
|
export const methods = v.array(method);
|
|
38
51
|
export const isMethod = (arg) => {
|
package/esm/types/Preview.d.ts
CHANGED
|
@@ -139,7 +139,8 @@ export declare const oasOperationSource: v.ObjectSchema<{
|
|
|
139
139
|
v.LiteralSchema<'delete', undefined>,
|
|
140
140
|
v.LiteralSchema<'head', undefined>,
|
|
141
141
|
v.LiteralSchema<'options', undefined>,
|
|
142
|
-
v.LiteralSchema<'trace', undefined
|
|
142
|
+
v.LiteralSchema<'trace', undefined>,
|
|
143
|
+
v.LiteralSchema<'query', undefined>
|
|
143
144
|
], undefined>;
|
|
144
145
|
readonly variant: v.StringSchema<undefined>;
|
|
145
146
|
}, undefined>;
|
|
@@ -59,12 +59,12 @@ export declare const toGqlParsedDocument: (value: GqlDocument) => SkmtcParsedDoc
|
|
|
59
59
|
* pipeline runs the protocol-appropriate parser before handing the
|
|
60
60
|
* post-parse {@link SkmtcParsedDocument} to the generate phase.
|
|
61
61
|
*
|
|
62
|
-
* - `oas.value` is an `OpenAPIV3.Document
|
|
63
|
-
* 3.
|
|
64
|
-
* `@skmtc/convert` before reaching `toArtifacts`.
|
|
65
|
-
* *on* that document as a retained member
|
|
66
|
-
* `webhooks`, so it is widened here) — the
|
|
67
|
-
* {@link OasDocument.webhooks}.
|
|
62
|
+
* - `oas.value` is an `OpenAPIV3.Document` carrying an OpenAPI 3.0, 3.1 or
|
|
63
|
+
* 3.2 document; each is parsed natively by its own parser tree. Swagger 2
|
|
64
|
+
* is converted to 3.0 by `@skmtc/convert` before reaching `toArtifacts`.
|
|
65
|
+
* 3.1 and 3.2 `webhooks` ride *on* that document as a retained member
|
|
66
|
+
* (the 3.0 base type omits `webhooks`, so it is widened here) — the
|
|
67
|
+
* parser flattens them into {@link OasDocument.webhooks}.
|
|
68
68
|
* - `gql.value` is either a raw SDL string or a pre-built
|
|
69
69
|
* `GraphQLSchema`. Strings are run through `buildSchema` inside the
|
|
70
70
|
* pipeline; pre-built `GraphQLSchema` instances are used as-is.
|
package/package.json
CHANGED
|
@@ -4,6 +4,17 @@ declare global {
|
|
|
4
4
|
}
|
|
5
5
|
}
|
|
6
6
|
export {};
|
|
7
|
+
declare global {
|
|
8
|
+
interface Object {
|
|
9
|
+
/**
|
|
10
|
+
* Determines whether an object has a property with the specified name.
|
|
11
|
+
* @param o An object.
|
|
12
|
+
* @param v A property name.
|
|
13
|
+
*/
|
|
14
|
+
hasOwn(o: object, v: PropertyKey): boolean;
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
export {};
|
|
7
18
|
/**
|
|
8
19
|
* Based on [import-meta-ponyfill](https://github.com/gaubee/import-meta-ponyfill),
|
|
9
20
|
* but instead of using npm to install additional dependencies,
|
package/script/_dnt.polyfills.js
CHANGED
|
@@ -1,6 +1,20 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.import_meta_ponyfill = exports.import_meta_ponyfill_esmodule = exports.import_meta_ponyfill_commonjs = void 0;
|
|
4
|
+
// https://github.com/tc39/proposal-accessible-object-hasownproperty/blob/main/polyfill.js
|
|
5
|
+
if (!Object.hasOwn) {
|
|
6
|
+
Object.defineProperty(Object, "hasOwn", {
|
|
7
|
+
value: function (object, property) {
|
|
8
|
+
if (object == null) {
|
|
9
|
+
throw new TypeError("Cannot convert undefined or null to object");
|
|
10
|
+
}
|
|
11
|
+
return Object.prototype.hasOwnProperty.call(Object(object), property);
|
|
12
|
+
},
|
|
13
|
+
configurable: true,
|
|
14
|
+
enumerable: false,
|
|
15
|
+
writable: true,
|
|
16
|
+
});
|
|
17
|
+
}
|
|
4
18
|
/**
|
|
5
19
|
* Based on [import-meta-ponyfill](https://github.com/gaubee/import-meta-ponyfill),
|
|
6
20
|
* but instead of using npm to install additional dependencies,
|
|
@@ -32,6 +32,7 @@ require("../_dnt.polyfills.js");
|
|
|
32
32
|
const graphql_1 = require("graphql");
|
|
33
33
|
const toDocumentFieldsV3_js_1 = require("../parse/v3-0/document/toDocumentFieldsV3.js");
|
|
34
34
|
const toDocumentFieldsV3_js_2 = require("../parse/v3-1/document/toDocumentFieldsV3.js");
|
|
35
|
+
const toDocumentFieldsV3_js_3 = require("../parse/v3-2/document/toDocumentFieldsV3.js");
|
|
35
36
|
const toOasDialect_js_1 = require("../parse/toOasDialect.js");
|
|
36
37
|
const Document_js_1 = require("../oas/document/Document.js");
|
|
37
38
|
const GqlRegistry_js_1 = require("../gql/registry/GqlRegistry.js");
|
|
@@ -187,7 +188,7 @@ class ParseContext {
|
|
|
187
188
|
const oasState = this.protocol;
|
|
188
189
|
// The ONE place the OpenAPI version is examined: pick the dialect's
|
|
189
190
|
// parser tree. Everything downstream is version-specific code living
|
|
190
|
-
// in its own tree (v3-0 / v3-1) and never re-checks the version.
|
|
191
|
+
// in its own tree (v3-0 / v3-1 / v3-2) and never re-checks the version.
|
|
191
192
|
const dialect = (0, toOasDialect_js_1.toOasDialect)(oasState.documentObject.openapi);
|
|
192
193
|
switch (dialect) {
|
|
193
194
|
case '3.0':
|
|
@@ -204,6 +205,13 @@ class ParseContext {
|
|
|
204
205
|
context: this
|
|
205
206
|
});
|
|
206
207
|
break;
|
|
208
|
+
case '3.2':
|
|
209
|
+
oasState.oasDocument.fields = (0, toDocumentFieldsV3_js_3.toDocumentFieldsV3)({
|
|
210
|
+
documentObject: oasState.documentObject,
|
|
211
|
+
stackTrail,
|
|
212
|
+
context: this
|
|
213
|
+
});
|
|
214
|
+
break;
|
|
207
215
|
default: {
|
|
208
216
|
const _exhaustive = dialect;
|
|
209
217
|
throw new Error(`Unhandled OAS dialect: ${JSON.stringify(_exhaustive)}`);
|
|
@@ -154,8 +154,20 @@ export type AnyOasDocument = OpenAPIV2.Document | OpenAPIV3.Document | OpenAPIV3
|
|
|
154
154
|
* The TS type and the valibot schema below stay in sync via the
|
|
155
155
|
* `v.GenericSchema<OasIssueType>` annotation — adding a variant in one
|
|
156
156
|
* place without the other fails to type-check.
|
|
157
|
+
*
|
|
158
|
+
* Media type issues, at most one per response or request body, from the
|
|
159
|
+
* choice `toJsonContent` makes on its parsed `content`:
|
|
160
|
+
*
|
|
161
|
+
* - `WILDCARD_MEDIA_TYPE` (`warning`) — the body has no JSON media type
|
|
162
|
+
* (see `isJsonMediaType`) and is read from `*\/*` as JSON, since its schema
|
|
163
|
+
* there is an object, array, union or `$ref`. The document does not say the
|
|
164
|
+
* format; springdoc writes `*\/*` for every response.
|
|
165
|
+
* - `NO_JSON_MEDIA_TYPE` (`debug`) — no lookup without a media type reads the
|
|
166
|
+
* body, and its keys include a range: `application/*`, or `*\/*` with a
|
|
167
|
+
* scalar schema (a text body or a file). A body with only specific
|
|
168
|
+
* non-JSON types (`multipart/form-data`, `text/plain`) logs nothing.
|
|
157
169
|
*/
|
|
158
|
-
export type OasIssueType = 'UNEXPECTED_PROPERTY' | 'MISSING_OBJECT_TYPE' | 'MISSING_STRING_TYPE' | 'MISSING_ARRAY_TYPE' | 'MISSING_BOOLEAN_TYPE' | 'INVALID_EXAMPLE' | 'INVALID_ENUM' | 'INVALID_DEFAULT' | 'INVALID_NULLABLE' | 'UNEXPECTED_FORMAT' | 'INVALID_RESPONSE' | 'INVALID_FORMAT' | 'INVALID_OPERATION' | 'INVALID_SCHEMA' | 'INVALID_PARAMETER' | 'INVALID_SECURITY_SCHEME' | 'INVALID_DEPENDENCY_REF' | 'EXAMPLE_AND_EXAMPLES_DEFINED';
|
|
170
|
+
export type OasIssueType = 'UNEXPECTED_PROPERTY' | 'MISSING_OBJECT_TYPE' | 'MISSING_STRING_TYPE' | 'MISSING_ARRAY_TYPE' | 'MISSING_BOOLEAN_TYPE' | 'INVALID_EXAMPLE' | 'INVALID_ENUM' | 'INVALID_DEFAULT' | 'INVALID_NULLABLE' | 'UNEXPECTED_FORMAT' | 'INVALID_RESPONSE' | 'INVALID_FORMAT' | 'INVALID_OPERATION' | 'INVALID_SCHEMA' | 'INVALID_PARAMETER' | 'INVALID_SECURITY_SCHEME' | 'INVALID_DEPENDENCY_REF' | 'EXAMPLE_AND_EXAMPLES_DEFINED' | 'INVALID_TAG_PARENT' | 'UNSUPPORTED_OPERATION_METHOD' | 'WILDCARD_MEDIA_TYPE' | 'NO_JSON_MEDIA_TYPE';
|
|
159
171
|
/**
|
|
160
172
|
* Valibot schema for {@link OasIssueType}. Annotation deliberately omitted
|
|
161
173
|
* so the precise literal-union output type flows through to consumers
|
|
@@ -163,7 +175,7 @@ export type OasIssueType = 'UNEXPECTED_PROPERTY' | 'MISSING_OBJECT_TYPE' | 'MISS
|
|
|
163
175
|
* this list and {@link OasIssueType} is caught by `assertSchemaMatchesType`
|
|
164
176
|
* below.
|
|
165
177
|
*/
|
|
166
|
-
export declare const oasIssueType: v.UnionSchema<[v.LiteralSchema<"UNEXPECTED_PROPERTY", undefined>, v.LiteralSchema<"MISSING_OBJECT_TYPE", undefined>, v.LiteralSchema<"MISSING_STRING_TYPE", undefined>, v.LiteralSchema<"MISSING_ARRAY_TYPE", undefined>, v.LiteralSchema<"MISSING_BOOLEAN_TYPE", undefined>, v.LiteralSchema<"INVALID_EXAMPLE", undefined>, v.LiteralSchema<"INVALID_ENUM", undefined>, v.LiteralSchema<"INVALID_DEFAULT", undefined>, v.LiteralSchema<"INVALID_NULLABLE", undefined>, v.LiteralSchema<"UNEXPECTED_FORMAT", undefined>, v.LiteralSchema<"INVALID_RESPONSE", undefined>, v.LiteralSchema<"INVALID_FORMAT", undefined>, v.LiteralSchema<"INVALID_OPERATION", undefined>, v.LiteralSchema<"INVALID_SCHEMA", undefined>, v.LiteralSchema<"INVALID_PARAMETER", undefined>, v.LiteralSchema<"INVALID_SECURITY_SCHEME", undefined>, v.LiteralSchema<"INVALID_DEPENDENCY_REF", undefined>, v.LiteralSchema<"EXAMPLE_AND_EXAMPLES_DEFINED", undefined>], undefined>;
|
|
178
|
+
export declare const oasIssueType: v.UnionSchema<[v.LiteralSchema<"UNEXPECTED_PROPERTY", undefined>, v.LiteralSchema<"MISSING_OBJECT_TYPE", undefined>, v.LiteralSchema<"MISSING_STRING_TYPE", undefined>, v.LiteralSchema<"MISSING_ARRAY_TYPE", undefined>, v.LiteralSchema<"MISSING_BOOLEAN_TYPE", undefined>, v.LiteralSchema<"INVALID_EXAMPLE", undefined>, v.LiteralSchema<"INVALID_ENUM", undefined>, v.LiteralSchema<"INVALID_DEFAULT", undefined>, v.LiteralSchema<"INVALID_NULLABLE", undefined>, v.LiteralSchema<"UNEXPECTED_FORMAT", undefined>, v.LiteralSchema<"INVALID_RESPONSE", undefined>, v.LiteralSchema<"INVALID_FORMAT", undefined>, v.LiteralSchema<"INVALID_OPERATION", undefined>, v.LiteralSchema<"INVALID_SCHEMA", undefined>, v.LiteralSchema<"INVALID_PARAMETER", undefined>, v.LiteralSchema<"INVALID_SECURITY_SCHEME", undefined>, v.LiteralSchema<"INVALID_DEPENDENCY_REF", undefined>, v.LiteralSchema<"EXAMPLE_AND_EXAMPLES_DEFINED", undefined>, v.LiteralSchema<"INVALID_TAG_PARENT", undefined>, v.LiteralSchema<"UNSUPPORTED_OPERATION_METHOD", undefined>, v.LiteralSchema<"WILDCARD_MEDIA_TYPE", undefined>, v.LiteralSchema<"NO_JSON_MEDIA_TYPE", undefined>], undefined>;
|
|
167
179
|
export type GenerateResult = {
|
|
168
180
|
files: Map<string, FileBase>;
|
|
169
181
|
previews: Record<string, Preview>;
|
|
@@ -60,7 +60,11 @@ exports.oasIssueType = v.union([
|
|
|
60
60
|
v.literal('INVALID_PARAMETER'),
|
|
61
61
|
v.literal('INVALID_SECURITY_SCHEME'),
|
|
62
62
|
v.literal('INVALID_DEPENDENCY_REF'),
|
|
63
|
-
v.literal('EXAMPLE_AND_EXAMPLES_DEFINED')
|
|
63
|
+
v.literal('EXAMPLE_AND_EXAMPLES_DEFINED'),
|
|
64
|
+
v.literal('INVALID_TAG_PARENT'),
|
|
65
|
+
v.literal('UNSUPPORTED_OPERATION_METHOD'),
|
|
66
|
+
v.literal('WILDCARD_MEDIA_TYPE'),
|
|
67
|
+
v.literal('NO_JSON_MEDIA_TYPE')
|
|
64
68
|
]);
|
|
65
69
|
// Compile-time drift detector: this binding fails to type-check if
|
|
66
70
|
// `OasIssueType` and the literal list above disagree in either
|
|
@@ -466,8 +466,8 @@ export declare const isGeneratorKey: (arg: unknown) => arg is GeneratorKey;
|
|
|
466
466
|
* Type guard to check if a value is a valid OasOperationGeneratorKey.
|
|
467
467
|
*
|
|
468
468
|
* Validates that the argument is a string with the correct format:
|
|
469
|
-
* `generatorId|path|method` where each part is non-empty
|
|
470
|
-
* is a valid HTTP method.
|
|
469
|
+
* `generatorId|path|method|variant` where each part is non-empty, path
|
|
470
|
+
* starts with `/` and method is a valid HTTP method.
|
|
471
471
|
*
|
|
472
472
|
* @param arg - Value to check
|
|
473
473
|
* @returns True if the value is a valid OasOperationGeneratorKey
|
|
@@ -263,8 +263,8 @@ exports.isGeneratorKey = isGeneratorKey;
|
|
|
263
263
|
* Type guard to check if a value is a valid OasOperationGeneratorKey.
|
|
264
264
|
*
|
|
265
265
|
* Validates that the argument is a string with the correct format:
|
|
266
|
-
* `generatorId|path|method` where each part is non-empty
|
|
267
|
-
* is a valid HTTP method.
|
|
266
|
+
* `generatorId|path|method|variant` where each part is non-empty, path
|
|
267
|
+
* starts with `/` and method is a valid HTTP method.
|
|
268
268
|
*
|
|
269
269
|
* @param arg - Value to check
|
|
270
270
|
* @returns True if the value is a valid OasOperationGeneratorKey
|
|
@@ -295,7 +295,10 @@ const isOasOperationGeneratorKey = (arg) => {
|
|
|
295
295
|
if (typeof generatorId !== 'string' || !generatorId.length) {
|
|
296
296
|
return false;
|
|
297
297
|
}
|
|
298
|
-
|
|
298
|
+
// An OpenAPI path starts with `/`. Checking it keeps a GraphQL key whose
|
|
299
|
+
// field name is also an HTTP method (`gen|mutation|query|main`) from
|
|
300
|
+
// parsing as an operation.
|
|
301
|
+
if (typeof path !== 'string' || !path.startsWith('/')) {
|
|
299
302
|
return false;
|
|
300
303
|
}
|
|
301
304
|
if (!(0, Method_js_1.isMethod)(method)) {
|