@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
package/esm/oas/ref/Ref.js
CHANGED
|
@@ -9,11 +9,12 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
|
|
|
9
9
|
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
10
10
|
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
11
11
|
};
|
|
12
|
-
var _OasRef_instances,
|
|
12
|
+
var _OasRef_instances, _OasRef_document, _OasRef_resolution, _OasRef_toResolution, _OasRef_toSiteSchema, _OasRef_resolveOasOnce, _OasRef_resolveGqlOnce;
|
|
13
13
|
import "../../_dnt.polyfills.js";
|
|
14
14
|
import { traverseSchema } from '../schemaPath/traverseSchema.js';
|
|
15
15
|
import { toRefName } from '../../helpers/refFns.js';
|
|
16
16
|
import { OasBase } from '../../types/OasBase.js';
|
|
17
|
+
import { changesTarget, changesValues, hasSiblingKeywords, mergeSiblingKeywords, toSkippedSiblings } from '../schema/siblings.js';
|
|
17
18
|
const MAX_LOOKUPS = 10;
|
|
18
19
|
/**
|
|
19
20
|
* Converts a ref type to its plural components path.
|
|
@@ -133,10 +134,11 @@ export class OasRef extends OasBase {
|
|
|
133
134
|
* Creates a new OAS reference instance.
|
|
134
135
|
*
|
|
135
136
|
* @param fields - Reference field data including refType and $ref
|
|
136
|
-
* @param
|
|
137
|
-
*
|
|
138
|
-
*
|
|
139
|
-
* schema refs)
|
|
137
|
+
* @param context - The parse context, or what `clone` passes in its place:
|
|
138
|
+
* the discriminated document containing the referenced component (for
|
|
139
|
+
* OAS, refs resolve through the document's components; for GQL, through
|
|
140
|
+
* the document's registry, as GQL only ever creates schema refs) and the
|
|
141
|
+
* current trail.
|
|
140
142
|
*/
|
|
141
143
|
constructor(fields, context) {
|
|
142
144
|
super(context);
|
|
@@ -155,9 +157,257 @@ export class OasRef extends OasBase {
|
|
|
155
157
|
writable: true,
|
|
156
158
|
value: 'ref'
|
|
157
159
|
});
|
|
158
|
-
|
|
160
|
+
/** The kind of component the reference points to. */
|
|
161
|
+
Object.defineProperty(this, "refType", {
|
|
162
|
+
enumerable: true,
|
|
163
|
+
configurable: true,
|
|
164
|
+
writable: true,
|
|
165
|
+
value: void 0
|
|
166
|
+
});
|
|
167
|
+
/** The JSON Reference: `#/components/<bucket>/<name>`. */
|
|
168
|
+
Object.defineProperty(this, "$ref", {
|
|
169
|
+
enumerable: true,
|
|
170
|
+
configurable: true,
|
|
171
|
+
writable: true,
|
|
172
|
+
value: void 0
|
|
173
|
+
});
|
|
174
|
+
/**
|
|
175
|
+
* Use-site nullability (see {@link SiblingKeywords.nullable}). Assigned
|
|
176
|
+
* even when `undefined`, so `'nullable' in ref` is always true and the
|
|
177
|
+
* value-function nullable read picks it up uniformly.
|
|
178
|
+
*/
|
|
179
|
+
Object.defineProperty(this, "nullable", {
|
|
180
|
+
enumerable: true,
|
|
181
|
+
configurable: true,
|
|
182
|
+
writable: true,
|
|
183
|
+
value: void 0
|
|
184
|
+
});
|
|
185
|
+
/** Use-site `readOnly` (see {@link SiblingKeywords.readOnly}). */
|
|
186
|
+
Object.defineProperty(this, "readOnly", {
|
|
187
|
+
enumerable: true,
|
|
188
|
+
configurable: true,
|
|
189
|
+
writable: true,
|
|
190
|
+
value: void 0
|
|
191
|
+
});
|
|
192
|
+
/** Use-site `writeOnly` (see {@link SiblingKeywords.writeOnly}). */
|
|
193
|
+
Object.defineProperty(this, "writeOnly", {
|
|
194
|
+
enumerable: true,
|
|
195
|
+
configurable: true,
|
|
196
|
+
writable: true,
|
|
197
|
+
value: void 0
|
|
198
|
+
});
|
|
199
|
+
/** The `type` written next to this reference (see {@link SiblingKeywords._type}). */
|
|
200
|
+
Object.defineProperty(this, "_type", {
|
|
201
|
+
enumerable: true,
|
|
202
|
+
configurable: true,
|
|
203
|
+
writable: true,
|
|
204
|
+
value: void 0
|
|
205
|
+
});
|
|
206
|
+
/** The `title` next to this reference (see {@link SiblingKeywords}). */
|
|
207
|
+
Object.defineProperty(this, "title", {
|
|
208
|
+
enumerable: true,
|
|
209
|
+
configurable: true,
|
|
210
|
+
writable: true,
|
|
211
|
+
value: void 0
|
|
212
|
+
});
|
|
213
|
+
/** The `description` next to this reference (see {@link SiblingKeywords}). */
|
|
214
|
+
Object.defineProperty(this, "description", {
|
|
215
|
+
enumerable: true,
|
|
216
|
+
configurable: true,
|
|
217
|
+
writable: true,
|
|
218
|
+
value: void 0
|
|
219
|
+
});
|
|
220
|
+
/** The `deprecated` next to this reference (see {@link SiblingKeywords}). */
|
|
221
|
+
Object.defineProperty(this, "deprecated", {
|
|
222
|
+
enumerable: true,
|
|
223
|
+
configurable: true,
|
|
224
|
+
writable: true,
|
|
225
|
+
value: void 0
|
|
226
|
+
});
|
|
227
|
+
/** The `example` next to this reference (see {@link SiblingKeywords}). */
|
|
228
|
+
Object.defineProperty(this, "example", {
|
|
229
|
+
enumerable: true,
|
|
230
|
+
configurable: true,
|
|
231
|
+
writable: true,
|
|
232
|
+
value: void 0
|
|
233
|
+
});
|
|
234
|
+
/** The `default` next to this reference (see {@link SiblingKeywords}). */
|
|
235
|
+
Object.defineProperty(this, "default", {
|
|
236
|
+
enumerable: true,
|
|
237
|
+
configurable: true,
|
|
238
|
+
writable: true,
|
|
239
|
+
value: void 0
|
|
240
|
+
});
|
|
241
|
+
/** The `enum` next to this reference (see {@link SiblingKeywords}). */
|
|
242
|
+
Object.defineProperty(this, "enums", {
|
|
243
|
+
enumerable: true,
|
|
244
|
+
configurable: true,
|
|
245
|
+
writable: true,
|
|
246
|
+
value: void 0
|
|
247
|
+
});
|
|
248
|
+
/** The extensions (`x-*`) next to this reference (see {@link SiblingKeywords}). */
|
|
249
|
+
Object.defineProperty(this, "extensionFields", {
|
|
250
|
+
enumerable: true,
|
|
251
|
+
configurable: true,
|
|
252
|
+
writable: true,
|
|
253
|
+
value: void 0
|
|
254
|
+
});
|
|
255
|
+
/** The `format` next to this reference (see {@link SiblingKeywords}). */
|
|
256
|
+
Object.defineProperty(this, "format", {
|
|
257
|
+
enumerable: true,
|
|
258
|
+
configurable: true,
|
|
259
|
+
writable: true,
|
|
260
|
+
value: void 0
|
|
261
|
+
});
|
|
262
|
+
/** The `minLength` next to this reference (see {@link SiblingKeywords}). */
|
|
263
|
+
Object.defineProperty(this, "minLength", {
|
|
264
|
+
enumerable: true,
|
|
265
|
+
configurable: true,
|
|
266
|
+
writable: true,
|
|
267
|
+
value: void 0
|
|
268
|
+
});
|
|
269
|
+
/** The `maxLength` next to this reference (see {@link SiblingKeywords}). */
|
|
270
|
+
Object.defineProperty(this, "maxLength", {
|
|
271
|
+
enumerable: true,
|
|
272
|
+
configurable: true,
|
|
273
|
+
writable: true,
|
|
274
|
+
value: void 0
|
|
275
|
+
});
|
|
276
|
+
/** The `pattern` next to this reference (see {@link SiblingKeywords}). */
|
|
277
|
+
Object.defineProperty(this, "pattern", {
|
|
278
|
+
enumerable: true,
|
|
279
|
+
configurable: true,
|
|
280
|
+
writable: true,
|
|
281
|
+
value: void 0
|
|
282
|
+
});
|
|
283
|
+
/** The `multipleOf` next to this reference (see {@link SiblingKeywords}). */
|
|
284
|
+
Object.defineProperty(this, "multipleOf", {
|
|
285
|
+
enumerable: true,
|
|
286
|
+
configurable: true,
|
|
287
|
+
writable: true,
|
|
288
|
+
value: void 0
|
|
289
|
+
});
|
|
290
|
+
/** The `minimum` next to this reference (see {@link SiblingKeywords}). */
|
|
291
|
+
Object.defineProperty(this, "minimum", {
|
|
292
|
+
enumerable: true,
|
|
293
|
+
configurable: true,
|
|
294
|
+
writable: true,
|
|
295
|
+
value: void 0
|
|
296
|
+
});
|
|
297
|
+
/** The `maximum` next to this reference (see {@link SiblingKeywords}). */
|
|
298
|
+
Object.defineProperty(this, "maximum", {
|
|
299
|
+
enumerable: true,
|
|
300
|
+
configurable: true,
|
|
301
|
+
writable: true,
|
|
302
|
+
value: void 0
|
|
303
|
+
});
|
|
304
|
+
/** The `exclusiveMinimum` next to this reference (see {@link SiblingKeywords}). */
|
|
305
|
+
Object.defineProperty(this, "exclusiveMinimum", {
|
|
306
|
+
enumerable: true,
|
|
307
|
+
configurable: true,
|
|
308
|
+
writable: true,
|
|
309
|
+
value: void 0
|
|
310
|
+
});
|
|
311
|
+
/** The `exclusiveMaximum` next to this reference (see {@link SiblingKeywords}). */
|
|
312
|
+
Object.defineProperty(this, "exclusiveMaximum", {
|
|
313
|
+
enumerable: true,
|
|
314
|
+
configurable: true,
|
|
315
|
+
writable: true,
|
|
316
|
+
value: void 0
|
|
317
|
+
});
|
|
318
|
+
/** The `minItems` next to this reference (see {@link SiblingKeywords}). */
|
|
319
|
+
Object.defineProperty(this, "minItems", {
|
|
320
|
+
enumerable: true,
|
|
321
|
+
configurable: true,
|
|
322
|
+
writable: true,
|
|
323
|
+
value: void 0
|
|
324
|
+
});
|
|
325
|
+
/** The `maxItems` next to this reference (see {@link SiblingKeywords}). */
|
|
326
|
+
Object.defineProperty(this, "maxItems", {
|
|
327
|
+
enumerable: true,
|
|
328
|
+
configurable: true,
|
|
329
|
+
writable: true,
|
|
330
|
+
value: void 0
|
|
331
|
+
});
|
|
332
|
+
/** The `uniqueItems` next to this reference (see {@link SiblingKeywords}). */
|
|
333
|
+
Object.defineProperty(this, "uniqueItems", {
|
|
334
|
+
enumerable: true,
|
|
335
|
+
configurable: true,
|
|
336
|
+
writable: true,
|
|
337
|
+
value: void 0
|
|
338
|
+
});
|
|
339
|
+
/** The `properties` next to this reference (see {@link SiblingKeywords}). */
|
|
340
|
+
Object.defineProperty(this, "properties", {
|
|
341
|
+
enumerable: true,
|
|
342
|
+
configurable: true,
|
|
343
|
+
writable: true,
|
|
344
|
+
value: void 0
|
|
345
|
+
});
|
|
346
|
+
/** The `required` next to this reference (see {@link SiblingKeywords}). */
|
|
347
|
+
Object.defineProperty(this, "required", {
|
|
348
|
+
enumerable: true,
|
|
349
|
+
configurable: true,
|
|
350
|
+
writable: true,
|
|
351
|
+
value: void 0
|
|
352
|
+
});
|
|
353
|
+
/** The `additionalProperties` next to this reference (see {@link SiblingKeywords}). */
|
|
354
|
+
Object.defineProperty(this, "additionalProperties", {
|
|
355
|
+
enumerable: true,
|
|
356
|
+
configurable: true,
|
|
357
|
+
writable: true,
|
|
358
|
+
value: void 0
|
|
359
|
+
});
|
|
360
|
+
/** The `minProperties` next to this reference (see {@link SiblingKeywords}). */
|
|
361
|
+
Object.defineProperty(this, "minProperties", {
|
|
362
|
+
enumerable: true,
|
|
363
|
+
configurable: true,
|
|
364
|
+
writable: true,
|
|
365
|
+
value: void 0
|
|
366
|
+
});
|
|
367
|
+
/** The `maxProperties` next to this reference (see {@link SiblingKeywords}). */
|
|
368
|
+
Object.defineProperty(this, "maxProperties", {
|
|
369
|
+
enumerable: true,
|
|
370
|
+
configurable: true,
|
|
371
|
+
writable: true,
|
|
372
|
+
value: void 0
|
|
373
|
+
});
|
|
159
374
|
_OasRef_document.set(this, void 0);
|
|
160
|
-
|
|
375
|
+
/**
|
|
376
|
+
* What {@link resolve} found, kept for every later call: the target, and
|
|
377
|
+
* the result (the target, or the copy with this reference's keywords). The
|
|
378
|
+
* document does not change after parse, so neither does the answer.
|
|
379
|
+
*/
|
|
380
|
+
_OasRef_resolution.set(this, void 0);
|
|
381
|
+
this.refType = fields.refType;
|
|
382
|
+
this.$ref = fields.$ref;
|
|
383
|
+
this.nullable = fields.nullable;
|
|
384
|
+
this.readOnly = fields.readOnly;
|
|
385
|
+
this.writeOnly = fields.writeOnly;
|
|
386
|
+
this._type = fields._type;
|
|
387
|
+
this.title = fields.title;
|
|
388
|
+
this.description = fields.description;
|
|
389
|
+
this.deprecated = fields.deprecated;
|
|
390
|
+
this.example = fields.example;
|
|
391
|
+
this.default = fields.default;
|
|
392
|
+
this.enums = fields.enums;
|
|
393
|
+
this.extensionFields = fields.extensionFields;
|
|
394
|
+
this.format = fields.format;
|
|
395
|
+
this.minLength = fields.minLength;
|
|
396
|
+
this.maxLength = fields.maxLength;
|
|
397
|
+
this.pattern = fields.pattern;
|
|
398
|
+
this.multipleOf = fields.multipleOf;
|
|
399
|
+
this.minimum = fields.minimum;
|
|
400
|
+
this.maximum = fields.maximum;
|
|
401
|
+
this.exclusiveMinimum = fields.exclusiveMinimum;
|
|
402
|
+
this.exclusiveMaximum = fields.exclusiveMaximum;
|
|
403
|
+
this.minItems = fields.minItems;
|
|
404
|
+
this.maxItems = fields.maxItems;
|
|
405
|
+
this.uniqueItems = fields.uniqueItems;
|
|
406
|
+
this.properties = fields.properties;
|
|
407
|
+
this.required = fields.required;
|
|
408
|
+
this.additionalProperties = fields.additionalProperties;
|
|
409
|
+
this.minProperties = fields.minProperties;
|
|
410
|
+
this.maxProperties = fields.maxProperties;
|
|
161
411
|
__classPrivateFieldSet(this, _OasRef_document, context.parsedDocument, "f");
|
|
162
412
|
}
|
|
163
413
|
/**
|
|
@@ -172,18 +422,22 @@ export class OasRef extends OasBase {
|
|
|
172
422
|
* Recursively resolves this reference to its final target component.
|
|
173
423
|
*
|
|
174
424
|
* Follows reference chains until reaching a non-reference component,
|
|
175
|
-
* with protection against infinite loops.
|
|
425
|
+
* with protection against infinite loops. A schema reference returns the
|
|
426
|
+
* schema at this site: when the keywords next to it, or next to a
|
|
427
|
+
* reference on the chain ({@link SiblingKeywords}), change the target, a
|
|
428
|
+
* copy of the target with them applied. When they change nothing, the
|
|
429
|
+
* shared target itself. `resolveOnce()` applies no siblings.
|
|
430
|
+
*
|
|
431
|
+
* The result is shared, so do not modify it: the shared target is the
|
|
432
|
+
* model every reference to it sees, and a copy is built once, kept on
|
|
433
|
+
* this reference, and returned on every call.
|
|
176
434
|
*
|
|
177
435
|
* @param lookupsPerformed - Internal counter to prevent infinite recursion
|
|
178
436
|
* @returns The resolved component
|
|
179
437
|
* @throws Error if maximum lookup depth is exceeded
|
|
180
438
|
*/
|
|
181
439
|
resolve(lookupsPerformed = 0) {
|
|
182
|
-
|
|
183
|
-
throw new Error('Max lookups reached');
|
|
184
|
-
}
|
|
185
|
-
const resolved = this.resolveOnce();
|
|
186
|
-
return resolved.isRef() ? resolved.resolve(lookupsPerformed + 1) : resolved;
|
|
440
|
+
return __classPrivateFieldGet(this, _OasRef_instances, "m", _OasRef_toResolution).call(this, lookupsPerformed).resolved;
|
|
187
441
|
}
|
|
188
442
|
/**
|
|
189
443
|
* Resolves this reference one level. Dispatches on the document's
|
|
@@ -198,7 +452,7 @@ export class OasRef extends OasBase {
|
|
|
198
452
|
? __classPrivateFieldGet(this, _OasRef_instances, "m", _OasRef_resolveOasOnce).call(this, __classPrivateFieldGet(this, _OasRef_document, "f").value, refName)
|
|
199
453
|
: __classPrivateFieldGet(this, _OasRef_instances, "m", _OasRef_resolveGqlOnce).call(this, __classPrivateFieldGet(this, _OasRef_document, "f").value, refName);
|
|
200
454
|
if (!resolved) {
|
|
201
|
-
throw new Error(`Ref "${
|
|
455
|
+
throw new Error(`Ref "${this.$ref}" not found`);
|
|
202
456
|
}
|
|
203
457
|
if (resolved.isRef()) {
|
|
204
458
|
if (resolved.refType !== this.refType) {
|
|
@@ -213,7 +467,7 @@ export class OasRef extends OasBase {
|
|
|
213
467
|
return resolved;
|
|
214
468
|
}
|
|
215
469
|
toRefName() {
|
|
216
|
-
return toRefName(
|
|
470
|
+
return toRefName(this.$ref);
|
|
217
471
|
}
|
|
218
472
|
/**
|
|
219
473
|
* Narrows this reference to a schema reference.
|
|
@@ -242,19 +496,96 @@ export class OasRef extends OasBase {
|
|
|
242
496
|
}
|
|
243
497
|
return traverseSchema(this, path);
|
|
244
498
|
}
|
|
245
|
-
|
|
246
|
-
|
|
499
|
+
/**
|
|
500
|
+
* Whether this reference adds anything at its site: a use-site flag
|
|
501
|
+
* (`nullable`, `readOnly`, `writeOnly`) or another keyword next to it (see
|
|
502
|
+
* {@link RefFields}). {@link resolve} then returns a copy of the target with
|
|
503
|
+
* them applied, not the shared target.
|
|
504
|
+
*/
|
|
505
|
+
hasSiblings() {
|
|
506
|
+
return hasSiblingKeywords(this);
|
|
507
|
+
}
|
|
508
|
+
/**
|
|
509
|
+
* A copy of this reference with what `ref` adds at its site merged in: its
|
|
510
|
+
* flags, and its keywords over this reference's own
|
|
511
|
+
* ({@link mergeSiblingKeywords}). It points at the same target. Each schema
|
|
512
|
+
* class's `clone` does the same for a schema, so one step along a chain of
|
|
513
|
+
* references can carry a site's keywords (`resolveSchemaRefOnce`). This
|
|
514
|
+
* reference does not change.
|
|
515
|
+
*/
|
|
516
|
+
clone(ref) {
|
|
517
|
+
const copy = new OasRef({ refType: this.refType, $ref: this.$ref, ...mergeSiblingKeywords(this, ref) }, { parsedDocument: __classPrivateFieldGet(this, _OasRef_document, "f"), currentStackTrail: undefined });
|
|
518
|
+
copy.stackTrail = this.stackTrail;
|
|
519
|
+
return copy;
|
|
520
|
+
}
|
|
521
|
+
/**
|
|
522
|
+
* Whether the keywords next to this reference change which values it
|
|
523
|
+
* accepts (`minLength` next to a string, `properties` next to an object),
|
|
524
|
+
* not only how it is described (`description`, `deprecated`, `x-*`). No
|
|
525
|
+
* shared model accepts the same values as such a site, so a generator
|
|
526
|
+
* applies these keywords where it renders the reference by name. See
|
|
527
|
+
* {@link changesValues}.
|
|
528
|
+
*/
|
|
529
|
+
hasValueSiblings() {
|
|
530
|
+
if (!this.hasSiblings()) {
|
|
531
|
+
return false;
|
|
532
|
+
}
|
|
533
|
+
const { target, resolved } = __classPrivateFieldGet(this, _OasRef_instances, "m", _OasRef_toResolution).call(this, 0);
|
|
534
|
+
// Widened from the generic ResolvedRef<T>, so `oasType` narrows them.
|
|
535
|
+
const original = target;
|
|
536
|
+
const applied = resolved;
|
|
537
|
+
return (applied !== original &&
|
|
538
|
+
applied.oasType === 'schema' &&
|
|
539
|
+
original.oasType === 'schema' &&
|
|
540
|
+
changesValues(applied, original, this));
|
|
541
|
+
}
|
|
542
|
+
/**
|
|
543
|
+
* The keywords next to this reference that {@link resolve} leaves out, by
|
|
544
|
+
* their names in the document: ones the target's type does not take
|
|
545
|
+
* (`minLength` next to an array), a `type` that disagrees, and values that
|
|
546
|
+
* do not fit. The parser cannot tell them while the reference is lazy, so a
|
|
547
|
+
* generator logs them when it renders the site. See {@link toSkippedSiblings}.
|
|
548
|
+
*/
|
|
549
|
+
toSkippedSiblings() {
|
|
550
|
+
if (!this.hasSiblings()) {
|
|
551
|
+
return [];
|
|
552
|
+
}
|
|
553
|
+
const component = this.resolve();
|
|
554
|
+
return component.oasType === 'schema' ? toSkippedSiblings(component, this, component.nullable) : [];
|
|
247
555
|
}
|
|
248
|
-
|
|
249
|
-
|
|
556
|
+
/**
|
|
557
|
+
* Whether the value is `readOnly` at this site, as Forge reads it: on this
|
|
558
|
+
* reference (`{ allOf: [{ $ref }], readOnly: true }`), or on what it points
|
|
559
|
+
* to, through any chain of references. A `readOnly: false` does not undo
|
|
560
|
+
* another's `true`. `false` for a reference to anything but a schema.
|
|
561
|
+
*
|
|
562
|
+
* @param lookupsPerformed - Internal counter that stops a chain of references with no schema
|
|
563
|
+
*/
|
|
564
|
+
isReadOnly(lookupsPerformed = 0) {
|
|
565
|
+
if (this.readOnly === true) {
|
|
566
|
+
return true;
|
|
567
|
+
}
|
|
568
|
+
if (lookupsPerformed >= MAX_LOOKUPS) {
|
|
569
|
+
return false;
|
|
570
|
+
}
|
|
571
|
+
const resolved = this.resolveOnce();
|
|
572
|
+
return resolved.isRef() ? resolved.isReadOnly(lookupsPerformed + 1) : resolved.isReadOnly();
|
|
250
573
|
}
|
|
251
574
|
/**
|
|
252
|
-
*
|
|
253
|
-
*
|
|
254
|
-
*
|
|
575
|
+
* Whether the value is `writeOnly` at this site: on this reference, or on
|
|
576
|
+
* what it points to, as {@link isReadOnly} reads `readOnly`.
|
|
577
|
+
*
|
|
578
|
+
* @param lookupsPerformed - Internal counter that stops a chain of references with no schema
|
|
255
579
|
*/
|
|
256
|
-
|
|
257
|
-
|
|
580
|
+
isWriteOnly(lookupsPerformed = 0) {
|
|
581
|
+
if (this.writeOnly === true) {
|
|
582
|
+
return true;
|
|
583
|
+
}
|
|
584
|
+
if (lookupsPerformed >= MAX_LOOKUPS) {
|
|
585
|
+
return false;
|
|
586
|
+
}
|
|
587
|
+
const resolved = this.resolveOnce();
|
|
588
|
+
return resolved.isRef() ? resolved.isWriteOnly(lookupsPerformed + 1) : resolved.isWriteOnly();
|
|
258
589
|
}
|
|
259
590
|
/**
|
|
260
591
|
* Returns the discriminated parsed document this ref resolves
|
|
@@ -265,6 +596,12 @@ export class OasRef extends OasBase {
|
|
|
265
596
|
get document() {
|
|
266
597
|
return __classPrivateFieldGet(this, _OasRef_document, "f");
|
|
267
598
|
}
|
|
599
|
+
/**
|
|
600
|
+
* The reference as JSON Schema. With `resolve`, the schema at this site,
|
|
601
|
+
* with the keywords next to the reference applied. Without it, only
|
|
602
|
+
* `{ $ref }`: the keywords next to the reference are not written yet
|
|
603
|
+
* (skmtc/skmtc#338).
|
|
604
|
+
*/
|
|
268
605
|
toJsonSchema({ resolve }) {
|
|
269
606
|
if (resolve) {
|
|
270
607
|
const resolved = this.resolve().toJsonSchema({ resolve });
|
|
@@ -275,13 +612,38 @@ export class OasRef extends OasBase {
|
|
|
275
612
|
};
|
|
276
613
|
return ref;
|
|
277
614
|
}
|
|
615
|
+
/** `{ $ref }` only, as {@link toJsonSchema} without `resolve` (skmtc/skmtc#338). */
|
|
278
616
|
toJSON() {
|
|
279
617
|
return {
|
|
280
618
|
$ref: `#/components/${refTypeToPluralPath(this.refType)}/${this.toRefName()}`
|
|
281
619
|
};
|
|
282
620
|
}
|
|
283
621
|
}
|
|
284
|
-
|
|
622
|
+
_OasRef_document = new WeakMap(), _OasRef_resolution = new WeakMap(), _OasRef_instances = new WeakSet(), _OasRef_toResolution = function _OasRef_toResolution(lookupsPerformed) {
|
|
623
|
+
if (__classPrivateFieldGet(this, _OasRef_resolution, "f") !== undefined) {
|
|
624
|
+
return __classPrivateFieldGet(this, _OasRef_resolution, "f");
|
|
625
|
+
}
|
|
626
|
+
if (lookupsPerformed >= MAX_LOOKUPS) {
|
|
627
|
+
throw new Error('Max lookups reached');
|
|
628
|
+
}
|
|
629
|
+
const resolved = this.resolveOnce();
|
|
630
|
+
const target = resolved.isRef() ? resolved.resolve(lookupsPerformed + 1) : resolved;
|
|
631
|
+
const resolution = { target, resolved: __classPrivateFieldGet(this, _OasRef_instances, "m", _OasRef_toSiteSchema).call(this, target) };
|
|
632
|
+
__classPrivateFieldSet(this, _OasRef_resolution, resolution, "f");
|
|
633
|
+
return resolution;
|
|
634
|
+
}, _OasRef_toSiteSchema = function _OasRef_toSiteSchema(target) {
|
|
635
|
+
// Widened from the generic ResolvedRef<T>, so `oasType` narrows it.
|
|
636
|
+
const component = target;
|
|
637
|
+
// `oasType` narrows the target and `isSchemaRef()` this reference;
|
|
638
|
+
// resolveOnce() has checked that the two agree.
|
|
639
|
+
if (!this.hasSiblings() || component.oasType !== 'schema' || !this.isSchemaRef()) {
|
|
640
|
+
return target;
|
|
641
|
+
}
|
|
642
|
+
const copy = component.clone(this);
|
|
643
|
+
// A schema's copy is a schema of the same class. TypeScript cannot relate
|
|
644
|
+
// OasSchema to ResolvedRef<T> for a generic T, as in resolveOnce().
|
|
645
|
+
return changesTarget(copy, component, this) ? copy : target;
|
|
646
|
+
}, _OasRef_resolveOasOnce = function _OasRef_resolveOasOnce(document, refName) {
|
|
285
647
|
const c = document.components;
|
|
286
648
|
const refType = this.refType;
|
|
287
649
|
switch (refType) {
|
|
@@ -285,6 +285,10 @@ export declare class OasRequestBody extends OasBase {
|
|
|
285
285
|
extensionFields: Record<string, unknown> | undefined;
|
|
286
286
|
constructor(fields: RequestBodyFields, context?: ParseContextType);
|
|
287
287
|
isRef(): this is OasRef<'requestBody'>;
|
|
288
|
+
/** Always `false`: `readOnly` is a schema keyword. */
|
|
289
|
+
isReadOnly(): boolean;
|
|
290
|
+
/** Always `false`: `writeOnly` is a schema keyword. */
|
|
291
|
+
isWriteOnly(): boolean;
|
|
288
292
|
resolve(): OasRequestBody;
|
|
289
293
|
resolveOnce(): OasRequestBody;
|
|
290
294
|
/**
|
|
@@ -300,6 +300,14 @@ export class OasRequestBody extends OasBase {
|
|
|
300
300
|
isRef() {
|
|
301
301
|
return false;
|
|
302
302
|
}
|
|
303
|
+
/** Always `false`: `readOnly` is a schema keyword. */
|
|
304
|
+
isReadOnly() {
|
|
305
|
+
return false;
|
|
306
|
+
}
|
|
307
|
+
/** Always `false`: `writeOnly` is a schema keyword. */
|
|
308
|
+
isWriteOnly() {
|
|
309
|
+
return false;
|
|
310
|
+
}
|
|
303
311
|
resolve() {
|
|
304
312
|
return this;
|
|
305
313
|
}
|
|
@@ -219,6 +219,10 @@ export declare class OasResponse extends OasBase {
|
|
|
219
219
|
extensionFields: Record<string, unknown> | undefined;
|
|
220
220
|
constructor(fields: ResponseFields, context?: ParseContextType);
|
|
221
221
|
isRef(): this is OasRef<'response'>;
|
|
222
|
+
/** Always `false`: `readOnly` is a schema keyword. */
|
|
223
|
+
isReadOnly(): boolean;
|
|
224
|
+
/** Always `false`: `writeOnly` is a schema keyword. */
|
|
225
|
+
isWriteOnly(): boolean;
|
|
222
226
|
resolve(): OasResponse;
|
|
223
227
|
resolveOnce(): OasResponse;
|
|
224
228
|
/**
|
|
@@ -240,6 +240,14 @@ export class OasResponse extends OasBase {
|
|
|
240
240
|
isRef() {
|
|
241
241
|
return false;
|
|
242
242
|
}
|
|
243
|
+
/** Always `false`: `readOnly` is a schema keyword. */
|
|
244
|
+
isReadOnly() {
|
|
245
|
+
return false;
|
|
246
|
+
}
|
|
247
|
+
/** Always `false`: `writeOnly` is a schema keyword. */
|
|
248
|
+
isWriteOnly() {
|
|
249
|
+
return false;
|
|
250
|
+
}
|
|
243
251
|
resolve() {
|
|
244
252
|
return this;
|
|
245
253
|
}
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
import type { OasSchema } from './Schema.js';
|
|
2
|
+
import type { OasRef } from '../ref/Ref.js';
|
|
3
|
+
/**
|
|
4
|
+
* The keywords next to a reference in a one-member `allOf`
|
|
5
|
+
* (`{ allOf: [{ $ref }], minLength: 3, description: '…' }`), the use-site
|
|
6
|
+
* flags `nullable`, `readOnly` and `writeOnly` among them: the fields a
|
|
7
|
+
* reference adds at its site (`RefFields`).
|
|
8
|
+
*
|
|
9
|
+
* The parser reads them without knowing the target's type: the reference
|
|
10
|
+
* stays lazy. Each schema class's `clone(ref)` takes the keywords its type
|
|
11
|
+
* has ({@link SIBLINGS_BY_TYPE}). A value whose type depends on the target
|
|
12
|
+
* (`example`, `default`, `enums`, `format`) is kept as written, and `clone`
|
|
13
|
+
* takes it only when it fits. {@link toSkippedSiblings} names the keywords
|
|
14
|
+
* `clone` leaves out, for a generator to log.
|
|
15
|
+
*/
|
|
16
|
+
export type SiblingKeywords = {
|
|
17
|
+
/**
|
|
18
|
+
* Use-site nullability. A `$ref` is a per-reference node: the same
|
|
19
|
+
* refName may be referenced nullable at one site and non-nullable at
|
|
20
|
+
* another, so nullability rides the reference, not the shared referent.
|
|
21
|
+
* Set by the single-member `oneOf`/`anyOf` collapse for the 3.1
|
|
22
|
+
* `oneOf:[{$ref},{type:null}]` idiom, and next to a one-member `allOf`.
|
|
23
|
+
* Generators read it off the reference (`'nullable' in schema ?
|
|
24
|
+
* schema.nullable`) to render `Foo | null`, while `ModelDriver` builds the
|
|
25
|
+
* un-nullable shared model from the refName.
|
|
26
|
+
*/
|
|
27
|
+
nullable?: boolean;
|
|
28
|
+
/**
|
|
29
|
+
* Use-site `readOnly`: set where a property marks a reference read-only,
|
|
30
|
+
* `{ allOf: [{ $ref }], readOnly: true }` (the 3.0 idiom, as keywords next
|
|
31
|
+
* to a bare `$ref` are ignored there). Like `nullable`, it rides the
|
|
32
|
+
* reference: the shared model is not read-only everywhere. Read it through
|
|
33
|
+
* `isReadOnly`, which also looks at what the reference points to.
|
|
34
|
+
*/
|
|
35
|
+
readOnly?: boolean;
|
|
36
|
+
/** Use-site `writeOnly`, as {@link readOnly}. */
|
|
37
|
+
writeOnly?: boolean;
|
|
38
|
+
/**
|
|
39
|
+
* The `type` written next to the reference, merged in from the schema that
|
|
40
|
+
* holds the one-member `allOf`. It must agree with the target's; the copy
|
|
41
|
+
* always has the target's type. Not `type`, which on an `OasRef` is `'ref'`.
|
|
42
|
+
*/
|
|
43
|
+
_type?: unknown;
|
|
44
|
+
title?: string;
|
|
45
|
+
description?: string;
|
|
46
|
+
deprecated?: boolean;
|
|
47
|
+
example?: unknown;
|
|
48
|
+
default?: unknown;
|
|
49
|
+
enums?: unknown[];
|
|
50
|
+
extensionFields?: Record<string, unknown>;
|
|
51
|
+
format?: string;
|
|
52
|
+
minLength?: number;
|
|
53
|
+
maxLength?: number;
|
|
54
|
+
pattern?: string;
|
|
55
|
+
multipleOf?: number;
|
|
56
|
+
minimum?: number;
|
|
57
|
+
maximum?: number;
|
|
58
|
+
exclusiveMinimum?: boolean;
|
|
59
|
+
exclusiveMaximum?: boolean;
|
|
60
|
+
minItems?: number;
|
|
61
|
+
maxItems?: number;
|
|
62
|
+
uniqueItems?: boolean;
|
|
63
|
+
properties?: Record<string, OasSchema | OasRef<'schema'>>;
|
|
64
|
+
required?: string[];
|
|
65
|
+
additionalProperties?: boolean | OasSchema | OasRef<'schema'>;
|
|
66
|
+
minProperties?: number;
|
|
67
|
+
maxProperties?: number;
|
|
68
|
+
};
|
|
69
|
+
/** A keyword `clone` can apply. `_type` only has to agree. */
|
|
70
|
+
export type SiblingKeyword = Exclude<keyof SiblingKeywords, '_type'>;
|
|
71
|
+
/** The keywords each schema class's `clone` takes: the fields its type has. */
|
|
72
|
+
export declare const SIBLINGS_BY_TYPE: Record<OasSchema['type'], SiblingKeyword[]>;
|
|
73
|
+
/**
|
|
74
|
+
* The keywords of `over` merged over those of `base`, for a reference copied
|
|
75
|
+
* with what another site adds (`OasRef.clone`): a flag set on either stays
|
|
76
|
+
* set, a keyword `over` sets wins, extension fields and `properties` merge,
|
|
77
|
+
* and `required` names add up, as each schema class's `clone` merges them
|
|
78
|
+
* into a schema.
|
|
79
|
+
*/
|
|
80
|
+
export declare const mergeSiblingKeywords: (base: SiblingKeywords, over: SiblingKeywords | undefined) => SiblingKeywords;
|
|
81
|
+
/** Whether `siblings` holds any keyword. */
|
|
82
|
+
export declare const hasSiblingKeywords: (siblings: SiblingKeywords) => boolean;
|
|
83
|
+
/** Whether the keywords next to a reference change `target` at that site. The engine behind `OasRef.resolve`. */
|
|
84
|
+
export declare const changesTarget: (copy: OasSchema, target: OasSchema, siblings: SiblingKeywords) => boolean;
|
|
85
|
+
/**
|
|
86
|
+
* Whether the keywords next to a reference change which values `target`
|
|
87
|
+
* accepts at that site (`minLength` next to a string, `properties` next to an
|
|
88
|
+
* object), not only how it is described (`description`, `deprecated`,
|
|
89
|
+
* `default`, `x-*`). The engine behind `OasRef.hasValueSiblings`.
|
|
90
|
+
*/
|
|
91
|
+
export declare const changesValues: (copy: OasSchema, target: OasSchema, siblings: SiblingKeywords) => boolean;
|
|
92
|
+
/**
|
|
93
|
+
* The keywords next to a reference that `clone` leaves out for `target`, by
|
|
94
|
+
* their names in the document: one its type does not have (`minLength` next
|
|
95
|
+
* to an array), a `type` that disagrees with the target's, and an `example`,
|
|
96
|
+
* `default`, `enum` or `format` whose value does not fit. `nullable` says
|
|
97
|
+
* whether the site takes `null` among the `enum` members. The engine behind
|
|
98
|
+
* `OasRef.toSkippedSiblings`.
|
|
99
|
+
*/
|
|
100
|
+
export declare const toSkippedSiblings: (target: OasSchema, siblings: SiblingKeywords, nullable: boolean | undefined) => string[];
|
|
101
|
+
/** The annotations of `target` with those of `siblings` applied: a sibling's value wins, and extension fields merge. */
|
|
102
|
+
export declare const toSiblingAnnotations: (target: OasSchema, siblings: SiblingKeywords | undefined) => {
|
|
103
|
+
title: string | undefined;
|
|
104
|
+
description: string | undefined;
|
|
105
|
+
extensionFields: {
|
|
106
|
+
[x: string]: unknown;
|
|
107
|
+
} | undefined;
|
|
108
|
+
};
|
|
109
|
+
/** The value checks the parser makes for `example`, `default` and each `enum` member, by type. */
|
|
110
|
+
export declare const isStringValue: (value: unknown) => value is string;
|
|
111
|
+
export declare const isNumberValue: (value: unknown) => value is number;
|
|
112
|
+
export declare const isIntegerValue: (value: unknown) => value is number;
|
|
113
|
+
export declare const isBooleanValue: (value: unknown) => value is boolean;
|
|
114
|
+
export declare const isArrayValue: (value: unknown) => value is unknown[];
|
|
115
|
+
export declare const isObjectValue: (value: unknown) => value is Record<string, unknown>;
|
|
116
|
+
/** {@link isStringValue} and the others, keyed by the type they check for. A union or unknown takes any value. */
|
|
117
|
+
export declare const VALUE_CHECKS: Record<OasSchema['type'], (value: unknown) => boolean>;
|
|
118
|
+
/** The formats a number and an integer take. A string takes any format. */
|
|
119
|
+
export declare const isNumberFormat: (value: unknown) => value is "float" | "double";
|
|
120
|
+
export declare const isIntegerFormat: (value: unknown) => value is "int32" | "int64";
|
|
121
|
+
/** `value` when it passes `check`, else `undefined`: for `example`, `default` and `format`. */
|
|
122
|
+
export declare const toSiblingValue: <T>(value: unknown, check: (value: unknown) => value is T) => T | undefined;
|
|
123
|
+
/**
|
|
124
|
+
* `enums` when every member passes `check`, or is `null` at a nullable site,
|
|
125
|
+
* else `undefined`. The parser reports the members that do not.
|
|
126
|
+
*/
|
|
127
|
+
export declare const toSiblingEnums: <T>(enums: unknown[] | undefined, check: (value: unknown) => value is T, nullable: boolean | undefined) => (T | null)[] | undefined;
|