@skmtc/core 0.38.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
|
@@ -0,0 +1,295 @@
|
|
|
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
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
36
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
37
|
+
};
|
|
38
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
+
exports.toSiblingEnums = exports.toSiblingValue = exports.isIntegerFormat = exports.isNumberFormat = exports.VALUE_CHECKS = exports.isObjectValue = exports.isArrayValue = exports.isBooleanValue = exports.isIntegerValue = exports.isNumberValue = exports.isStringValue = exports.toSiblingAnnotations = exports.toSkippedSiblings = exports.changesValues = exports.changesTarget = exports.hasSiblingKeywords = exports.mergeSiblingKeywords = exports.SIBLINGS_BY_TYPE = void 0;
|
|
40
|
+
const v = __importStar(require("valibot"));
|
|
41
|
+
const isEqual_js_1 = __importDefault(require("lodash-es/isEqual.js"));
|
|
42
|
+
const number_types_js_1 = require("../number/number-types.js");
|
|
43
|
+
const integer_types_js_1 = require("../integer/integer-types.js");
|
|
44
|
+
/**
|
|
45
|
+
* The use-site flags, taken by every type, so they are never reported as
|
|
46
|
+
* left out. A union's or unknown's copy has no `readOnly` or `writeOnly`
|
|
47
|
+
* field, but the reference still answers `isReadOnly()` and
|
|
48
|
+
* `isWriteOnly()` from its own flag.
|
|
49
|
+
*/
|
|
50
|
+
const FLAGS = ['nullable', 'readOnly', 'writeOnly'];
|
|
51
|
+
const DESCRIBING = [...FLAGS, 'title', 'description', 'extensionFields', 'example'];
|
|
52
|
+
const NUMERIC = [
|
|
53
|
+
'deprecated',
|
|
54
|
+
'default',
|
|
55
|
+
'enums',
|
|
56
|
+
'format',
|
|
57
|
+
'multipleOf',
|
|
58
|
+
'minimum',
|
|
59
|
+
'maximum',
|
|
60
|
+
'exclusiveMinimum',
|
|
61
|
+
'exclusiveMaximum'
|
|
62
|
+
];
|
|
63
|
+
/** The keywords each schema class's `clone` takes: the fields its type has. */
|
|
64
|
+
exports.SIBLINGS_BY_TYPE = {
|
|
65
|
+
string: [...DESCRIBING, 'deprecated', 'default', 'enums', 'format', 'minLength', 'maxLength', 'pattern'],
|
|
66
|
+
number: [...DESCRIBING, ...NUMERIC],
|
|
67
|
+
integer: [...DESCRIBING, ...NUMERIC],
|
|
68
|
+
boolean: [...DESCRIBING, 'deprecated', 'default', 'enums'],
|
|
69
|
+
array: [...DESCRIBING, 'deprecated', 'default', 'enums', 'minItems', 'maxItems', 'uniqueItems'],
|
|
70
|
+
object: [
|
|
71
|
+
...DESCRIBING,
|
|
72
|
+
'deprecated',
|
|
73
|
+
'default',
|
|
74
|
+
'enums',
|
|
75
|
+
'properties',
|
|
76
|
+
'required',
|
|
77
|
+
'additionalProperties',
|
|
78
|
+
'minProperties',
|
|
79
|
+
'maxProperties'
|
|
80
|
+
],
|
|
81
|
+
union: [...DESCRIBING, 'default'],
|
|
82
|
+
unknown: DESCRIBING
|
|
83
|
+
};
|
|
84
|
+
/** Every keyword `clone` can apply, for any type. */
|
|
85
|
+
const SIBLING_KEYWORDS = [...new Set(Object.values(exports.SIBLINGS_BY_TYPE).flat())];
|
|
86
|
+
/**
|
|
87
|
+
* The keywords of `over` merged over those of `base`, for a reference copied
|
|
88
|
+
* with what another site adds (`OasRef.clone`): a flag set on either stays
|
|
89
|
+
* set, a keyword `over` sets wins, extension fields and `properties` merge,
|
|
90
|
+
* and `required` names add up, as each schema class's `clone` merges them
|
|
91
|
+
* into a schema.
|
|
92
|
+
*/
|
|
93
|
+
const mergeSiblingKeywords = (base, over) => ({
|
|
94
|
+
nullable: base.nullable || over?.nullable || undefined,
|
|
95
|
+
readOnly: base.readOnly || over?.readOnly || undefined,
|
|
96
|
+
writeOnly: base.writeOnly || over?.writeOnly || undefined,
|
|
97
|
+
_type: over?._type ?? base._type,
|
|
98
|
+
title: over?.title ?? base.title,
|
|
99
|
+
description: over?.description ?? base.description,
|
|
100
|
+
deprecated: over?.deprecated ?? base.deprecated,
|
|
101
|
+
example: over?.example ?? base.example,
|
|
102
|
+
default: over?.default ?? base.default,
|
|
103
|
+
enums: over?.enums ?? base.enums,
|
|
104
|
+
extensionFields: base.extensionFields === undefined && over?.extensionFields === undefined
|
|
105
|
+
? undefined
|
|
106
|
+
: { ...base.extensionFields, ...over?.extensionFields },
|
|
107
|
+
format: over?.format ?? base.format,
|
|
108
|
+
minLength: over?.minLength ?? base.minLength,
|
|
109
|
+
maxLength: over?.maxLength ?? base.maxLength,
|
|
110
|
+
pattern: over?.pattern ?? base.pattern,
|
|
111
|
+
multipleOf: over?.multipleOf ?? base.multipleOf,
|
|
112
|
+
minimum: over?.minimum ?? base.minimum,
|
|
113
|
+
maximum: over?.maximum ?? base.maximum,
|
|
114
|
+
exclusiveMinimum: over?.exclusiveMinimum ?? base.exclusiveMinimum,
|
|
115
|
+
exclusiveMaximum: over?.exclusiveMaximum ?? base.exclusiveMaximum,
|
|
116
|
+
minItems: over?.minItems ?? base.minItems,
|
|
117
|
+
maxItems: over?.maxItems ?? base.maxItems,
|
|
118
|
+
uniqueItems: over?.uniqueItems ?? base.uniqueItems,
|
|
119
|
+
properties: over?.properties === undefined ? base.properties : { ...base.properties, ...over.properties },
|
|
120
|
+
required: over?.required === undefined ? base.required : [...new Set([...(base.required ?? []), ...over.required])],
|
|
121
|
+
additionalProperties: over?.additionalProperties ?? base.additionalProperties,
|
|
122
|
+
minProperties: over?.minProperties ?? base.minProperties,
|
|
123
|
+
maxProperties: over?.maxProperties ?? base.maxProperties
|
|
124
|
+
});
|
|
125
|
+
exports.mergeSiblingKeywords = mergeSiblingKeywords;
|
|
126
|
+
/** Whether `siblings` holds any keyword. */
|
|
127
|
+
const hasSiblingKeywords = (siblings) => siblings._type !== undefined || SIBLING_KEYWORDS.some(keyword => siblings[keyword] !== undefined);
|
|
128
|
+
exports.hasSiblingKeywords = hasSiblingKeywords;
|
|
129
|
+
/** The keywords that change which values a site accepts, not only how it is described. */
|
|
130
|
+
const VALUE_KEYWORDS = [
|
|
131
|
+
'enums',
|
|
132
|
+
'format',
|
|
133
|
+
'minLength',
|
|
134
|
+
'maxLength',
|
|
135
|
+
'pattern',
|
|
136
|
+
'multipleOf',
|
|
137
|
+
'minimum',
|
|
138
|
+
'maximum',
|
|
139
|
+
'exclusiveMinimum',
|
|
140
|
+
'exclusiveMaximum',
|
|
141
|
+
'minItems',
|
|
142
|
+
'maxItems',
|
|
143
|
+
'uniqueItems',
|
|
144
|
+
'properties',
|
|
145
|
+
'required',
|
|
146
|
+
'additionalProperties',
|
|
147
|
+
'minProperties',
|
|
148
|
+
'maxProperties'
|
|
149
|
+
];
|
|
150
|
+
/** Keywords that `clone` merges with `||`: `false` and absent mean the same. */
|
|
151
|
+
const BOOLEAN_KEYWORDS = [
|
|
152
|
+
'nullable',
|
|
153
|
+
'readOnly',
|
|
154
|
+
'writeOnly',
|
|
155
|
+
'deprecated',
|
|
156
|
+
'exclusiveMinimum',
|
|
157
|
+
'exclusiveMaximum',
|
|
158
|
+
'uniqueItems'
|
|
159
|
+
];
|
|
160
|
+
/**
|
|
161
|
+
* The keywords next to a reference that make `copy` (the target with them
|
|
162
|
+
* applied) differ from `target`. A keyword the target's type does not take,
|
|
163
|
+
* a flag the target already has, and a value equal to the target's change
|
|
164
|
+
* nothing.
|
|
165
|
+
*/
|
|
166
|
+
const toChangedKeywords = (copy, target, siblings) => exports.SIBLINGS_BY_TYPE[target.type].filter(keyword => {
|
|
167
|
+
if (siblings[keyword] === undefined) {
|
|
168
|
+
return false;
|
|
169
|
+
}
|
|
170
|
+
const applied = Reflect.get(copy, keyword);
|
|
171
|
+
const original = Reflect.get(target, keyword);
|
|
172
|
+
return BOOLEAN_KEYWORDS.includes(keyword) ? (applied === true) !== (original === true) : !(0, isEqual_js_1.default)(applied, original);
|
|
173
|
+
});
|
|
174
|
+
/** Whether the keywords next to a reference change `target` at that site. The engine behind `OasRef.resolve`. */
|
|
175
|
+
const changesTarget = (copy, target, siblings) => toChangedKeywords(copy, target, siblings).length > 0;
|
|
176
|
+
exports.changesTarget = changesTarget;
|
|
177
|
+
/**
|
|
178
|
+
* Whether the keywords next to a reference change which values `target`
|
|
179
|
+
* accepts at that site (`minLength` next to a string, `properties` next to an
|
|
180
|
+
* object), not only how it is described (`description`, `deprecated`,
|
|
181
|
+
* `default`, `x-*`). The engine behind `OasRef.hasValueSiblings`.
|
|
182
|
+
*/
|
|
183
|
+
const changesValues = (copy, target, siblings) => toChangedKeywords(copy, target, siblings).some(keyword => VALUE_KEYWORDS.includes(keyword));
|
|
184
|
+
exports.changesValues = changesValues;
|
|
185
|
+
/**
|
|
186
|
+
* The keywords next to a reference that `clone` leaves out for `target`, by
|
|
187
|
+
* their names in the document: one its type does not have (`minLength` next
|
|
188
|
+
* to an array), a `type` that disagrees with the target's, and an `example`,
|
|
189
|
+
* `default`, `enum` or `format` whose value does not fit. `nullable` says
|
|
190
|
+
* whether the site takes `null` among the `enum` members. The engine behind
|
|
191
|
+
* `OasRef.toSkippedSiblings`.
|
|
192
|
+
*/
|
|
193
|
+
const toSkippedSiblings = (target, siblings, nullable) => {
|
|
194
|
+
const taken = exports.SIBLINGS_BY_TYPE[target.type];
|
|
195
|
+
const fits = exports.VALUE_CHECKS[target.type];
|
|
196
|
+
const isSkipped = (keyword, value) => {
|
|
197
|
+
if (value === undefined) {
|
|
198
|
+
return false;
|
|
199
|
+
}
|
|
200
|
+
if (!taken.includes(keyword)) {
|
|
201
|
+
return true;
|
|
202
|
+
}
|
|
203
|
+
switch (keyword) {
|
|
204
|
+
case 'example':
|
|
205
|
+
case 'default':
|
|
206
|
+
return !fits(value);
|
|
207
|
+
case 'enums':
|
|
208
|
+
return !Array.isArray(value) || !value.every(item => fits(item) || (nullable === true && item === null));
|
|
209
|
+
case 'format':
|
|
210
|
+
return !fitsFormat(target.type, value);
|
|
211
|
+
default:
|
|
212
|
+
return false;
|
|
213
|
+
}
|
|
214
|
+
};
|
|
215
|
+
const type = siblings._type !== undefined && !agrees(siblings._type, target, 0) ? ['type'] : [];
|
|
216
|
+
const others = SIBLING_KEYWORDS.filter(keyword => isSkipped(keyword, siblings[keyword])).map(toDocumentKeyword);
|
|
217
|
+
return [...type, ...others];
|
|
218
|
+
};
|
|
219
|
+
exports.toSkippedSiblings = toSkippedSiblings;
|
|
220
|
+
/** How deep {@link agrees} follows union members, so a union that contains itself ends. */
|
|
221
|
+
const MAX_DEPTH = 10;
|
|
222
|
+
/**
|
|
223
|
+
* A `type` next to a reference agrees with the target's when it names it, or
|
|
224
|
+
* `number` for an integer. Next to a union, it agrees when every member,
|
|
225
|
+
* followed through references, has that type (`type: object` next to a
|
|
226
|
+
* `oneOf` of objects): leaving it out then loses nothing.
|
|
227
|
+
*/
|
|
228
|
+
const agrees = (type, target, depth) => {
|
|
229
|
+
if (target.type === 'union') {
|
|
230
|
+
return depth < MAX_DEPTH &&
|
|
231
|
+
target.members.every(member => agrees(type, member.isRef() ? member.resolve() : member, depth + 1));
|
|
232
|
+
}
|
|
233
|
+
return type === target.type || (type === 'number' && target.type === 'integer');
|
|
234
|
+
};
|
|
235
|
+
/** Whether `format` fits a schema of `type`, as `clone` reads it: any string for a string. */
|
|
236
|
+
const fitsFormat = (type, format) => {
|
|
237
|
+
switch (type) {
|
|
238
|
+
case 'number':
|
|
239
|
+
return (0, exports.isNumberFormat)(format);
|
|
240
|
+
case 'integer':
|
|
241
|
+
return (0, exports.isIntegerFormat)(format);
|
|
242
|
+
default:
|
|
243
|
+
return (0, exports.isStringValue)(format);
|
|
244
|
+
}
|
|
245
|
+
};
|
|
246
|
+
/** The document's name for a keyword: `enum` for `enums`. */
|
|
247
|
+
const toDocumentKeyword = (keyword) => (keyword === 'enums' ? 'enum' : keyword);
|
|
248
|
+
/** The annotations of `target` with those of `siblings` applied: a sibling's value wins, and extension fields merge. */
|
|
249
|
+
const toSiblingAnnotations = (target, siblings) => ({
|
|
250
|
+
title: siblings?.title ?? target.title,
|
|
251
|
+
description: siblings?.description ?? target.description,
|
|
252
|
+
extensionFields: target.extensionFields === undefined && siblings?.extensionFields === undefined
|
|
253
|
+
? undefined
|
|
254
|
+
: { ...target.extensionFields, ...siblings?.extensionFields }
|
|
255
|
+
});
|
|
256
|
+
exports.toSiblingAnnotations = toSiblingAnnotations;
|
|
257
|
+
/** The value checks the parser makes for `example`, `default` and each `enum` member, by type. */
|
|
258
|
+
const isStringValue = (value) => typeof value === 'string';
|
|
259
|
+
exports.isStringValue = isStringValue;
|
|
260
|
+
const isNumberValue = (value) => typeof value === 'number';
|
|
261
|
+
exports.isNumberValue = isNumberValue;
|
|
262
|
+
const isIntegerValue = (value) => Number.isInteger(value);
|
|
263
|
+
exports.isIntegerValue = isIntegerValue;
|
|
264
|
+
const isBooleanValue = (value) => typeof value === 'boolean';
|
|
265
|
+
exports.isBooleanValue = isBooleanValue;
|
|
266
|
+
const isArrayValue = (value) => Array.isArray(value);
|
|
267
|
+
exports.isArrayValue = isArrayValue;
|
|
268
|
+
const isObjectValue = (value) => typeof value === 'object' && value !== null && !Array.isArray(value);
|
|
269
|
+
exports.isObjectValue = isObjectValue;
|
|
270
|
+
const isAnyValue = (_value) => true;
|
|
271
|
+
/** {@link isStringValue} and the others, keyed by the type they check for. A union or unknown takes any value. */
|
|
272
|
+
exports.VALUE_CHECKS = {
|
|
273
|
+
string: exports.isStringValue,
|
|
274
|
+
number: exports.isNumberValue,
|
|
275
|
+
integer: exports.isIntegerValue,
|
|
276
|
+
boolean: exports.isBooleanValue,
|
|
277
|
+
array: exports.isArrayValue,
|
|
278
|
+
object: exports.isObjectValue,
|
|
279
|
+
union: isAnyValue,
|
|
280
|
+
unknown: isAnyValue
|
|
281
|
+
};
|
|
282
|
+
/** The formats a number and an integer take. A string takes any format. */
|
|
283
|
+
const isNumberFormat = (value) => v.is(number_types_js_1.numberFormat, value);
|
|
284
|
+
exports.isNumberFormat = isNumberFormat;
|
|
285
|
+
const isIntegerFormat = (value) => v.is(integer_types_js_1.integerFormat, value);
|
|
286
|
+
exports.isIntegerFormat = isIntegerFormat;
|
|
287
|
+
/** `value` when it passes `check`, else `undefined`: for `example`, `default` and `format`. */
|
|
288
|
+
const toSiblingValue = (value, check) => check(value) ? value : undefined;
|
|
289
|
+
exports.toSiblingValue = toSiblingValue;
|
|
290
|
+
/**
|
|
291
|
+
* `enums` when every member passes `check`, or is `null` at a nullable site,
|
|
292
|
+
* else `undefined`. The parser reports the members that do not.
|
|
293
|
+
*/
|
|
294
|
+
const toSiblingEnums = (enums, check, nullable) => enums?.every((item) => check(item) || (nullable === true && item === null)) ? enums : undefined;
|
|
295
|
+
exports.toSiblingEnums = toSiblingEnums;
|
|
@@ -73,6 +73,10 @@ export declare class OasHttpSecurityScheme {
|
|
|
73
73
|
bearerFormat: string | undefined;
|
|
74
74
|
constructor(fields: HttpSecuritySchemeFields);
|
|
75
75
|
isRef(): this is OasRef<'securityScheme'>;
|
|
76
|
+
/** Always `false`: `readOnly` is a schema keyword. */
|
|
77
|
+
isReadOnly(): boolean;
|
|
78
|
+
/** Always `false`: `writeOnly` is a schema keyword. */
|
|
79
|
+
isWriteOnly(): boolean;
|
|
76
80
|
resolve(): OasHttpSecurityScheme;
|
|
77
81
|
resolveOnce(): OasHttpSecurityScheme;
|
|
78
82
|
toJsonSchema(): HttpSecuritySchemeJson;
|
|
@@ -86,6 +90,10 @@ export declare class OasApiKeySecurityScheme {
|
|
|
86
90
|
location: 'query' | 'header' | 'cookie';
|
|
87
91
|
constructor(fields: ApiKeySecuritySchemeFields);
|
|
88
92
|
isRef(): this is OasRef<'securityScheme'>;
|
|
93
|
+
/** Always `false`: `readOnly` is a schema keyword. */
|
|
94
|
+
isReadOnly(): boolean;
|
|
95
|
+
/** Always `false`: `writeOnly` is a schema keyword. */
|
|
96
|
+
isWriteOnly(): boolean;
|
|
89
97
|
resolve(): OasApiKeySecurityScheme;
|
|
90
98
|
resolveOnce(): OasApiKeySecurityScheme;
|
|
91
99
|
toJsonSchema(): ApiKeySecuritySchemeJson;
|
|
@@ -136,6 +144,10 @@ export declare class OasOAuth2SecurityScheme {
|
|
|
136
144
|
};
|
|
137
145
|
constructor(fields: OAuth2SecuritySchemeFields);
|
|
138
146
|
isRef(): this is OasRef<'securityScheme'>;
|
|
147
|
+
/** Always `false`: `readOnly` is a schema keyword. */
|
|
148
|
+
isReadOnly(): boolean;
|
|
149
|
+
/** Always `false`: `writeOnly` is a schema keyword. */
|
|
150
|
+
isWriteOnly(): boolean;
|
|
139
151
|
resolve(): OasOAuth2SecurityScheme;
|
|
140
152
|
resolveOnce(): OasOAuth2SecurityScheme;
|
|
141
153
|
toJsonSchema(): OAuth2SecuritySchemeJson;
|
|
@@ -148,6 +160,10 @@ export declare class OasOpenIdSecurityScheme {
|
|
|
148
160
|
openIdConnectUrl: string;
|
|
149
161
|
constructor(fields: OpenIdSecuritySchemeFields);
|
|
150
162
|
isRef(): this is OasRef<'securityScheme'>;
|
|
163
|
+
/** Always `false`: `readOnly` is a schema keyword. */
|
|
164
|
+
isReadOnly(): boolean;
|
|
165
|
+
/** Always `false`: `writeOnly` is a schema keyword. */
|
|
166
|
+
isWriteOnly(): boolean;
|
|
151
167
|
resolve(): OasOpenIdSecurityScheme;
|
|
152
168
|
resolveOnce(): OasOpenIdSecurityScheme;
|
|
153
169
|
toJsonSchema(): OpenIdSecuritySchemeJson;
|
|
@@ -47,6 +47,14 @@ class OasHttpSecurityScheme {
|
|
|
47
47
|
isRef() {
|
|
48
48
|
return false;
|
|
49
49
|
}
|
|
50
|
+
/** Always `false`: `readOnly` is a schema keyword. */
|
|
51
|
+
isReadOnly() {
|
|
52
|
+
return false;
|
|
53
|
+
}
|
|
54
|
+
/** Always `false`: `writeOnly` is a schema keyword. */
|
|
55
|
+
isWriteOnly() {
|
|
56
|
+
return false;
|
|
57
|
+
}
|
|
50
58
|
resolve() {
|
|
51
59
|
return this;
|
|
52
60
|
}
|
|
@@ -110,6 +118,14 @@ class OasApiKeySecurityScheme {
|
|
|
110
118
|
isRef() {
|
|
111
119
|
return false;
|
|
112
120
|
}
|
|
121
|
+
/** Always `false`: `readOnly` is a schema keyword. */
|
|
122
|
+
isReadOnly() {
|
|
123
|
+
return false;
|
|
124
|
+
}
|
|
125
|
+
/** Always `false`: `writeOnly` is a schema keyword. */
|
|
126
|
+
isWriteOnly() {
|
|
127
|
+
return false;
|
|
128
|
+
}
|
|
113
129
|
resolve() {
|
|
114
130
|
return this;
|
|
115
131
|
}
|
|
@@ -172,6 +188,14 @@ class OasOAuth2SecurityScheme {
|
|
|
172
188
|
isRef() {
|
|
173
189
|
return false;
|
|
174
190
|
}
|
|
191
|
+
/** Always `false`: `readOnly` is a schema keyword. */
|
|
192
|
+
isReadOnly() {
|
|
193
|
+
return false;
|
|
194
|
+
}
|
|
195
|
+
/** Always `false`: `writeOnly` is a schema keyword. */
|
|
196
|
+
isWriteOnly() {
|
|
197
|
+
return false;
|
|
198
|
+
}
|
|
175
199
|
resolve() {
|
|
176
200
|
return this;
|
|
177
201
|
}
|
|
@@ -238,6 +262,14 @@ class OasOpenIdSecurityScheme {
|
|
|
238
262
|
isRef() {
|
|
239
263
|
return false;
|
|
240
264
|
}
|
|
265
|
+
/** Always `false`: `readOnly` is a schema keyword. */
|
|
266
|
+
isReadOnly() {
|
|
267
|
+
return false;
|
|
268
|
+
}
|
|
269
|
+
/** Always `false`: `writeOnly` is a schema keyword. */
|
|
270
|
+
isWriteOnly() {
|
|
271
|
+
return false;
|
|
272
|
+
}
|
|
241
273
|
resolve() {
|
|
242
274
|
return this;
|
|
243
275
|
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import "../../_dnt.polyfills.js";
|
|
2
|
+
import type { OasUnknown } from '../unknown/Unknown.js';
|
|
2
3
|
import type { SchemaPath } from '../../types/SchemaPath.js';
|
|
3
4
|
import type { OasRef } from '../ref/Ref.js';
|
|
4
5
|
import type { OasSchema, ToJsonSchemaOptions } from '../schema/Schema.js';
|
|
@@ -102,8 +103,26 @@ export declare class OasString<Nullable extends boolean | undefined = boolean |
|
|
|
102
103
|
* Whether the string is deprecated.
|
|
103
104
|
*/
|
|
104
105
|
deprecated: boolean | undefined;
|
|
106
|
+
/**
|
|
107
|
+
* The schema's `not`, kept as an `OasUnknown` under `client.json`
|
|
108
|
+
* `system.not: unknown`: the document says "not something", and core does
|
|
109
|
+
* not read what. `undefined` otherwise.
|
|
110
|
+
*/
|
|
111
|
+
not: OasUnknown | undefined;
|
|
105
112
|
constructor(fields?: StringFields<Nullable>, context?: ParseContextType);
|
|
106
113
|
isRef(): this is OasRef<'schema'>;
|
|
114
|
+
/** Whether the value is `readOnly`: sent by the API only, never in a request. */
|
|
115
|
+
isReadOnly(): boolean;
|
|
116
|
+
/** Whether the value is `writeOnly`: sent in a request only, never by the API. */
|
|
117
|
+
isWriteOnly(): boolean;
|
|
118
|
+
/**
|
|
119
|
+
* A copy of this schema with what `ref` adds at its site applied: its
|
|
120
|
+
* `nullable`, `readOnly`, `writeOnly` and the keywords next to it (`SiblingKeywords`) that
|
|
121
|
+
* this type takes, a sibling's value winning. A value that does not fit
|
|
122
|
+
* this type is left out (the parser reports it). For `OasRef.resolve()`.
|
|
123
|
+
* This schema does not change, and the copy shares its child schemas.
|
|
124
|
+
*/
|
|
125
|
+
clone(ref?: OasRef<'schema'>): OasString;
|
|
107
126
|
traverse(path: SchemaPath): OasSchema | OasRef<'schema'>;
|
|
108
127
|
resolve(): OasString<Nullable>;
|
|
109
128
|
resolveOnce(): OasString<Nullable>;
|
|
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.OasString = 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
|
class OasString extends OasBase_js_1.OasBase {
|
|
8
9
|
constructor(fields = {}, context) {
|
|
@@ -148,6 +149,17 @@ class OasString extends OasBase_js_1.OasBase {
|
|
|
148
149
|
writable: true,
|
|
149
150
|
value: void 0
|
|
150
151
|
});
|
|
152
|
+
/**
|
|
153
|
+
* The schema's `not`, kept as an `OasUnknown` under `client.json`
|
|
154
|
+
* `system.not: unknown`: the document says "not something", and core does
|
|
155
|
+
* not read what. `undefined` otherwise.
|
|
156
|
+
*/
|
|
157
|
+
Object.defineProperty(this, "not", {
|
|
158
|
+
enumerable: true,
|
|
159
|
+
configurable: true,
|
|
160
|
+
writable: true,
|
|
161
|
+
value: undefined
|
|
162
|
+
});
|
|
151
163
|
this.title = fields.title;
|
|
152
164
|
this.description = fields.description;
|
|
153
165
|
this.format = fields.format;
|
|
@@ -166,6 +178,41 @@ class OasString extends OasBase_js_1.OasBase {
|
|
|
166
178
|
isRef() {
|
|
167
179
|
return false;
|
|
168
180
|
}
|
|
181
|
+
/** Whether the value is `readOnly`: sent by the API only, never in a request. */
|
|
182
|
+
isReadOnly() {
|
|
183
|
+
return this.readOnly === true;
|
|
184
|
+
}
|
|
185
|
+
/** Whether the value is `writeOnly`: sent in a request only, never by the API. */
|
|
186
|
+
isWriteOnly() {
|
|
187
|
+
return this.writeOnly === true;
|
|
188
|
+
}
|
|
189
|
+
/**
|
|
190
|
+
* A copy of this schema with what `ref` adds at its site applied: its
|
|
191
|
+
* `nullable`, `readOnly`, `writeOnly` and the keywords next to it (`SiblingKeywords`) that
|
|
192
|
+
* this type takes, a sibling's value winning. A value that does not fit
|
|
193
|
+
* this type is left out (the parser reports it). For `OasRef.resolve()`.
|
|
194
|
+
* This schema does not change, and the copy shares its child schemas.
|
|
195
|
+
*/
|
|
196
|
+
clone(ref) {
|
|
197
|
+
const nullable = this.nullable || ref?.nullable || undefined;
|
|
198
|
+
const copy = new OasString({
|
|
199
|
+
...(0, siblings_js_1.toSiblingAnnotations)(this, ref),
|
|
200
|
+
example: (0, siblings_js_1.toSiblingValue)(ref?.example, siblings_js_1.isStringValue) ?? this.example,
|
|
201
|
+
format: ref?.format ?? this.format,
|
|
202
|
+
enums: (0, siblings_js_1.toSiblingEnums)(ref?.enums, siblings_js_1.isStringValue, nullable) ?? this.enums,
|
|
203
|
+
nullable,
|
|
204
|
+
maxLength: ref?.maxLength ?? this.maxLength,
|
|
205
|
+
minLength: ref?.minLength ?? this.minLength,
|
|
206
|
+
pattern: ref?.pattern ?? this.pattern,
|
|
207
|
+
default: (0, siblings_js_1.toSiblingValue)(ref?.default, siblings_js_1.isStringValue) ?? this.default,
|
|
208
|
+
readOnly: this.readOnly || ref?.readOnly || undefined,
|
|
209
|
+
writeOnly: this.writeOnly || ref?.writeOnly || undefined,
|
|
210
|
+
deprecated: ref?.deprecated ?? this.deprecated,
|
|
211
|
+
});
|
|
212
|
+
copy.stackTrail = this.stackTrail;
|
|
213
|
+
copy.not = this.not;
|
|
214
|
+
return copy;
|
|
215
|
+
}
|
|
169
216
|
traverse(path) {
|
|
170
217
|
return (0, traverseSchema_js_1.traverseSchema)(this, path);
|
|
171
218
|
}
|
|
@@ -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,40 @@ 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`.
|
|
220
|
+
*
|
|
221
|
+
* It reads the schemas only. A generator may refuse more: one that leaves
|
|
222
|
+
* out `readOnly` properties cannot discriminate on one.
|
|
223
|
+
*/
|
|
224
|
+
isDiscriminable(): boolean;
|
|
194
225
|
toJsonSchema(options: ToJsonSchemaOptions): OpenAPIV3.NonArraySchemaObject;
|
|
195
226
|
}
|
|
@@ -2,6 +2,7 @@
|
|
|
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");
|
|
6
7
|
/**
|
|
7
8
|
* Represents a union type schema in the OpenAPI Specification.
|
|
@@ -216,6 +217,17 @@ class OasUnion extends OasBase_js_1.OasBase {
|
|
|
216
217
|
writable: true,
|
|
217
218
|
value: void 0
|
|
218
219
|
});
|
|
220
|
+
/**
|
|
221
|
+
* The schema's `not`, kept as an `OasUnknown` under `client.json`
|
|
222
|
+
* `system.not: unknown`: the document says "not something", and core does
|
|
223
|
+
* not read what. `undefined` otherwise.
|
|
224
|
+
*/
|
|
225
|
+
Object.defineProperty(this, "not", {
|
|
226
|
+
enumerable: true,
|
|
227
|
+
configurable: true,
|
|
228
|
+
writable: true,
|
|
229
|
+
value: undefined
|
|
230
|
+
});
|
|
219
231
|
this.title = fields.title;
|
|
220
232
|
this.description = fields.description;
|
|
221
233
|
this.externalDocs = fields.externalDocs;
|
|
@@ -229,6 +241,36 @@ class OasUnion extends OasBase_js_1.OasBase {
|
|
|
229
241
|
isRef() {
|
|
230
242
|
return false;
|
|
231
243
|
}
|
|
244
|
+
/** Always `false`: this schema has no `readOnly`. */
|
|
245
|
+
isReadOnly() {
|
|
246
|
+
return false;
|
|
247
|
+
}
|
|
248
|
+
/** Always `false`: this schema has no `writeOnly`. */
|
|
249
|
+
isWriteOnly() {
|
|
250
|
+
return false;
|
|
251
|
+
}
|
|
252
|
+
/**
|
|
253
|
+
* A copy of this schema with what `ref` adds at its site applied: its
|
|
254
|
+
* `nullable` and the keywords next to it (`SiblingKeywords`) that
|
|
255
|
+
* this type takes, a sibling's value winning. A value that does not fit
|
|
256
|
+
* this type is left out (the parser reports it). For `OasRef.resolve()`.
|
|
257
|
+
* This schema does not change, and the copy shares its child schemas.
|
|
258
|
+
*/
|
|
259
|
+
clone(ref) {
|
|
260
|
+
const nullable = this.nullable || ref?.nullable || undefined;
|
|
261
|
+
const copy = new OasUnion({
|
|
262
|
+
...(0, siblings_js_1.toSiblingAnnotations)(this, ref),
|
|
263
|
+
example: ref?.example ?? this.example,
|
|
264
|
+
externalDocs: this.externalDocs,
|
|
265
|
+
nullable,
|
|
266
|
+
discriminator: this.discriminator,
|
|
267
|
+
members: this.members,
|
|
268
|
+
default: ref?.default ?? this.default,
|
|
269
|
+
});
|
|
270
|
+
copy.stackTrail = this.stackTrail;
|
|
271
|
+
copy.not = this.not;
|
|
272
|
+
return copy;
|
|
273
|
+
}
|
|
232
274
|
traverse(path) {
|
|
233
275
|
return (0, traverseSchema_js_1.traverseSchema)(this, path);
|
|
234
276
|
}
|
|
@@ -238,6 +280,35 @@ class OasUnion extends OasBase_js_1.OasBase {
|
|
|
238
280
|
resolveOnce() {
|
|
239
281
|
return this;
|
|
240
282
|
}
|
|
283
|
+
/**
|
|
284
|
+
* Whether the discriminator alone picks the member of a value: the union
|
|
285
|
+
* names a discriminator, and each member, followed through references, is
|
|
286
|
+
* an object that is not nullable, that requires the discriminator's
|
|
287
|
+
* property, and that allows only string literals for it. No value may
|
|
288
|
+
* belong to two members. A member that is a union, or anything other than
|
|
289
|
+
* an object, makes it `false`.
|
|
290
|
+
*
|
|
291
|
+
* It reads the schemas only. A generator may refuse more: one that leaves
|
|
292
|
+
* out `readOnly` properties cannot discriminate on one.
|
|
293
|
+
*/
|
|
294
|
+
isDiscriminable() {
|
|
295
|
+
const key = this.discriminator?.propertyName;
|
|
296
|
+
if (key === undefined) {
|
|
297
|
+
return false;
|
|
298
|
+
}
|
|
299
|
+
const seen = new Set();
|
|
300
|
+
return this.members.every(member => {
|
|
301
|
+
const values = toDiscriminatorValues(member, key);
|
|
302
|
+
return (values !== undefined &&
|
|
303
|
+
values.every(value => {
|
|
304
|
+
if (seen.has(value)) {
|
|
305
|
+
return false;
|
|
306
|
+
}
|
|
307
|
+
seen.add(value);
|
|
308
|
+
return true;
|
|
309
|
+
}));
|
|
310
|
+
});
|
|
311
|
+
}
|
|
241
312
|
toJsonSchema(options) {
|
|
242
313
|
return {
|
|
243
314
|
title: this.title,
|
|
@@ -250,3 +321,32 @@ class OasUnion extends OasBase_js_1.OasBase {
|
|
|
250
321
|
}
|
|
251
322
|
}
|
|
252
323
|
exports.OasUnion = OasUnion;
|
|
324
|
+
/**
|
|
325
|
+
* The values a member allows for the discriminator `key`, or `undefined`
|
|
326
|
+
* when the member is not an object, is nullable, or does not require `key`
|
|
327
|
+
* with string literals only.
|
|
328
|
+
*/
|
|
329
|
+
const toDiscriminatorValues = (member, key) => {
|
|
330
|
+
// `resolve()`, not `resolveOnce()`: the schema at this site, with the
|
|
331
|
+
// keywords next to the reference (`properties`, `required`) applied.
|
|
332
|
+
if (member.isRef()) {
|
|
333
|
+
return member.nullable ? undefined : toDiscriminatorValues(member.resolve(), key);
|
|
334
|
+
}
|
|
335
|
+
if (member.type !== 'object' || member.nullable) {
|
|
336
|
+
return undefined;
|
|
337
|
+
}
|
|
338
|
+
const property = member.properties?.[key];
|
|
339
|
+
return property === undefined || !member.required?.includes(key) ? undefined : toLiteralValues(property);
|
|
340
|
+
};
|
|
341
|
+
/** The string literals a schema allows, or `undefined` when it allows anything else too. */
|
|
342
|
+
const toLiteralValues = (schema) => {
|
|
343
|
+
if (schema.isRef()) {
|
|
344
|
+
return schema.nullable ? undefined : toLiteralValues(schema.resolve());
|
|
345
|
+
}
|
|
346
|
+
if (schema.type !== 'string' || schema.nullable || schema.enums === undefined) {
|
|
347
|
+
return undefined;
|
|
348
|
+
}
|
|
349
|
+
const enums = schema.enums;
|
|
350
|
+
const strings = enums.filter((value) => value !== null);
|
|
351
|
+
return strings.length > 0 && strings.length === enums.length ? strings : undefined;
|
|
352
|
+
};
|