@skmtc/core 0.39.0 → 0.41.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/context/CoreContext.js +22 -8
- package/esm/context/GenerateContext.d.ts +6 -5
- package/esm/context/GenerateContext.js +112 -38
- package/esm/context/ParseContext.d.ts +18 -1
- package/esm/context/ParseContext.js +102 -3
- package/esm/context/generateTypes.d.ts +33 -4
- package/esm/context/generateTypes.js +4 -0
- package/esm/context/toGenerationFailure.d.ts +21 -0
- package/esm/context/toGenerationFailure.js +38 -0
- package/esm/context/tryParseAt.d.ts +4 -1
- package/esm/context/tryParseAt.js +10 -3
- package/esm/dsl/CustomValue.d.ts +4 -0
- package/esm/dsl/CustomValue.js +8 -0
- package/esm/dsl/Definition.d.ts +10 -0
- package/esm/dsl/Definition.js +14 -0
- package/esm/dsl/PendingDefinition.d.ts +47 -0
- package/esm/dsl/PendingDefinition.js +83 -0
- package/esm/dsl/model/ModelDriver.d.ts +55 -1
- package/esm/dsl/model/ModelDriver.js +228 -51
- package/esm/dsl/model/toModelEntry.d.ts +1 -1
- package/esm/dsl/model/toModelEntry.js +1 -1
- package/esm/dsl/model/types.d.ts +1 -1
- package/esm/dsl/operation/gql/GqlOperationDriver.js +1 -4
- package/esm/dsl/webhook/WebhookDriver.js +1 -4
- package/esm/enrichments/parseEnrichmentUmbrella.d.ts +5 -6
- package/esm/enrichments/parseEnrichmentUmbrella.js +23 -8
- package/esm/enrichments/parseEnrichmentValue.d.ts +17 -0
- package/esm/enrichments/parseEnrichmentValue.js +32 -0
- package/esm/enrichments/readEnrichments.d.ts +5 -5
- package/esm/enrichments/readEnrichments.js +17 -7
- package/esm/helpers/collateExamples.js +15 -5
- package/esm/helpers/refFns.d.ts +6 -2
- package/esm/helpers/refFns.js +24 -7
- package/esm/mod.d.ts +2 -0
- package/esm/mod.js +2 -0
- package/esm/oas/array/Array.d.ts +19 -0
- package/esm/oas/array/Array.js +47 -0
- package/esm/oas/boolean/Boolean.d.ts +19 -0
- package/esm/oas/boolean/Boolean.js +51 -8
- package/esm/oas/example/Example.d.ts +4 -0
- package/esm/oas/example/Example.js +8 -0
- package/esm/oas/header/Header.d.ts +4 -0
- package/esm/oas/header/Header.js +8 -0
- package/esm/oas/integer/Integer.d.ts +19 -0
- package/esm/oas/integer/Integer.js +49 -0
- package/esm/oas/link/Link.d.ts +4 -0
- package/esm/oas/link/Link.js +8 -0
- package/esm/oas/number/Number.d.ts +19 -0
- package/esm/oas/number/Number.js +49 -0
- package/esm/oas/object/Object.d.ts +19 -0
- package/esm/oas/object/Object.js +68 -18
- package/esm/oas/operation/Operation.d.ts +8 -1
- package/esm/oas/operation/Operation.js +18 -5
- package/esm/oas/operation/toEffectiveParameters.d.ts +24 -0
- package/esm/oas/operation/toEffectiveParameters.js +42 -0
- package/esm/oas/parameter/Parameter.d.ts +4 -0
- package/esm/oas/parameter/Parameter.js +8 -0
- package/esm/oas/ref/DanglingRefError.d.ts +22 -0
- package/esm/oas/ref/DanglingRefError.js +33 -0
- package/esm/oas/ref/Ref.d.ts +152 -25
- package/esm/oas/ref/Ref.js +414 -26
- package/esm/oas/requestBody/RequestBody.d.ts +4 -0
- package/esm/oas/requestBody/RequestBody.js +8 -0
- package/esm/oas/response/Response.d.ts +4 -0
- package/esm/oas/response/Response.js +8 -0
- package/esm/oas/schema/siblings.d.ts +127 -0
- package/esm/oas/schema/siblings.js +250 -0
- package/esm/oas/securitySchemes/SecurityScheme.d.ts +16 -0
- package/esm/oas/securitySchemes/SecurityScheme.js +32 -0
- package/esm/oas/string/String.d.ts +19 -0
- package/esm/oas/string/String.js +47 -0
- package/esm/oas/union/Union.d.ts +32 -0
- package/esm/oas/union/Union.js +111 -0
- package/esm/oas/unknown/Unknown.d.ts +18 -0
- package/esm/oas/unknown/Unknown.js +38 -0
- package/esm/oas/void/Void.d.ts +4 -0
- package/esm/oas/void/Void.js +8 -0
- package/esm/oas/webhook/Webhook.d.ts +2 -2
- package/esm/oas/webhook/Webhook.js +4 -5
- package/esm/parse/allOfSystem.d.ts +32 -0
- package/esm/parse/allOfSystem.js +30 -0
- package/esm/parse/anyOfSystem.d.ts +68 -0
- package/esm/parse/anyOfSystem.js +107 -0
- package/esm/parse/securityRequirements.d.ts +6 -0
- package/esm/parse/securityRequirements.js +8 -0
- package/esm/parse/toSiblingKeywords.d.ts +28 -0
- package/esm/parse/toSiblingKeywords.js +109 -0
- package/esm/parse/v3-0/_merge-all-of/decompose-union.d.ts +8 -0
- package/esm/parse/v3-0/_merge-all-of/decompose-union.js +9 -1
- package/esm/parse/v3-0/_merge-all-of/generic-merge.d.ts +2 -3
- package/esm/parse/v3-0/_merge-all-of/generic-merge.js +2 -2
- package/esm/parse/v3-0/_merge-all-of/merge-array-constraints.d.ts +2 -2
- package/esm/parse/v3-0/_merge-all-of/merge-array-constraints.js +5 -5
- package/esm/parse/v3-0/_merge-all-of/merge-boolean-constraints.d.ts +2 -2
- package/esm/parse/v3-0/_merge-all-of/merge-boolean-constraints.js +2 -2
- package/esm/parse/v3-0/_merge-all-of/merge-integer-constraints.d.ts +2 -2
- package/esm/parse/v3-0/_merge-all-of/merge-integer-constraints.js +2 -2
- package/esm/parse/v3-0/_merge-all-of/merge-intersection.d.ts +3 -2
- package/esm/parse/v3-0/_merge-all-of/merge-intersection.js +2 -2
- package/esm/parse/v3-0/_merge-all-of/merge-number-constraints.d.ts +2 -2
- package/esm/parse/v3-0/_merge-all-of/merge-number-constraints.js +2 -2
- package/esm/parse/v3-0/_merge-all-of/merge-object-constraints.d.ts +2 -2
- package/esm/parse/v3-0/_merge-all-of/merge-object-constraints.js +3 -3
- package/esm/parse/v3-0/_merge-all-of/merge-properties.d.ts +2 -2
- package/esm/parse/v3-0/_merge-all-of/merge-properties.js +2 -2
- package/esm/parse/v3-0/_merge-all-of/merge-string-constraints.d.ts +2 -2
- package/esm/parse/v3-0/_merge-all-of/merge-string-constraints.js +3 -3
- package/esm/parse/v3-0/_merge-all-of/merge-union.d.ts +10 -3
- package/esm/parse/v3-0/_merge-all-of/merge-union.js +50 -12
- package/esm/parse/v3-0/_merge-all-of/merge.d.ts +2 -2
- package/esm/parse/v3-0/_merge-all-of/merge.js +78 -27
- package/esm/parse/v3-0/_merge-all-of/nullable-merge.d.ts +4 -0
- package/esm/parse/v3-0/_merge-all-of/nullable-merge.js +9 -7
- package/esm/parse/v3-0/_merge-all-of/types.d.ts +33 -0
- package/esm/parse/v3-0/mediaType/toMediaTypeItemV3.js +4 -3
- package/esm/parse/v3-0/parameter/toParameterV3.js +4 -3
- package/esm/parse/v3-0/ref/toRefV31.d.ts +7 -1
- package/esm/parse/v3-0/ref/toRefV31.js +6 -3
- package/esm/parse/v3-0/schema/toSchemasV3.js +107 -15
- package/esm/parse/v3-1/_merge-all-of/decompose-union.d.ts +7 -1
- package/esm/parse/v3-1/_merge-all-of/decompose-union.js +8 -2
- package/esm/parse/v3-1/_merge-all-of/generic-merge.d.ts +2 -3
- package/esm/parse/v3-1/_merge-all-of/generic-merge.js +2 -2
- package/esm/parse/v3-1/_merge-all-of/merge-array-constraints.d.ts +3 -2
- package/esm/parse/v3-1/_merge-all-of/merge-array-constraints.js +5 -5
- package/esm/parse/v3-1/_merge-all-of/merge-boolean-constraints.d.ts +2 -2
- package/esm/parse/v3-1/_merge-all-of/merge-boolean-constraints.js +2 -2
- package/esm/parse/v3-1/_merge-all-of/merge-integer-constraints.d.ts +2 -2
- package/esm/parse/v3-1/_merge-all-of/merge-integer-constraints.js +2 -2
- package/esm/parse/v3-1/_merge-all-of/merge-intersection.d.ts +3 -2
- package/esm/parse/v3-1/_merge-all-of/merge-intersection.js +2 -2
- package/esm/parse/v3-1/_merge-all-of/merge-number-constraints.d.ts +2 -2
- package/esm/parse/v3-1/_merge-all-of/merge-number-constraints.js +2 -2
- package/esm/parse/v3-1/_merge-all-of/merge-object-constraints.d.ts +2 -2
- package/esm/parse/v3-1/_merge-all-of/merge-object-constraints.js +3 -3
- package/esm/parse/v3-1/_merge-all-of/merge-properties.d.ts +2 -2
- package/esm/parse/v3-1/_merge-all-of/merge-properties.js +2 -2
- package/esm/parse/v3-1/_merge-all-of/merge-string-constraints.d.ts +2 -2
- package/esm/parse/v3-1/_merge-all-of/merge-string-constraints.js +3 -3
- package/esm/parse/v3-1/_merge-all-of/merge-union.d.ts +10 -3
- package/esm/parse/v3-1/_merge-all-of/merge-union.js +54 -15
- package/esm/parse/v3-1/_merge-all-of/merge.d.ts +3 -2
- package/esm/parse/v3-1/_merge-all-of/merge.js +88 -29
- package/esm/parse/v3-1/_merge-all-of/nullable-merge.d.ts +4 -0
- package/esm/parse/v3-1/_merge-all-of/nullable-merge.js +9 -7
- package/esm/parse/v3-1/_merge-all-of/types.d.ts +37 -0
- package/esm/parse/v3-1/mediaType/toMediaTypeItemV3.js +4 -3
- package/esm/parse/v3-1/parameter/toParameterV3.js +4 -3
- package/esm/parse/v3-1/ref/toRefV31.d.ts +7 -1
- package/esm/parse/v3-1/ref/toRefV31.js +6 -3
- package/esm/parse/v3-1/schema/toSchemasV3.js +111 -16
- package/esm/parse/v3-2/_merge-all-of/decompose-union.d.ts +7 -1
- package/esm/parse/v3-2/_merge-all-of/decompose-union.js +8 -2
- package/esm/parse/v3-2/_merge-all-of/generic-merge.d.ts +2 -3
- package/esm/parse/v3-2/_merge-all-of/generic-merge.js +2 -2
- package/esm/parse/v3-2/_merge-all-of/merge-array-constraints.d.ts +3 -2
- package/esm/parse/v3-2/_merge-all-of/merge-array-constraints.js +5 -5
- package/esm/parse/v3-2/_merge-all-of/merge-boolean-constraints.d.ts +2 -2
- package/esm/parse/v3-2/_merge-all-of/merge-boolean-constraints.js +2 -2
- package/esm/parse/v3-2/_merge-all-of/merge-integer-constraints.d.ts +2 -2
- package/esm/parse/v3-2/_merge-all-of/merge-integer-constraints.js +2 -2
- package/esm/parse/v3-2/_merge-all-of/merge-intersection.d.ts +3 -2
- package/esm/parse/v3-2/_merge-all-of/merge-intersection.js +2 -2
- package/esm/parse/v3-2/_merge-all-of/merge-number-constraints.d.ts +2 -2
- package/esm/parse/v3-2/_merge-all-of/merge-number-constraints.js +2 -2
- package/esm/parse/v3-2/_merge-all-of/merge-object-constraints.d.ts +2 -2
- package/esm/parse/v3-2/_merge-all-of/merge-object-constraints.js +3 -3
- package/esm/parse/v3-2/_merge-all-of/merge-properties.d.ts +2 -2
- package/esm/parse/v3-2/_merge-all-of/merge-properties.js +2 -2
- package/esm/parse/v3-2/_merge-all-of/merge-string-constraints.d.ts +2 -2
- package/esm/parse/v3-2/_merge-all-of/merge-string-constraints.js +3 -3
- package/esm/parse/v3-2/_merge-all-of/merge-union.d.ts +10 -3
- package/esm/parse/v3-2/_merge-all-of/merge-union.js +54 -15
- package/esm/parse/v3-2/_merge-all-of/merge.d.ts +3 -2
- package/esm/parse/v3-2/_merge-all-of/merge.js +88 -29
- package/esm/parse/v3-2/_merge-all-of/nullable-merge.d.ts +4 -0
- package/esm/parse/v3-2/_merge-all-of/nullable-merge.js +9 -7
- package/esm/parse/v3-2/_merge-all-of/types.d.ts +37 -0
- package/esm/parse/v3-2/mediaType/toMediaTypeItemV3.js +4 -3
- package/esm/parse/v3-2/parameter/toParameterV3.js +4 -3
- package/esm/parse/v3-2/ref/toRefV31.d.ts +7 -1
- package/esm/parse/v3-2/ref/toRefV31.js +6 -3
- package/esm/parse/v3-2/schema/toSchemasV3.js +111 -16
- package/esm/types/OasBase.d.ts +1 -1
- package/esm/types/Settings.d.ts +44 -0
- package/esm/types/Settings.js +9 -0
- package/package.json +5 -1
- package/script/context/CoreContext.js +22 -8
- package/script/context/GenerateContext.d.ts +6 -5
- package/script/context/GenerateContext.js +112 -38
- package/script/context/ParseContext.d.ts +18 -1
- package/script/context/ParseContext.js +102 -3
- package/script/context/generateTypes.d.ts +33 -4
- package/script/context/generateTypes.js +4 -0
- package/script/context/toGenerationFailure.d.ts +21 -0
- package/script/context/toGenerationFailure.js +43 -0
- package/script/context/tryParseAt.d.ts +4 -1
- package/script/context/tryParseAt.js +10 -3
- package/script/dsl/CustomValue.d.ts +4 -0
- package/script/dsl/CustomValue.js +8 -0
- package/script/dsl/Definition.d.ts +10 -0
- package/script/dsl/Definition.js +14 -0
- package/script/dsl/PendingDefinition.d.ts +47 -0
- package/script/dsl/PendingDefinition.js +87 -0
- package/script/dsl/model/ModelDriver.d.ts +55 -1
- package/script/dsl/model/ModelDriver.js +231 -52
- package/script/dsl/model/toModelEntry.d.ts +1 -1
- package/script/dsl/model/toModelEntry.js +1 -1
- package/script/dsl/model/types.d.ts +1 -1
- package/script/dsl/operation/gql/GqlOperationDriver.js +1 -4
- package/script/dsl/webhook/WebhookDriver.js +1 -4
- package/script/enrichments/parseEnrichmentUmbrella.d.ts +5 -6
- package/script/enrichments/parseEnrichmentUmbrella.js +23 -41
- package/script/enrichments/parseEnrichmentValue.d.ts +17 -0
- package/script/enrichments/parseEnrichmentValue.js +69 -0
- package/script/enrichments/readEnrichments.d.ts +5 -5
- package/script/enrichments/readEnrichments.js +17 -40
- package/script/helpers/collateExamples.js +15 -5
- package/script/helpers/refFns.d.ts +6 -2
- package/script/helpers/refFns.js +24 -7
- package/script/mod.d.ts +2 -0
- package/script/mod.js +2 -0
- package/script/oas/array/Array.d.ts +19 -0
- package/script/oas/array/Array.js +47 -0
- package/script/oas/boolean/Boolean.d.ts +19 -0
- package/script/oas/boolean/Boolean.js +51 -8
- package/script/oas/example/Example.d.ts +4 -0
- package/script/oas/example/Example.js +8 -0
- package/script/oas/header/Header.d.ts +4 -0
- package/script/oas/header/Header.js +8 -0
- package/script/oas/integer/Integer.d.ts +19 -0
- package/script/oas/integer/Integer.js +49 -0
- package/script/oas/link/Link.d.ts +4 -0
- package/script/oas/link/Link.js +8 -0
- package/script/oas/number/Number.d.ts +19 -0
- package/script/oas/number/Number.js +49 -0
- package/script/oas/object/Object.d.ts +19 -0
- package/script/oas/object/Object.js +68 -18
- package/script/oas/operation/Operation.d.ts +8 -1
- package/script/oas/operation/Operation.js +18 -5
- package/script/oas/operation/toEffectiveParameters.d.ts +24 -0
- package/script/oas/operation/toEffectiveParameters.js +47 -0
- package/script/oas/parameter/Parameter.d.ts +4 -0
- package/script/oas/parameter/Parameter.js +8 -0
- package/script/oas/ref/DanglingRefError.d.ts +22 -0
- package/script/oas/ref/DanglingRefError.js +37 -0
- package/script/oas/ref/Ref.d.ts +152 -25
- package/script/oas/ref/Ref.js +414 -26
- package/script/oas/requestBody/RequestBody.d.ts +4 -0
- package/script/oas/requestBody/RequestBody.js +8 -0
- package/script/oas/response/Response.d.ts +4 -0
- package/script/oas/response/Response.js +8 -0
- package/script/oas/schema/siblings.d.ts +127 -0
- package/script/oas/schema/siblings.js +305 -0
- package/script/oas/securitySchemes/SecurityScheme.d.ts +16 -0
- package/script/oas/securitySchemes/SecurityScheme.js +32 -0
- package/script/oas/string/String.d.ts +19 -0
- package/script/oas/string/String.js +47 -0
- package/script/oas/union/Union.d.ts +32 -0
- package/script/oas/union/Union.js +111 -0
- package/script/oas/unknown/Unknown.d.ts +18 -0
- package/script/oas/unknown/Unknown.js +38 -0
- package/script/oas/void/Void.d.ts +4 -0
- package/script/oas/void/Void.js +8 -0
- package/script/oas/webhook/Webhook.d.ts +2 -2
- package/script/oas/webhook/Webhook.js +4 -5
- package/script/parse/allOfSystem.d.ts +32 -0
- package/script/parse/allOfSystem.js +35 -0
- package/script/parse/anyOfSystem.d.ts +68 -0
- package/script/parse/anyOfSystem.js +116 -0
- package/script/parse/securityRequirements.d.ts +6 -0
- package/script/parse/securityRequirements.js +8 -0
- package/script/parse/toSiblingKeywords.d.ts +28 -0
- package/script/parse/toSiblingKeywords.js +146 -0
- package/script/parse/v3-0/_merge-all-of/decompose-union.d.ts +8 -0
- package/script/parse/v3-0/_merge-all-of/decompose-union.js +11 -2
- package/script/parse/v3-0/_merge-all-of/generic-merge.d.ts +2 -3
- package/script/parse/v3-0/_merge-all-of/generic-merge.js +2 -2
- package/script/parse/v3-0/_merge-all-of/merge-array-constraints.d.ts +2 -2
- package/script/parse/v3-0/_merge-all-of/merge-array-constraints.js +5 -5
- package/script/parse/v3-0/_merge-all-of/merge-boolean-constraints.d.ts +2 -2
- package/script/parse/v3-0/_merge-all-of/merge-boolean-constraints.js +2 -2
- package/script/parse/v3-0/_merge-all-of/merge-integer-constraints.d.ts +2 -2
- package/script/parse/v3-0/_merge-all-of/merge-integer-constraints.js +2 -2
- package/script/parse/v3-0/_merge-all-of/merge-intersection.d.ts +3 -2
- package/script/parse/v3-0/_merge-all-of/merge-intersection.js +2 -2
- package/script/parse/v3-0/_merge-all-of/merge-number-constraints.d.ts +2 -2
- package/script/parse/v3-0/_merge-all-of/merge-number-constraints.js +2 -2
- package/script/parse/v3-0/_merge-all-of/merge-object-constraints.d.ts +2 -2
- package/script/parse/v3-0/_merge-all-of/merge-object-constraints.js +3 -3
- package/script/parse/v3-0/_merge-all-of/merge-properties.d.ts +2 -2
- package/script/parse/v3-0/_merge-all-of/merge-properties.js +2 -2
- package/script/parse/v3-0/_merge-all-of/merge-string-constraints.d.ts +2 -2
- package/script/parse/v3-0/_merge-all-of/merge-string-constraints.js +3 -3
- package/script/parse/v3-0/_merge-all-of/merge-union.d.ts +10 -3
- package/script/parse/v3-0/_merge-all-of/merge-union.js +52 -13
- package/script/parse/v3-0/_merge-all-of/merge.d.ts +2 -2
- package/script/parse/v3-0/_merge-all-of/merge.js +77 -26
- package/script/parse/v3-0/_merge-all-of/nullable-merge.d.ts +4 -0
- package/script/parse/v3-0/_merge-all-of/nullable-merge.js +9 -7
- package/script/parse/v3-0/_merge-all-of/types.d.ts +33 -0
- package/script/parse/v3-0/mediaType/toMediaTypeItemV3.js +4 -3
- package/script/parse/v3-0/parameter/toParameterV3.js +4 -3
- package/script/parse/v3-0/ref/toRefV31.d.ts +7 -1
- package/script/parse/v3-0/ref/toRefV31.js +6 -3
- package/script/parse/v3-0/schema/toSchemasV3.js +107 -15
- package/script/parse/v3-1/_merge-all-of/decompose-union.d.ts +7 -1
- package/script/parse/v3-1/_merge-all-of/decompose-union.js +8 -2
- package/script/parse/v3-1/_merge-all-of/generic-merge.d.ts +2 -3
- package/script/parse/v3-1/_merge-all-of/generic-merge.js +2 -2
- package/script/parse/v3-1/_merge-all-of/merge-array-constraints.d.ts +3 -2
- package/script/parse/v3-1/_merge-all-of/merge-array-constraints.js +5 -5
- package/script/parse/v3-1/_merge-all-of/merge-boolean-constraints.d.ts +2 -2
- package/script/parse/v3-1/_merge-all-of/merge-boolean-constraints.js +2 -2
- package/script/parse/v3-1/_merge-all-of/merge-integer-constraints.d.ts +2 -2
- package/script/parse/v3-1/_merge-all-of/merge-integer-constraints.js +2 -2
- package/script/parse/v3-1/_merge-all-of/merge-intersection.d.ts +3 -2
- package/script/parse/v3-1/_merge-all-of/merge-intersection.js +2 -2
- package/script/parse/v3-1/_merge-all-of/merge-number-constraints.d.ts +2 -2
- package/script/parse/v3-1/_merge-all-of/merge-number-constraints.js +2 -2
- package/script/parse/v3-1/_merge-all-of/merge-object-constraints.d.ts +2 -2
- package/script/parse/v3-1/_merge-all-of/merge-object-constraints.js +3 -3
- package/script/parse/v3-1/_merge-all-of/merge-properties.d.ts +2 -2
- package/script/parse/v3-1/_merge-all-of/merge-properties.js +2 -2
- package/script/parse/v3-1/_merge-all-of/merge-string-constraints.d.ts +2 -2
- package/script/parse/v3-1/_merge-all-of/merge-string-constraints.js +3 -3
- package/script/parse/v3-1/_merge-all-of/merge-union.d.ts +10 -3
- package/script/parse/v3-1/_merge-all-of/merge-union.js +56 -16
- package/script/parse/v3-1/_merge-all-of/merge.d.ts +3 -2
- package/script/parse/v3-1/_merge-all-of/merge.js +87 -28
- package/script/parse/v3-1/_merge-all-of/nullable-merge.d.ts +4 -0
- package/script/parse/v3-1/_merge-all-of/nullable-merge.js +9 -7
- package/script/parse/v3-1/_merge-all-of/types.d.ts +37 -0
- package/script/parse/v3-1/mediaType/toMediaTypeItemV3.js +4 -3
- package/script/parse/v3-1/parameter/toParameterV3.js +4 -3
- package/script/parse/v3-1/ref/toRefV31.d.ts +7 -1
- package/script/parse/v3-1/ref/toRefV31.js +6 -3
- package/script/parse/v3-1/schema/toSchemasV3.js +111 -16
- package/script/parse/v3-2/_merge-all-of/decompose-union.d.ts +7 -1
- package/script/parse/v3-2/_merge-all-of/decompose-union.js +8 -2
- package/script/parse/v3-2/_merge-all-of/generic-merge.d.ts +2 -3
- package/script/parse/v3-2/_merge-all-of/generic-merge.js +2 -2
- package/script/parse/v3-2/_merge-all-of/merge-array-constraints.d.ts +3 -2
- package/script/parse/v3-2/_merge-all-of/merge-array-constraints.js +5 -5
- package/script/parse/v3-2/_merge-all-of/merge-boolean-constraints.d.ts +2 -2
- package/script/parse/v3-2/_merge-all-of/merge-boolean-constraints.js +2 -2
- package/script/parse/v3-2/_merge-all-of/merge-integer-constraints.d.ts +2 -2
- package/script/parse/v3-2/_merge-all-of/merge-integer-constraints.js +2 -2
- package/script/parse/v3-2/_merge-all-of/merge-intersection.d.ts +3 -2
- package/script/parse/v3-2/_merge-all-of/merge-intersection.js +2 -2
- package/script/parse/v3-2/_merge-all-of/merge-number-constraints.d.ts +2 -2
- package/script/parse/v3-2/_merge-all-of/merge-number-constraints.js +2 -2
- package/script/parse/v3-2/_merge-all-of/merge-object-constraints.d.ts +2 -2
- package/script/parse/v3-2/_merge-all-of/merge-object-constraints.js +3 -3
- package/script/parse/v3-2/_merge-all-of/merge-properties.d.ts +2 -2
- package/script/parse/v3-2/_merge-all-of/merge-properties.js +2 -2
- package/script/parse/v3-2/_merge-all-of/merge-string-constraints.d.ts +2 -2
- package/script/parse/v3-2/_merge-all-of/merge-string-constraints.js +3 -3
- package/script/parse/v3-2/_merge-all-of/merge-union.d.ts +10 -3
- package/script/parse/v3-2/_merge-all-of/merge-union.js +56 -16
- package/script/parse/v3-2/_merge-all-of/merge.d.ts +3 -2
- package/script/parse/v3-2/_merge-all-of/merge.js +87 -28
- package/script/parse/v3-2/_merge-all-of/nullable-merge.d.ts +4 -0
- package/script/parse/v3-2/_merge-all-of/nullable-merge.js +9 -7
- package/script/parse/v3-2/_merge-all-of/types.d.ts +37 -0
- package/script/parse/v3-2/mediaType/toMediaTypeItemV3.js +4 -3
- package/script/parse/v3-2/parameter/toParameterV3.js +4 -3
- package/script/parse/v3-2/ref/toRefV31.d.ts +7 -1
- package/script/parse/v3-2/ref/toRefV31.js +6 -3
- package/script/parse/v3-2/schema/toSchemasV3.js +111 -16
- package/script/types/OasBase.d.ts +1 -1
- package/script/types/Settings.d.ts +44 -0
- package/script/types/Settings.js +10 -1
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { OasUnknown } from '../unknown/Unknown.js';
|
|
1
2
|
import type { SchemaPath } from '../../types/SchemaPath.js';
|
|
2
3
|
import type { OasDiscriminator } from '../discriminator/Discriminator.js';
|
|
3
4
|
import type { OasExternalDocs } from '../externalDocs/ExternalDocs.js';
|
|
@@ -186,10 +187,41 @@ export declare class OasUnion extends OasBase {
|
|
|
186
187
|
* The default value of the union type.
|
|
187
188
|
*/
|
|
188
189
|
default?: unknown;
|
|
190
|
+
/**
|
|
191
|
+
* The schema's `not`, kept as an `OasUnknown` under `client.json`
|
|
192
|
+
* `system.not: unknown`: the document says "not something", and core does
|
|
193
|
+
* not read what. `undefined` otherwise.
|
|
194
|
+
*/
|
|
195
|
+
not: OasUnknown | undefined;
|
|
189
196
|
constructor(fields: UnionFields, context?: ParseContextType);
|
|
190
197
|
isRef(): this is OasRef<'schema'>;
|
|
198
|
+
/** Always `false`: this schema has no `readOnly`. */
|
|
199
|
+
isReadOnly(): boolean;
|
|
200
|
+
/** Always `false`: this schema has no `writeOnly`. */
|
|
201
|
+
isWriteOnly(): boolean;
|
|
202
|
+
/**
|
|
203
|
+
* A copy of this schema with what `ref` adds at its site applied: its
|
|
204
|
+
* `nullable` and the keywords next to it (`SiblingKeywords`) that
|
|
205
|
+
* this type takes, a sibling's value winning. A value that does not fit
|
|
206
|
+
* this type is left out (the parser reports it). For `OasRef.resolve()`.
|
|
207
|
+
* This schema does not change, and the copy shares its child schemas.
|
|
208
|
+
*/
|
|
209
|
+
clone(ref?: OasRef<'schema'>): OasUnion;
|
|
191
210
|
traverse(path: SchemaPath): OasSchema | OasRef<'schema'>;
|
|
192
211
|
resolve(): OasUnion;
|
|
193
212
|
resolveOnce(): OasUnion;
|
|
213
|
+
/**
|
|
214
|
+
* Whether the discriminator alone picks the member of a value: the union
|
|
215
|
+
* names a discriminator, and each member, followed through references, is
|
|
216
|
+
* an object that is not nullable, that requires the discriminator's
|
|
217
|
+
* property, and that allows only string literals for it. No value may
|
|
218
|
+
* belong to two members. A member that is a union, or anything other than
|
|
219
|
+
* an object, makes it `false`, as does a reference on the way that names
|
|
220
|
+
* nothing in the document (kept under `system.danglingRefs: keep`).
|
|
221
|
+
*
|
|
222
|
+
* It reads the schemas only. A generator may refuse more: one that leaves
|
|
223
|
+
* out `readOnly` properties cannot discriminate on one.
|
|
224
|
+
*/
|
|
225
|
+
isDiscriminable(): boolean;
|
|
194
226
|
toJsonSchema(options: ToJsonSchemaOptions): OpenAPIV3.NonArraySchemaObject;
|
|
195
227
|
}
|
|
@@ -2,7 +2,9 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.OasUnion = void 0;
|
|
4
4
|
const traverseSchema_js_1 = require("../schemaPath/traverseSchema.js");
|
|
5
|
+
const siblings_js_1 = require("../schema/siblings.js");
|
|
5
6
|
const OasBase_js_1 = require("../../types/OasBase.js");
|
|
7
|
+
const DanglingRefError_js_1 = require("../ref/DanglingRefError.js");
|
|
6
8
|
/**
|
|
7
9
|
* Represents a union type schema in the OpenAPI Specification.
|
|
8
10
|
*
|
|
@@ -216,6 +218,17 @@ class OasUnion extends OasBase_js_1.OasBase {
|
|
|
216
218
|
writable: true,
|
|
217
219
|
value: void 0
|
|
218
220
|
});
|
|
221
|
+
/**
|
|
222
|
+
* The schema's `not`, kept as an `OasUnknown` under `client.json`
|
|
223
|
+
* `system.not: unknown`: the document says "not something", and core does
|
|
224
|
+
* not read what. `undefined` otherwise.
|
|
225
|
+
*/
|
|
226
|
+
Object.defineProperty(this, "not", {
|
|
227
|
+
enumerable: true,
|
|
228
|
+
configurable: true,
|
|
229
|
+
writable: true,
|
|
230
|
+
value: undefined
|
|
231
|
+
});
|
|
219
232
|
this.title = fields.title;
|
|
220
233
|
this.description = fields.description;
|
|
221
234
|
this.externalDocs = fields.externalDocs;
|
|
@@ -229,6 +242,36 @@ class OasUnion extends OasBase_js_1.OasBase {
|
|
|
229
242
|
isRef() {
|
|
230
243
|
return false;
|
|
231
244
|
}
|
|
245
|
+
/** Always `false`: this schema has no `readOnly`. */
|
|
246
|
+
isReadOnly() {
|
|
247
|
+
return false;
|
|
248
|
+
}
|
|
249
|
+
/** Always `false`: this schema has no `writeOnly`. */
|
|
250
|
+
isWriteOnly() {
|
|
251
|
+
return false;
|
|
252
|
+
}
|
|
253
|
+
/**
|
|
254
|
+
* A copy of this schema with what `ref` adds at its site applied: its
|
|
255
|
+
* `nullable` and the keywords next to it (`SiblingKeywords`) that
|
|
256
|
+
* this type takes, a sibling's value winning. A value that does not fit
|
|
257
|
+
* this type is left out (the parser reports it). For `OasRef.resolve()`.
|
|
258
|
+
* This schema does not change, and the copy shares its child schemas.
|
|
259
|
+
*/
|
|
260
|
+
clone(ref) {
|
|
261
|
+
const nullable = this.nullable || ref?.nullable || undefined;
|
|
262
|
+
const copy = new OasUnion({
|
|
263
|
+
...(0, siblings_js_1.toSiblingAnnotations)(this, ref),
|
|
264
|
+
example: ref?.example ?? this.example,
|
|
265
|
+
externalDocs: this.externalDocs,
|
|
266
|
+
nullable,
|
|
267
|
+
discriminator: this.discriminator,
|
|
268
|
+
members: this.members,
|
|
269
|
+
default: ref?.default ?? this.default,
|
|
270
|
+
});
|
|
271
|
+
copy.stackTrail = this.stackTrail;
|
|
272
|
+
copy.not = this.not;
|
|
273
|
+
return copy;
|
|
274
|
+
}
|
|
232
275
|
traverse(path) {
|
|
233
276
|
return (0, traverseSchema_js_1.traverseSchema)(this, path);
|
|
234
277
|
}
|
|
@@ -238,6 +281,45 @@ class OasUnion extends OasBase_js_1.OasBase {
|
|
|
238
281
|
resolveOnce() {
|
|
239
282
|
return this;
|
|
240
283
|
}
|
|
284
|
+
/**
|
|
285
|
+
* Whether the discriminator alone picks the member of a value: the union
|
|
286
|
+
* names a discriminator, and each member, followed through references, is
|
|
287
|
+
* an object that is not nullable, that requires the discriminator's
|
|
288
|
+
* property, and that allows only string literals for it. No value may
|
|
289
|
+
* belong to two members. A member that is a union, or anything other than
|
|
290
|
+
* an object, makes it `false`, as does a reference on the way that names
|
|
291
|
+
* nothing in the document (kept under `system.danglingRefs: keep`).
|
|
292
|
+
*
|
|
293
|
+
* It reads the schemas only. A generator may refuse more: one that leaves
|
|
294
|
+
* out `readOnly` properties cannot discriminate on one.
|
|
295
|
+
*/
|
|
296
|
+
isDiscriminable() {
|
|
297
|
+
const key = this.discriminator?.propertyName;
|
|
298
|
+
if (key === undefined) {
|
|
299
|
+
return false;
|
|
300
|
+
}
|
|
301
|
+
const seen = new Set();
|
|
302
|
+
try {
|
|
303
|
+
return this.members.every(member => {
|
|
304
|
+
const values = toDiscriminatorValues(member, key);
|
|
305
|
+
return (values !== undefined &&
|
|
306
|
+
values.every(value => {
|
|
307
|
+
if (seen.has(value)) {
|
|
308
|
+
return false;
|
|
309
|
+
}
|
|
310
|
+
seen.add(value);
|
|
311
|
+
return true;
|
|
312
|
+
}));
|
|
313
|
+
});
|
|
314
|
+
}
|
|
315
|
+
catch (error) {
|
|
316
|
+
// A dangling reference: the schema it stands for is not known.
|
|
317
|
+
if (DanglingRefError_js_1.DanglingRefError.is(error)) {
|
|
318
|
+
return false;
|
|
319
|
+
}
|
|
320
|
+
throw error;
|
|
321
|
+
}
|
|
322
|
+
}
|
|
241
323
|
toJsonSchema(options) {
|
|
242
324
|
return {
|
|
243
325
|
title: this.title,
|
|
@@ -250,3 +332,32 @@ class OasUnion extends OasBase_js_1.OasBase {
|
|
|
250
332
|
}
|
|
251
333
|
}
|
|
252
334
|
exports.OasUnion = OasUnion;
|
|
335
|
+
/**
|
|
336
|
+
* The values a member allows for the discriminator `key`, or `undefined`
|
|
337
|
+
* when the member is not an object, is nullable, or does not require `key`
|
|
338
|
+
* with string literals only.
|
|
339
|
+
*/
|
|
340
|
+
const toDiscriminatorValues = (member, key) => {
|
|
341
|
+
// `resolve()`, not `resolveOnce()`: the schema at this site, with the
|
|
342
|
+
// keywords next to the reference (`properties`, `required`) applied.
|
|
343
|
+
if (member.isRef()) {
|
|
344
|
+
return member.nullable ? undefined : toDiscriminatorValues(member.resolve(), key);
|
|
345
|
+
}
|
|
346
|
+
if (member.type !== 'object' || member.nullable) {
|
|
347
|
+
return undefined;
|
|
348
|
+
}
|
|
349
|
+
const property = member.properties?.[key];
|
|
350
|
+
return property === undefined || !member.required?.includes(key) ? undefined : toLiteralValues(property);
|
|
351
|
+
};
|
|
352
|
+
/** The string literals a schema allows, or `undefined` when it allows anything else too. */
|
|
353
|
+
const toLiteralValues = (schema) => {
|
|
354
|
+
if (schema.isRef()) {
|
|
355
|
+
return schema.nullable ? undefined : toLiteralValues(schema.resolve());
|
|
356
|
+
}
|
|
357
|
+
if (schema.type !== 'string' || schema.nullable || schema.enums === undefined) {
|
|
358
|
+
return undefined;
|
|
359
|
+
}
|
|
360
|
+
const enums = schema.enums;
|
|
361
|
+
const strings = enums.filter((value) => value !== null);
|
|
362
|
+
return strings.length > 0 && strings.length === enums.length ? strings : undefined;
|
|
363
|
+
};
|
|
@@ -43,8 +43,26 @@ export declare class OasUnknown extends OasBase {
|
|
|
43
43
|
example: unknown | undefined;
|
|
44
44
|
/** Whether the unknown type is nullable */
|
|
45
45
|
nullable: boolean | undefined;
|
|
46
|
+
/**
|
|
47
|
+
* The schema's `not`, kept as an `OasUnknown` under `client.json`
|
|
48
|
+
* `system.not: unknown`: the document says "not something", and core does
|
|
49
|
+
* not read what. `undefined` otherwise.
|
|
50
|
+
*/
|
|
51
|
+
not: OasUnknown | undefined;
|
|
46
52
|
constructor(fields?: UnknownFields, context?: ParseContextType);
|
|
47
53
|
isRef(): this is OasRef<'schema'>;
|
|
54
|
+
/** Always `false`: this schema has no `readOnly`. */
|
|
55
|
+
isReadOnly(): boolean;
|
|
56
|
+
/** Always `false`: this schema has no `writeOnly`. */
|
|
57
|
+
isWriteOnly(): boolean;
|
|
58
|
+
/**
|
|
59
|
+
* A copy of this schema with what `ref` adds at its site applied: its
|
|
60
|
+
* `nullable` and the keywords next to it (`SiblingKeywords`) that
|
|
61
|
+
* this type takes, a sibling's value winning. A value that does not fit
|
|
62
|
+
* this type is left out (the parser reports it). For `OasRef.resolve()`.
|
|
63
|
+
* This schema does not change, and the copy shares its child schemas.
|
|
64
|
+
*/
|
|
65
|
+
clone(ref?: OasRef<'schema'>): OasUnknown;
|
|
48
66
|
traverse(path: SchemaPath): OasSchema | OasRef<'schema'>;
|
|
49
67
|
resolve(): OasUnknown;
|
|
50
68
|
resolveOnce(): OasUnknown;
|
|
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.OasUnknown = void 0;
|
|
4
4
|
require("../../_dnt.polyfills.js");
|
|
5
5
|
const traverseSchema_js_1 = require("../schemaPath/traverseSchema.js");
|
|
6
|
+
const siblings_js_1 = require("../schema/siblings.js");
|
|
6
7
|
const OasBase_js_1 = require("../../types/OasBase.js");
|
|
7
8
|
/**
|
|
8
9
|
* Object representing an unknown type in the OpenAPI Specification.
|
|
@@ -72,6 +73,17 @@ class OasUnknown extends OasBase_js_1.OasBase {
|
|
|
72
73
|
writable: true,
|
|
73
74
|
value: void 0
|
|
74
75
|
});
|
|
76
|
+
/**
|
|
77
|
+
* The schema's `not`, kept as an `OasUnknown` under `client.json`
|
|
78
|
+
* `system.not: unknown`: the document says "not something", and core does
|
|
79
|
+
* not read what. `undefined` otherwise.
|
|
80
|
+
*/
|
|
81
|
+
Object.defineProperty(this, "not", {
|
|
82
|
+
enumerable: true,
|
|
83
|
+
configurable: true,
|
|
84
|
+
writable: true,
|
|
85
|
+
value: undefined
|
|
86
|
+
});
|
|
75
87
|
this.title = fields.title;
|
|
76
88
|
this.description = fields.description;
|
|
77
89
|
this.extensionFields = fields.extensionFields;
|
|
@@ -81,6 +93,32 @@ class OasUnknown extends OasBase_js_1.OasBase {
|
|
|
81
93
|
isRef() {
|
|
82
94
|
return false;
|
|
83
95
|
}
|
|
96
|
+
/** Always `false`: this schema has no `readOnly`. */
|
|
97
|
+
isReadOnly() {
|
|
98
|
+
return false;
|
|
99
|
+
}
|
|
100
|
+
/** Always `false`: this schema has no `writeOnly`. */
|
|
101
|
+
isWriteOnly() {
|
|
102
|
+
return false;
|
|
103
|
+
}
|
|
104
|
+
/**
|
|
105
|
+
* A copy of this schema with what `ref` adds at its site applied: its
|
|
106
|
+
* `nullable` and the keywords next to it (`SiblingKeywords`) that
|
|
107
|
+
* this type takes, a sibling's value winning. A value that does not fit
|
|
108
|
+
* this type is left out (the parser reports it). For `OasRef.resolve()`.
|
|
109
|
+
* This schema does not change, and the copy shares its child schemas.
|
|
110
|
+
*/
|
|
111
|
+
clone(ref) {
|
|
112
|
+
const nullable = this.nullable || ref?.nullable || undefined;
|
|
113
|
+
const copy = new OasUnknown({
|
|
114
|
+
...(0, siblings_js_1.toSiblingAnnotations)(this, ref),
|
|
115
|
+
example: ref?.example ?? this.example,
|
|
116
|
+
nullable,
|
|
117
|
+
});
|
|
118
|
+
copy.stackTrail = this.stackTrail;
|
|
119
|
+
copy.not = this.not;
|
|
120
|
+
return copy;
|
|
121
|
+
}
|
|
84
122
|
traverse(path) {
|
|
85
123
|
return (0, traverseSchema_js_1.traverseSchema)(this, path);
|
|
86
124
|
}
|
|
@@ -159,6 +159,10 @@ export declare class OasVoid extends OasBase {
|
|
|
159
159
|
constructor(fields?: VoidFields, context?: ParseContextType);
|
|
160
160
|
static empty(): OasVoid;
|
|
161
161
|
isRef(): this is OasRef<'schema'>;
|
|
162
|
+
/** Always `false`: this schema has no `readOnly`. */
|
|
163
|
+
isReadOnly(): boolean;
|
|
164
|
+
/** Always `false`: this schema has no `writeOnly`. */
|
|
165
|
+
isWriteOnly(): boolean;
|
|
162
166
|
resolve(): OasVoid;
|
|
163
167
|
resolveOnce(): OasVoid;
|
|
164
168
|
}
|
package/script/oas/void/Void.js
CHANGED
|
@@ -179,6 +179,14 @@ class OasVoid extends OasBase_js_1.OasBase {
|
|
|
179
179
|
isRef() {
|
|
180
180
|
return false;
|
|
181
181
|
}
|
|
182
|
+
/** Always `false`: this schema has no `readOnly`. */
|
|
183
|
+
isReadOnly() {
|
|
184
|
+
return false;
|
|
185
|
+
}
|
|
186
|
+
/** Always `false`: this schema has no `writeOnly`. */
|
|
187
|
+
isWriteOnly() {
|
|
188
|
+
return false;
|
|
189
|
+
}
|
|
182
190
|
resolve() {
|
|
183
191
|
return this;
|
|
184
192
|
}
|
|
@@ -122,8 +122,8 @@ export declare class OasWebhook extends OasBase {
|
|
|
122
122
|
/**
|
|
123
123
|
* Resolve the inbound parameters (e.g. the signature/headers a handler
|
|
124
124
|
* receives), optionally filtered by location. Mirrors
|
|
125
|
-
* {@link OasOperation.toParams}
|
|
126
|
-
* their direction is inbound.
|
|
125
|
+
* {@link OasOperation.toParams}, path item parameters included; the
|
|
126
|
+
* parameters carry the same shape, only their direction is inbound.
|
|
127
127
|
*/
|
|
128
128
|
toParams(filter?: OasParameterLocation[]): OasParameter[];
|
|
129
129
|
/**
|
|
@@ -4,6 +4,7 @@ exports.OasWebhook = void 0;
|
|
|
4
4
|
require("../../_dnt.polyfills.js");
|
|
5
5
|
const toPrimaryResponseCode_js_1 = require("../response/toPrimaryResponseCode.js");
|
|
6
6
|
const OasBase_js_1 = require("../../types/OasBase.js");
|
|
7
|
+
const toEffectiveParameters_js_1 = require("../operation/toEffectiveParameters.js");
|
|
7
8
|
/**
|
|
8
9
|
* Represents an OpenAPI 3.1 webhook — a third OAS subject, peer to
|
|
9
10
|
* {@link OasOperation} and the schema/model subjects.
|
|
@@ -171,13 +172,11 @@ class OasWebhook extends OasBase_js_1.OasBase {
|
|
|
171
172
|
/**
|
|
172
173
|
* Resolve the inbound parameters (e.g. the signature/headers a handler
|
|
173
174
|
* receives), optionally filtered by location. Mirrors
|
|
174
|
-
* {@link OasOperation.toParams}
|
|
175
|
-
* their direction is inbound.
|
|
175
|
+
* {@link OasOperation.toParams}, path item parameters included; the
|
|
176
|
+
* parameters carry the same shape, only their direction is inbound.
|
|
176
177
|
*/
|
|
177
178
|
toParams(filter) {
|
|
178
|
-
return (this.parameters
|
|
179
|
-
?.map(param => param.resolve())
|
|
180
|
-
.filter(param => (filter?.length ? filter.includes(param.location) : true)) ?? []);
|
|
179
|
+
return (0, toEffectiveParameters_js_1.toResolvedParameters)((0, toEffectiveParameters_js_1.toEffectiveParameters)({ own: this.parameters, shared: this.pathItem?.parameters })).filter(param => (filter?.length ? filter.includes(param.location) : true));
|
|
181
180
|
}
|
|
182
181
|
/**
|
|
183
182
|
* The status code of the primary acknowledgement response — the lowest 2xx
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import type { ParseContextType } from '../context/parseTypes.js';
|
|
2
|
+
import type { StackTrail } from '../context/StackTrail.js';
|
|
3
|
+
/** What the `allOf` merge reads of `client.json#settings.system`, and what it reports back. */
|
|
4
|
+
type AllOfSystem = {
|
|
5
|
+
allOf: 'strict' | 'latestWins';
|
|
6
|
+
not: 'strict' | 'unknown';
|
|
7
|
+
anyOf: 'union' | 'unknown';
|
|
8
|
+
/** The keywords a later member replaced under `latestWins`. */
|
|
9
|
+
replaced: Set<string>;
|
|
10
|
+
/** The keywords the merge read as any value: `anyOf` under `system.anyOf: unknown`. */
|
|
11
|
+
unknown: Set<string>;
|
|
12
|
+
};
|
|
13
|
+
/**
|
|
14
|
+
* The `system` settings for one merge: the `allOf` mode, `strict` when the
|
|
15
|
+
* settings leave it out, and an empty set for the keywords a later member
|
|
16
|
+
* replaces. Shared by the 3.0, 3.1 and 3.2 parsers.
|
|
17
|
+
*/
|
|
18
|
+
export declare const toAllOfSystem: (context: ParseContextType) => AllOfSystem;
|
|
19
|
+
type LogAllOfContradictionsArgs = {
|
|
20
|
+
system: AllOfSystem;
|
|
21
|
+
/** The trail of the schema whose members were merged. */
|
|
22
|
+
stackTrail: StackTrail;
|
|
23
|
+
parent: unknown;
|
|
24
|
+
context: ParseContextType;
|
|
25
|
+
};
|
|
26
|
+
/**
|
|
27
|
+
* One warning for a schema whose `allOf` members contradicted, naming the
|
|
28
|
+
* keywords the later member kept (`system.allOf: latestWins`). Nothing when
|
|
29
|
+
* no keyword was replaced.
|
|
30
|
+
*/
|
|
31
|
+
export declare const logAllOfContradictions: ({ system, stackTrail, parent, context }: LogAllOfContradictionsArgs) => void;
|
|
32
|
+
export {};
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.logAllOfContradictions = exports.toAllOfSystem = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* The `system` settings for one merge: the `allOf` mode, `strict` when the
|
|
6
|
+
* settings leave it out, and an empty set for the keywords a later member
|
|
7
|
+
* replaces. Shared by the 3.0, 3.1 and 3.2 parsers.
|
|
8
|
+
*/
|
|
9
|
+
const toAllOfSystem = (context) => ({
|
|
10
|
+
// A test's mock context may have no `system`.
|
|
11
|
+
allOf: context.system?.allOf ?? 'strict',
|
|
12
|
+
not: context.system?.not ?? 'strict',
|
|
13
|
+
anyOf: context.system?.anyOf ?? 'union',
|
|
14
|
+
replaced: new Set(),
|
|
15
|
+
unknown: new Set()
|
|
16
|
+
});
|
|
17
|
+
exports.toAllOfSystem = toAllOfSystem;
|
|
18
|
+
/**
|
|
19
|
+
* One warning for a schema whose `allOf` members contradicted, naming the
|
|
20
|
+
* keywords the later member kept (`system.allOf: latestWins`). Nothing when
|
|
21
|
+
* no keyword was replaced.
|
|
22
|
+
*/
|
|
23
|
+
const logAllOfContradictions = ({ system, stackTrail, parent, context }) => {
|
|
24
|
+
if (system.replaced.size === 0) {
|
|
25
|
+
return;
|
|
26
|
+
}
|
|
27
|
+
context.logIssueNoKey({
|
|
28
|
+
level: 'warning',
|
|
29
|
+
message: `The allOf members contradict on ${[...system.replaced].join(', ')}; the later member's values are kept (system.allOf is latestWins).`,
|
|
30
|
+
parent,
|
|
31
|
+
stackTrail,
|
|
32
|
+
type: 'ALLOF_CONTRADICTION'
|
|
33
|
+
});
|
|
34
|
+
};
|
|
35
|
+
exports.logAllOfContradictions = logAllOfContradictions;
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import type { OpenAPIV3 } from 'openapi-types';
|
|
2
|
+
import type { ParseContextType } from '../context/parseTypes.js';
|
|
3
|
+
import type { StackTrail } from '../context/StackTrail.js';
|
|
4
|
+
/** Whether one of the members of an `anyOf` is only `null`. */
|
|
5
|
+
export declare const hasNullMember: (members: readonly object[]) => boolean;
|
|
6
|
+
/** Follows a reference to the schema it names, as the parsers' `GetRefFn` does. */
|
|
7
|
+
type GetRefFn = (ref: OpenAPIV3.ReferenceObject) => OpenAPIV3.SchemaObject;
|
|
8
|
+
/** Arguments for {@link isUnknownAnyOf}. */
|
|
9
|
+
type IsUnknownAnyOfArgs = {
|
|
10
|
+
/** The `anyOf` members, as the document writes them. */
|
|
11
|
+
members: readonly (OpenAPIV3.ReferenceObject | OpenAPIV3.SchemaObject)[];
|
|
12
|
+
/** `client.json` `system.anyOf`. A test's mock context may have none. */
|
|
13
|
+
setting: 'union' | 'unknown' | undefined;
|
|
14
|
+
getRef: GetRefFn;
|
|
15
|
+
};
|
|
16
|
+
/**
|
|
17
|
+
* Whether `system.anyOf: unknown` reads an `anyOf` as any value, as
|
|
18
|
+
* Cloudflare's `cf` reads it: when it has two or more members, not counting a
|
|
19
|
+
* `null` one, and one of them is not a single value.
|
|
20
|
+
*
|
|
21
|
+
* - An `anyOf` with one member is read as before, so `anyOf: [{ $ref }, {
|
|
22
|
+
* type: 'null' }]` stays a nullable reference.
|
|
23
|
+
* - An `anyOf` of single values stays a union (`string | number`): cf gives
|
|
24
|
+
* it one flag.
|
|
25
|
+
*/
|
|
26
|
+
export declare const isUnknownAnyOf: ({ members, setting, getRef }: IsUnknownAnyOfArgs) => boolean;
|
|
27
|
+
/** Arguments for {@link withoutUnknownAnyOf}. */
|
|
28
|
+
type WithoutUnknownAnyOfArgs = {
|
|
29
|
+
schema: OpenAPIV3.SchemaObject;
|
|
30
|
+
/** `client.json` `system.anyOf`. */
|
|
31
|
+
setting: 'union' | 'unknown' | undefined;
|
|
32
|
+
getRef: GetRefFn;
|
|
33
|
+
};
|
|
34
|
+
/**
|
|
35
|
+
* `schema` with its other keywords and without an `anyOf` that
|
|
36
|
+
* `system.anyOf: unknown` reads as any value ({@link isUnknownAnyOf}), so the
|
|
37
|
+
* properties next to the `anyOf` stay. A `null` member makes it nullable. Any
|
|
38
|
+
* other schema is returned as it is.
|
|
39
|
+
*/
|
|
40
|
+
export declare const withoutUnknownAnyOf: ({ schema, setting, getRef }: WithoutUnknownAnyOfArgs) => OpenAPIV3.SchemaObject;
|
|
41
|
+
/**
|
|
42
|
+
* Whether the keywords that are left when an `anyOf` is read as any value
|
|
43
|
+
* ({@link withoutUnknownAnyOf}) give the schema a shape of its own:
|
|
44
|
+
* `properties` next to the `anyOf` do. A `default`, an `example` or a
|
|
45
|
+
* `format` alone does not. The parser must not guess a type from them, as it
|
|
46
|
+
* does for a schema that has no type (`MISSING_STRING_TYPE`): the members
|
|
47
|
+
* were the type, and they are gone.
|
|
48
|
+
*/
|
|
49
|
+
export declare const hasShapeKeyword: (schema: object) => boolean;
|
|
50
|
+
/** Arguments for {@link logUnknownAnyOf}. */
|
|
51
|
+
type LogUnknownAnyOfArgs = {
|
|
52
|
+
/** The trail of the schema whose `anyOf` was read as any value. */
|
|
53
|
+
stackTrail: StackTrail;
|
|
54
|
+
parent: unknown;
|
|
55
|
+
context: ParseContextType;
|
|
56
|
+
};
|
|
57
|
+
/** Arguments for {@link logMergedUnknownAnyOf}. */
|
|
58
|
+
type LogMergedUnknownAnyOfArgs = LogUnknownAnyOfArgs & {
|
|
59
|
+
/** The merge's `system`: `unknown` holds `anyOf` when the merge read one as any value. */
|
|
60
|
+
system: {
|
|
61
|
+
unknown: Set<string>;
|
|
62
|
+
};
|
|
63
|
+
};
|
|
64
|
+
/** One warning for a schema whose merge read an `anyOf` as any value. Nothing when it read none. */
|
|
65
|
+
export declare const logMergedUnknownAnyOf: ({ system, stackTrail, parent, context }: LogMergedUnknownAnyOfArgs) => void;
|
|
66
|
+
/** One warning for a schema whose `anyOf` was read as any value (`system.anyOf: unknown`). */
|
|
67
|
+
export declare const logUnknownAnyOf: ({ stackTrail, parent, context }: LogUnknownAnyOfArgs) => void;
|
|
68
|
+
export {};
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.logUnknownAnyOf = exports.logMergedUnknownAnyOf = exports.hasShapeKeyword = exports.withoutUnknownAnyOf = exports.isUnknownAnyOf = exports.hasNullMember = void 0;
|
|
4
|
+
const normalize_schema_shape_js_1 = require("./v3-2/schema/normalize-schema-shape.js");
|
|
5
|
+
/**
|
|
6
|
+
* Whether an `anyOf` member is only `null`: 3.0's `{ nullable: true, enum:
|
|
7
|
+
* [null] }`, or 3.1's `{ type: 'null' }` or `{ type: ['null'] }`, as the
|
|
8
|
+
* parsers read a null member.
|
|
9
|
+
*/
|
|
10
|
+
const isNullMember = (member) => {
|
|
11
|
+
const fields = Object.fromEntries(Object.entries(member));
|
|
12
|
+
const values = fields.enum;
|
|
13
|
+
return ((0, normalize_schema_shape_js_1.isNullOnlyType)(fields.type) ||
|
|
14
|
+
(fields.nullable === true && Array.isArray(values) && values.length === 1 && values[0] === null));
|
|
15
|
+
};
|
|
16
|
+
/** Whether one of the members of an `anyOf` is only `null`. */
|
|
17
|
+
const hasNullMember = (members) => members.some(isNullMember);
|
|
18
|
+
exports.hasNullMember = hasNullMember;
|
|
19
|
+
/** The types of a single value: a member of one of them is a scalar. */
|
|
20
|
+
const SCALAR_TYPES = ['string', 'number', 'integer', 'boolean'];
|
|
21
|
+
/** The JavaScript types of a scalar enum value. */
|
|
22
|
+
const SCALAR_VALUE_TYPES = ['string', 'number', 'boolean'];
|
|
23
|
+
/**
|
|
24
|
+
* Whether an `anyOf` member, followed through its references, is a single
|
|
25
|
+
* value: its `type` is a string, number, integer or boolean (besides `null`),
|
|
26
|
+
* or it has no `type` and an `enum` of such values.
|
|
27
|
+
*/
|
|
28
|
+
const isScalarMember = (member) => {
|
|
29
|
+
const fields = Object.fromEntries(Object.entries(member));
|
|
30
|
+
const types = Array.isArray(fields.type) ? fields.type.filter(type => type !== 'null') : [fields.type];
|
|
31
|
+
if (fields.type !== undefined) {
|
|
32
|
+
return types.length > 0 && types.every(type => SCALAR_TYPES.includes(type));
|
|
33
|
+
}
|
|
34
|
+
return (Array.isArray(fields.enum) &&
|
|
35
|
+
fields.enum.every(value => value === null || SCALAR_VALUE_TYPES.includes(typeof value)));
|
|
36
|
+
};
|
|
37
|
+
/** Follows a member through its references, to the schema it names. Stops after 10 steps, at a cycle. */
|
|
38
|
+
const toMemberSchema = (member, getRef, steps = 0) => {
|
|
39
|
+
if (!('$ref' in member)) {
|
|
40
|
+
return member;
|
|
41
|
+
}
|
|
42
|
+
return steps < 10 ? toMemberSchema(getRef(member), getRef, steps + 1) : undefined;
|
|
43
|
+
};
|
|
44
|
+
/**
|
|
45
|
+
* Whether `system.anyOf: unknown` reads an `anyOf` as any value, as
|
|
46
|
+
* Cloudflare's `cf` reads it: when it has two or more members, not counting a
|
|
47
|
+
* `null` one, and one of them is not a single value.
|
|
48
|
+
*
|
|
49
|
+
* - An `anyOf` with one member is read as before, so `anyOf: [{ $ref }, {
|
|
50
|
+
* type: 'null' }]` stays a nullable reference.
|
|
51
|
+
* - An `anyOf` of single values stays a union (`string | number`): cf gives
|
|
52
|
+
* it one flag.
|
|
53
|
+
*/
|
|
54
|
+
const isUnknownAnyOf = ({ members, setting, getRef }) => {
|
|
55
|
+
if (setting !== 'unknown') {
|
|
56
|
+
return false;
|
|
57
|
+
}
|
|
58
|
+
const values = members.filter(member => !isNullMember(member)).map(member => toMemberSchema(member, getRef));
|
|
59
|
+
return values.length > 1 && !values.every(value => value !== undefined && isScalarMember(value));
|
|
60
|
+
};
|
|
61
|
+
exports.isUnknownAnyOf = isUnknownAnyOf;
|
|
62
|
+
/**
|
|
63
|
+
* `schema` with its other keywords and without an `anyOf` that
|
|
64
|
+
* `system.anyOf: unknown` reads as any value ({@link isUnknownAnyOf}), so the
|
|
65
|
+
* properties next to the `anyOf` stay. A `null` member makes it nullable. Any
|
|
66
|
+
* other schema is returned as it is.
|
|
67
|
+
*/
|
|
68
|
+
const withoutUnknownAnyOf = ({ schema, setting, getRef }) => {
|
|
69
|
+
const members = schema.anyOf ?? [];
|
|
70
|
+
if (!(0, exports.isUnknownAnyOf)({ members, setting, getRef })) {
|
|
71
|
+
return schema;
|
|
72
|
+
}
|
|
73
|
+
const { anyOf: _anyOf, ...keywords } = schema;
|
|
74
|
+
return (0, exports.hasNullMember)(members) ? { ...keywords, nullable: true } : keywords;
|
|
75
|
+
};
|
|
76
|
+
exports.withoutUnknownAnyOf = withoutUnknownAnyOf;
|
|
77
|
+
/** The keywords that give a schema its own shape, so it is more than any value. */
|
|
78
|
+
const SHAPE_KEYWORDS = [
|
|
79
|
+
'type',
|
|
80
|
+
'properties',
|
|
81
|
+
'additionalProperties',
|
|
82
|
+
'items',
|
|
83
|
+
'enum',
|
|
84
|
+
'const',
|
|
85
|
+
'allOf',
|
|
86
|
+
'oneOf',
|
|
87
|
+
'$ref'
|
|
88
|
+
];
|
|
89
|
+
/**
|
|
90
|
+
* Whether the keywords that are left when an `anyOf` is read as any value
|
|
91
|
+
* ({@link withoutUnknownAnyOf}) give the schema a shape of its own:
|
|
92
|
+
* `properties` next to the `anyOf` do. A `default`, an `example` or a
|
|
93
|
+
* `format` alone does not. The parser must not guess a type from them, as it
|
|
94
|
+
* does for a schema that has no type (`MISSING_STRING_TYPE`): the members
|
|
95
|
+
* were the type, and they are gone.
|
|
96
|
+
*/
|
|
97
|
+
const hasShapeKeyword = (schema) => SHAPE_KEYWORDS.some(keyword => keyword in schema);
|
|
98
|
+
exports.hasShapeKeyword = hasShapeKeyword;
|
|
99
|
+
/** One warning for a schema whose merge read an `anyOf` as any value. Nothing when it read none. */
|
|
100
|
+
const logMergedUnknownAnyOf = ({ system, stackTrail, parent, context }) => {
|
|
101
|
+
if (system.unknown.has('anyOf')) {
|
|
102
|
+
(0, exports.logUnknownAnyOf)({ stackTrail, parent, context });
|
|
103
|
+
}
|
|
104
|
+
};
|
|
105
|
+
exports.logMergedUnknownAnyOf = logMergedUnknownAnyOf;
|
|
106
|
+
/** One warning for a schema whose `anyOf` was read as any value (`system.anyOf: unknown`). */
|
|
107
|
+
const logUnknownAnyOf = ({ stackTrail, parent, context }) => {
|
|
108
|
+
context.logIssueNoKey({
|
|
109
|
+
level: 'warning',
|
|
110
|
+
message: 'The anyOf is read as any value (system.anyOf is unknown): the schema keeps its other keywords, without the anyOf members.',
|
|
111
|
+
parent,
|
|
112
|
+
stackTrail,
|
|
113
|
+
type: 'ANYOF_AS_UNKNOWN'
|
|
114
|
+
});
|
|
115
|
+
};
|
|
116
|
+
exports.logUnknownAnyOf = logUnknownAnyOf;
|
|
@@ -58,6 +58,12 @@ export type ToOperationsWithValidSecurityArgs<Item extends SecuredItem> = {
|
|
|
58
58
|
* failed to parse or is not defined, or that has no `security` and
|
|
59
59
|
* inherits an unusable root. Each dropped item logs one `INVALID_OPERATION`
|
|
60
60
|
* error on its own trail. `security: []` inherits nothing and is kept.
|
|
61
|
+
*
|
|
62
|
+
* A kept item depends on each scheme its security names (its own, else the
|
|
63
|
+
* root's), as it would on a `$ref` to it, so it is registered as a consumer
|
|
64
|
+
* of the scheme. When the parser removes the scheme later (one that is a
|
|
65
|
+
* `$ref` that names nothing), the item goes with it, and so is never kept
|
|
66
|
+
* without its auth.
|
|
61
67
|
*/
|
|
62
68
|
export declare const toOperationsWithValidSecurity: <Item extends SecuredItem>({ items, check }: ToOperationsWithValidSecurityArgs<Item>) => Item[];
|
|
63
69
|
export {};
|
|
@@ -112,6 +112,12 @@ exports.toSecurityCheck = toSecurityCheck;
|
|
|
112
112
|
* failed to parse or is not defined, or that has no `security` and
|
|
113
113
|
* inherits an unusable root. Each dropped item logs one `INVALID_OPERATION`
|
|
114
114
|
* error on its own trail. `security: []` inherits nothing and is kept.
|
|
115
|
+
*
|
|
116
|
+
* A kept item depends on each scheme its security names (its own, else the
|
|
117
|
+
* root's), as it would on a `$ref` to it, so it is registered as a consumer
|
|
118
|
+
* of the scheme. When the parser removes the scheme later (one that is a
|
|
119
|
+
* `$ref` that names nothing), the item goes with it, and so is never kept
|
|
120
|
+
* without its auth.
|
|
115
121
|
*/
|
|
116
122
|
const toOperationsWithValidSecurity = ({ items, check }) => {
|
|
117
123
|
return items.filter(item => {
|
|
@@ -119,6 +125,8 @@ const toOperationsWithValidSecurity = ({ items, check }) => {
|
|
|
119
125
|
? toSchemeProblems(item.security, check).map(capitalize).join('. ') || undefined
|
|
120
126
|
: check.rootProblem;
|
|
121
127
|
if (message === undefined) {
|
|
128
|
+
const names = (item.security ?? check.rootSecurity ?? []).flatMap(({ requirement }) => Object.keys(requirement));
|
|
129
|
+
new Set(names).forEach(name => check.context.registerRef(item.stackTrail.clone(), `#/components/securitySchemes/${name}`));
|
|
122
130
|
return true;
|
|
123
131
|
}
|
|
124
132
|
check.context.logIssueNoKey({
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import type { OpenAPIV3 } from 'openapi-types';
|
|
2
|
+
import type { ParseContextType } from '../context/parseTypes.js';
|
|
3
|
+
import type { StackTrail } from '../context/StackTrail.js';
|
|
4
|
+
import type { OasSchema } from '../oas/schema/Schema.js';
|
|
5
|
+
import type { OasRef } from '../oas/ref/Ref.js';
|
|
6
|
+
import type { SiblingKeywords } from '../oas/schema/siblings.js';
|
|
7
|
+
type ToSiblingKeywordsArgs = {
|
|
8
|
+
/** The keywords next to the one member, without `allOf` and the use-site flags. */
|
|
9
|
+
keywords: OpenAPIV3.SchemaObject;
|
|
10
|
+
/** `keywords.properties`, parsed by the caller's version of the parser. */
|
|
11
|
+
properties: Record<string, OasSchema | OasRef<'schema'>> | undefined;
|
|
12
|
+
/** `keywords.additionalProperties`, parsed the same way. */
|
|
13
|
+
additionalProperties: boolean | OasSchema | OasRef<'schema'> | undefined;
|
|
14
|
+
/** The trail of the schema that holds the `allOf`. */
|
|
15
|
+
stackTrail: StackTrail;
|
|
16
|
+
context: ParseContextType;
|
|
17
|
+
};
|
|
18
|
+
/**
|
|
19
|
+
* The keywords next to a reference in a one-member `allOf`, read without the
|
|
20
|
+
* target's type (see `SiblingKeywords`): the reference stays lazy, so the
|
|
21
|
+
* target may not be parsed yet. The ones the target cannot take are left out
|
|
22
|
+
* at generate time (`OasRef.toSkippedSiblings`). An extension (`x-*`) is kept, as each
|
|
23
|
+
* version's `toSpecificationExtensionsV3` keeps one; a keyword that no schema
|
|
24
|
+
* has here is reported. `undefined` when no keyword is left. Shared by the
|
|
25
|
+
* 3.0, 3.1 and 3.2 parsers.
|
|
26
|
+
*/
|
|
27
|
+
export declare const toSiblingKeywords: ({ keywords, properties, additionalProperties, stackTrail, context }: ToSiblingKeywordsArgs) => SiblingKeywords | undefined;
|
|
28
|
+
export {};
|