@skmtc/core 0.39.0 → 0.40.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 +5 -4
- package/esm/context/GenerateContext.js +110 -37
- package/esm/context/ParseContext.d.ts +9 -1
- package/esm/context/ParseContext.js +12 -1
- package/esm/context/generateTypes.d.ts +19 -4
- package/esm/context/generateTypes.js +2 -0
- package/esm/context/toGenerationFailure.d.ts +21 -0
- package/esm/context/toGenerationFailure.js +38 -0
- 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/mod.d.ts +1 -0
- package/esm/mod.js +1 -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 +5 -1
- package/esm/oas/operation/Operation.js +17 -5
- package/esm/oas/operation/toEffectiveParameters.d.ts +16 -0
- package/esm/oas/operation/toEffectiveParameters.js +13 -0
- package/esm/oas/parameter/Parameter.d.ts +4 -0
- package/esm/oas/parameter/Parameter.js +8 -0
- package/esm/oas/ref/Ref.d.ts +147 -25
- package/esm/oas/ref/Ref.js +387 -25
- 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 +240 -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 +31 -0
- package/esm/oas/union/Union.js +100 -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 +6 -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/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/ref/toRefV31.d.ts +7 -1
- package/esm/parse/v3-0/ref/toRefV31.js +2 -2
- 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/ref/toRefV31.d.ts +7 -1
- package/esm/parse/v3-1/ref/toRefV31.js +2 -2
- 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/ref/toRefV31.d.ts +7 -1
- package/esm/parse/v3-2/ref/toRefV31.js +2 -2
- package/esm/parse/v3-2/schema/toSchemasV3.js +111 -16
- package/esm/types/OasBase.d.ts +1 -1
- package/esm/types/Settings.d.ts +34 -0
- package/esm/types/Settings.js +8 -0
- package/package.json +1 -1
- package/script/context/CoreContext.js +22 -8
- package/script/context/GenerateContext.d.ts +5 -4
- package/script/context/GenerateContext.js +110 -37
- package/script/context/ParseContext.d.ts +9 -1
- package/script/context/ParseContext.js +12 -1
- package/script/context/generateTypes.d.ts +19 -4
- package/script/context/generateTypes.js +2 -0
- package/script/context/toGenerationFailure.d.ts +21 -0
- package/script/context/toGenerationFailure.js +43 -0
- 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/mod.d.ts +1 -0
- package/script/mod.js +1 -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 +5 -1
- package/script/oas/operation/Operation.js +17 -5
- package/script/oas/operation/toEffectiveParameters.d.ts +16 -0
- package/script/oas/operation/toEffectiveParameters.js +17 -0
- package/script/oas/parameter/Parameter.d.ts +4 -0
- package/script/oas/parameter/Parameter.js +8 -0
- package/script/oas/ref/Ref.d.ts +147 -25
- package/script/oas/ref/Ref.js +387 -25
- 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 +295 -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 +31 -0
- package/script/oas/union/Union.js +100 -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 +6 -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/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/ref/toRefV31.d.ts +7 -1
- package/script/parse/v3-0/ref/toRefV31.js +2 -2
- 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/ref/toRefV31.d.ts +7 -1
- package/script/parse/v3-1/ref/toRefV31.js +2 -2
- 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/ref/toRefV31.d.ts +7 -1
- package/script/parse/v3-2/ref/toRefV31.js +2 -2
- package/script/parse/v3-2/schema/toSchemasV3.js +111 -16
- package/script/types/OasBase.d.ts +1 -1
- package/script/types/Settings.d.ts +34 -0
- package/script/types/Settings.js +9 -1
|
@@ -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,13 @@ 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
|
-
|
|
180
|
-
.filter(param => (filter?.length ? filter.includes(param.location) : true))
|
|
179
|
+
return (0, toEffectiveParameters_js_1.toEffectiveParameters)({ own: this.parameters, shared: this.pathItem?.parameters })
|
|
180
|
+
.map(param => param.resolve())
|
|
181
|
+
.filter(param => (filter?.length ? filter.includes(param.location) : true));
|
|
181
182
|
}
|
|
182
183
|
/**
|
|
183
184
|
* 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;
|
|
@@ -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 {};
|
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.toSiblingKeywords = void 0;
|
|
37
|
+
const isEmpty_js_1 = require("../helpers/isEmpty.js");
|
|
38
|
+
const v = __importStar(require("valibot"));
|
|
39
|
+
/**
|
|
40
|
+
* The checks the type parsers make (`oasStringData`, `oasNumberData`, …) on
|
|
41
|
+
* the keywords that do not depend on the target's type. `default`, `enum`
|
|
42
|
+
* and `example` do, so `clone` checks them once the target is known.
|
|
43
|
+
*/
|
|
44
|
+
const SIBLING_CHECKS = {
|
|
45
|
+
title: v.string(),
|
|
46
|
+
description: v.string(),
|
|
47
|
+
deprecated: v.boolean(),
|
|
48
|
+
format: v.string(),
|
|
49
|
+
minLength: v.number(),
|
|
50
|
+
maxLength: v.number(),
|
|
51
|
+
pattern: v.string(),
|
|
52
|
+
multipleOf: v.number(),
|
|
53
|
+
minimum: v.number(),
|
|
54
|
+
maximum: v.number(),
|
|
55
|
+
// 3.1's numeric form is normalized to `minimum` plus `true` before this point.
|
|
56
|
+
exclusiveMinimum: v.boolean(),
|
|
57
|
+
exclusiveMaximum: v.boolean(),
|
|
58
|
+
minItems: v.number(),
|
|
59
|
+
maxItems: v.number(),
|
|
60
|
+
uniqueItems: v.boolean(),
|
|
61
|
+
required: v.array(v.string()),
|
|
62
|
+
minProperties: v.number(),
|
|
63
|
+
maxProperties: v.number()
|
|
64
|
+
};
|
|
65
|
+
/**
|
|
66
|
+
* The keywords next to a reference in a one-member `allOf`, read without the
|
|
67
|
+
* target's type (see `SiblingKeywords`): the reference stays lazy, so the
|
|
68
|
+
* target may not be parsed yet. The ones the target cannot take are left out
|
|
69
|
+
* at generate time (`OasRef.toSkippedSiblings`). An extension (`x-*`) is kept, as each
|
|
70
|
+
* version's `toSpecificationExtensionsV3` keeps one; a keyword that no schema
|
|
71
|
+
* has here is reported. `undefined` when no keyword is left. Shared by the
|
|
72
|
+
* 3.0, 3.1 and 3.2 parsers.
|
|
73
|
+
*/
|
|
74
|
+
const toSiblingKeywords = ({ keywords, properties, additionalProperties, stackTrail, context }) => {
|
|
75
|
+
const { properties: _properties, additionalProperties: _additionalProperties, type, title, description, deprecated, example, default: defaultValue, enum: enums, format, minLength, maxLength, pattern, multipleOf, minimum, maximum, exclusiveMinimum, exclusiveMaximum, minItems, maxItems, uniqueItems, required, minProperties, maxProperties, ...rest } = keywords;
|
|
76
|
+
const entries = Object.entries(rest);
|
|
77
|
+
const extensionFields = Object.fromEntries(entries.filter(([key]) => key.startsWith('x-')));
|
|
78
|
+
const skipped = Object.fromEntries(entries.filter(([key]) => !key.startsWith('x-')));
|
|
79
|
+
if (!(0, isEmpty_js_1.isEmpty)(skipped)) {
|
|
80
|
+
context.logSkippedFields({
|
|
81
|
+
skipped,
|
|
82
|
+
parent: keywords,
|
|
83
|
+
parentType: 'schema:siblings',
|
|
84
|
+
stackTrail
|
|
85
|
+
});
|
|
86
|
+
}
|
|
87
|
+
if (enums !== undefined && !Array.isArray(enums)) {
|
|
88
|
+
context.logIssue({
|
|
89
|
+
key: 'enum',
|
|
90
|
+
level: 'warning',
|
|
91
|
+
message: `Removed invalid enum. Expected an array, got: ${JSON.stringify(enums)}`,
|
|
92
|
+
parent: keywords,
|
|
93
|
+
stackTrail,
|
|
94
|
+
type: 'INVALID_ENUM'
|
|
95
|
+
});
|
|
96
|
+
}
|
|
97
|
+
// A value the type parsers would refuse is left out, with a warning: the
|
|
98
|
+
// rest of the site still parses, as a schema's other faults do.
|
|
99
|
+
const checked = (key, value) => {
|
|
100
|
+
if (value === undefined) {
|
|
101
|
+
return undefined;
|
|
102
|
+
}
|
|
103
|
+
const result = v.safeParse(SIBLING_CHECKS[key], value);
|
|
104
|
+
if (result.success) {
|
|
105
|
+
return value;
|
|
106
|
+
}
|
|
107
|
+
context.logIssue({
|
|
108
|
+
key,
|
|
109
|
+
level: 'warning',
|
|
110
|
+
message: `Removed invalid ${key} next to a reference: ${result.issues[0].message}`,
|
|
111
|
+
parent: keywords,
|
|
112
|
+
stackTrail,
|
|
113
|
+
type: 'INVALID_SCHEMA'
|
|
114
|
+
});
|
|
115
|
+
return undefined;
|
|
116
|
+
};
|
|
117
|
+
const siblings = {
|
|
118
|
+
_type: type,
|
|
119
|
+
title: checked('title', title),
|
|
120
|
+
description: checked('description', description),
|
|
121
|
+
deprecated: checked('deprecated', deprecated),
|
|
122
|
+
example,
|
|
123
|
+
default: defaultValue,
|
|
124
|
+
enums: Array.isArray(enums) ? enums : undefined,
|
|
125
|
+
extensionFields: (0, isEmpty_js_1.isEmpty)(extensionFields) ? undefined : extensionFields,
|
|
126
|
+
format: checked('format', format),
|
|
127
|
+
minLength: checked('minLength', minLength),
|
|
128
|
+
maxLength: checked('maxLength', maxLength),
|
|
129
|
+
pattern: checked('pattern', pattern),
|
|
130
|
+
multipleOf: checked('multipleOf', multipleOf),
|
|
131
|
+
minimum: checked('minimum', minimum),
|
|
132
|
+
maximum: checked('maximum', maximum),
|
|
133
|
+
exclusiveMinimum: checked('exclusiveMinimum', exclusiveMinimum),
|
|
134
|
+
exclusiveMaximum: checked('exclusiveMaximum', exclusiveMaximum),
|
|
135
|
+
minItems: checked('minItems', minItems),
|
|
136
|
+
maxItems: checked('maxItems', maxItems),
|
|
137
|
+
uniqueItems: checked('uniqueItems', uniqueItems),
|
|
138
|
+
properties,
|
|
139
|
+
required: checked('required', required),
|
|
140
|
+
additionalProperties,
|
|
141
|
+
minProperties: checked('minProperties', minProperties),
|
|
142
|
+
maxProperties: checked('maxProperties', maxProperties)
|
|
143
|
+
};
|
|
144
|
+
return Object.values(siblings).some(value => value !== undefined) ? siblings : undefined;
|
|
145
|
+
};
|
|
146
|
+
exports.toSiblingKeywords = toSiblingKeywords;
|
|
@@ -9,4 +9,12 @@ type DecomposeUnionReturn = {
|
|
|
9
9
|
afterExcluded: SchemaObject;
|
|
10
10
|
};
|
|
11
11
|
export declare const decomposeUnion: ({ schema, groupType }: DecomposeUnionArgs) => DecomposeUnionReturn;
|
|
12
|
+
/**
|
|
13
|
+
* Is `key` a union-level key, kept on the union rather than merged into each
|
|
14
|
+
* member? A specification extension (`x-…`) is one too: it says something
|
|
15
|
+
* about the union, as Fern's `x-fern-property-name` renames the property,
|
|
16
|
+
* and `toUnion` keeps it. Merged into each member, it was lost, and each
|
|
17
|
+
* `$ref` member was resolved to merge it.
|
|
18
|
+
*/
|
|
19
|
+
export declare const isUnionLevelKey: (key: string) => boolean;
|
|
12
20
|
export {};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.decomposeUnion = void 0;
|
|
3
|
+
exports.isUnionLevelKey = exports.decomposeUnion = void 0;
|
|
4
4
|
// Convert a schema object into an array of schemas that can be merged iteratively into a new schema
|
|
5
5
|
const decomposeUnion = ({ schema, groupType }) => {
|
|
6
6
|
if (!schema[groupType]) {
|
|
@@ -60,9 +60,18 @@ const excludedProperties = [
|
|
|
60
60
|
'writeOnly',
|
|
61
61
|
'deprecated'
|
|
62
62
|
];
|
|
63
|
+
/**
|
|
64
|
+
* Is `key` a union-level key, kept on the union rather than merged into each
|
|
65
|
+
* member? A specification extension (`x-…`) is one too: it says something
|
|
66
|
+
* about the union, as Fern's `x-fern-property-name` renames the property,
|
|
67
|
+
* and `toUnion` keeps it. Merged into each member, it was lost, and each
|
|
68
|
+
* `$ref` member was resolved to merge it.
|
|
69
|
+
*/
|
|
70
|
+
const isUnionLevelKey = (key) => excludedProperties.includes(key) || key.startsWith('x-');
|
|
71
|
+
exports.isUnionLevelKey = isUnionLevelKey;
|
|
63
72
|
const exclude = (entries) => {
|
|
64
73
|
return entries.reduce((acc, [key, value]) => {
|
|
65
|
-
if (
|
|
74
|
+
if ((0, exports.isUnionLevelKey)(key)) {
|
|
66
75
|
acc.excluded.push([key, value]);
|
|
67
76
|
}
|
|
68
77
|
else {
|
|
@@ -1,3 +1,2 @@
|
|
|
1
|
-
import type { SchemaObject,
|
|
2
|
-
|
|
3
|
-
export declare const genericMerge: <T>(first: SchemaObject, second: SchemaObject, getRef: GetRefFn, typeCheck?: v.GenericSchema<T>) => SchemaObject;
|
|
1
|
+
import type { SchemaObject, GenericMergeArgs } from './types.js';
|
|
2
|
+
export declare const genericMerge: <T>({ first, second, getRef, system, typeCheck }: GenericMergeArgs<T>) => SchemaObject;
|
|
@@ -4,11 +4,11 @@ exports.genericMerge = void 0;
|
|
|
4
4
|
const merge_enum_values_js_1 = require("./merge-enum-values.js");
|
|
5
5
|
const merge_properties_js_1 = require("./merge-properties.js");
|
|
6
6
|
const merge_required_js_1 = require("./merge-required.js");
|
|
7
|
-
const genericMerge = (first, second, getRef, typeCheck) => {
|
|
7
|
+
const genericMerge = ({ first, second, getRef, system, typeCheck }) => {
|
|
8
8
|
return {
|
|
9
9
|
...first,
|
|
10
10
|
...second,
|
|
11
|
-
...(0, merge_properties_js_1.mergeProperties)(first, second, getRef),
|
|
11
|
+
...(0, merge_properties_js_1.mergeProperties)({ first, second, getRef, system }),
|
|
12
12
|
...(0, merge_required_js_1.mergeRequired)(first, second),
|
|
13
13
|
...(0, merge_enum_values_js_1.mergeEnumValues)(first, second, typeCheck)
|
|
14
14
|
};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import type { ArraySchemaObject,
|
|
2
|
-
export declare function mergeArrayConstraints(first
|
|
1
|
+
import type { ArraySchemaObject, SchemaObject, MergeArgs } from './types.js';
|
|
2
|
+
export declare function mergeArrayConstraints({ first, second, getRef, system }: MergeArgs<ArraySchemaObject | SchemaObject>): ArraySchemaObject;
|