@skmtc/core 0.39.0 → 0.41.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/esm/context/CoreContext.js +22 -8
- package/esm/context/GenerateContext.d.ts +6 -5
- package/esm/context/GenerateContext.js +112 -38
- package/esm/context/ParseContext.d.ts +18 -1
- package/esm/context/ParseContext.js +102 -3
- package/esm/context/generateTypes.d.ts +33 -4
- package/esm/context/generateTypes.js +4 -0
- package/esm/context/toGenerationFailure.d.ts +21 -0
- package/esm/context/toGenerationFailure.js +38 -0
- package/esm/context/tryParseAt.d.ts +4 -1
- package/esm/context/tryParseAt.js +10 -3
- package/esm/dsl/CustomValue.d.ts +4 -0
- package/esm/dsl/CustomValue.js +8 -0
- package/esm/dsl/Definition.d.ts +10 -0
- package/esm/dsl/Definition.js +14 -0
- package/esm/dsl/PendingDefinition.d.ts +47 -0
- package/esm/dsl/PendingDefinition.js +83 -0
- package/esm/dsl/model/ModelDriver.d.ts +55 -1
- package/esm/dsl/model/ModelDriver.js +228 -51
- package/esm/dsl/model/toModelEntry.d.ts +1 -1
- package/esm/dsl/model/toModelEntry.js +1 -1
- package/esm/dsl/model/types.d.ts +1 -1
- package/esm/dsl/operation/gql/GqlOperationDriver.js +1 -4
- package/esm/dsl/webhook/WebhookDriver.js +1 -4
- package/esm/enrichments/parseEnrichmentUmbrella.d.ts +5 -6
- package/esm/enrichments/parseEnrichmentUmbrella.js +23 -8
- package/esm/enrichments/parseEnrichmentValue.d.ts +17 -0
- package/esm/enrichments/parseEnrichmentValue.js +32 -0
- package/esm/enrichments/readEnrichments.d.ts +5 -5
- package/esm/enrichments/readEnrichments.js +17 -7
- package/esm/helpers/collateExamples.js +15 -5
- package/esm/helpers/refFns.d.ts +6 -2
- package/esm/helpers/refFns.js +24 -7
- package/esm/mod.d.ts +2 -0
- package/esm/mod.js +2 -0
- package/esm/oas/array/Array.d.ts +19 -0
- package/esm/oas/array/Array.js +47 -0
- package/esm/oas/boolean/Boolean.d.ts +19 -0
- package/esm/oas/boolean/Boolean.js +51 -8
- package/esm/oas/example/Example.d.ts +4 -0
- package/esm/oas/example/Example.js +8 -0
- package/esm/oas/header/Header.d.ts +4 -0
- package/esm/oas/header/Header.js +8 -0
- package/esm/oas/integer/Integer.d.ts +19 -0
- package/esm/oas/integer/Integer.js +49 -0
- package/esm/oas/link/Link.d.ts +4 -0
- package/esm/oas/link/Link.js +8 -0
- package/esm/oas/number/Number.d.ts +19 -0
- package/esm/oas/number/Number.js +49 -0
- package/esm/oas/object/Object.d.ts +19 -0
- package/esm/oas/object/Object.js +68 -18
- package/esm/oas/operation/Operation.d.ts +8 -1
- package/esm/oas/operation/Operation.js +18 -5
- package/esm/oas/operation/toEffectiveParameters.d.ts +24 -0
- package/esm/oas/operation/toEffectiveParameters.js +42 -0
- package/esm/oas/parameter/Parameter.d.ts +4 -0
- package/esm/oas/parameter/Parameter.js +8 -0
- package/esm/oas/ref/DanglingRefError.d.ts +22 -0
- package/esm/oas/ref/DanglingRefError.js +33 -0
- package/esm/oas/ref/Ref.d.ts +152 -25
- package/esm/oas/ref/Ref.js +414 -26
- package/esm/oas/requestBody/RequestBody.d.ts +4 -0
- package/esm/oas/requestBody/RequestBody.js +8 -0
- package/esm/oas/response/Response.d.ts +4 -0
- package/esm/oas/response/Response.js +8 -0
- package/esm/oas/schema/siblings.d.ts +127 -0
- package/esm/oas/schema/siblings.js +250 -0
- package/esm/oas/securitySchemes/SecurityScheme.d.ts +16 -0
- package/esm/oas/securitySchemes/SecurityScheme.js +32 -0
- package/esm/oas/string/String.d.ts +19 -0
- package/esm/oas/string/String.js +47 -0
- package/esm/oas/union/Union.d.ts +32 -0
- package/esm/oas/union/Union.js +111 -0
- package/esm/oas/unknown/Unknown.d.ts +18 -0
- package/esm/oas/unknown/Unknown.js +38 -0
- package/esm/oas/void/Void.d.ts +4 -0
- package/esm/oas/void/Void.js +8 -0
- package/esm/oas/webhook/Webhook.d.ts +2 -2
- package/esm/oas/webhook/Webhook.js +4 -5
- package/esm/parse/allOfSystem.d.ts +32 -0
- package/esm/parse/allOfSystem.js +30 -0
- package/esm/parse/anyOfSystem.d.ts +68 -0
- package/esm/parse/anyOfSystem.js +107 -0
- package/esm/parse/securityRequirements.d.ts +6 -0
- package/esm/parse/securityRequirements.js +8 -0
- package/esm/parse/toSiblingKeywords.d.ts +28 -0
- package/esm/parse/toSiblingKeywords.js +109 -0
- package/esm/parse/v3-0/_merge-all-of/decompose-union.d.ts +8 -0
- package/esm/parse/v3-0/_merge-all-of/decompose-union.js +9 -1
- package/esm/parse/v3-0/_merge-all-of/generic-merge.d.ts +2 -3
- package/esm/parse/v3-0/_merge-all-of/generic-merge.js +2 -2
- package/esm/parse/v3-0/_merge-all-of/merge-array-constraints.d.ts +2 -2
- package/esm/parse/v3-0/_merge-all-of/merge-array-constraints.js +5 -5
- package/esm/parse/v3-0/_merge-all-of/merge-boolean-constraints.d.ts +2 -2
- package/esm/parse/v3-0/_merge-all-of/merge-boolean-constraints.js +2 -2
- package/esm/parse/v3-0/_merge-all-of/merge-integer-constraints.d.ts +2 -2
- package/esm/parse/v3-0/_merge-all-of/merge-integer-constraints.js +2 -2
- package/esm/parse/v3-0/_merge-all-of/merge-intersection.d.ts +3 -2
- package/esm/parse/v3-0/_merge-all-of/merge-intersection.js +2 -2
- package/esm/parse/v3-0/_merge-all-of/merge-number-constraints.d.ts +2 -2
- package/esm/parse/v3-0/_merge-all-of/merge-number-constraints.js +2 -2
- package/esm/parse/v3-0/_merge-all-of/merge-object-constraints.d.ts +2 -2
- package/esm/parse/v3-0/_merge-all-of/merge-object-constraints.js +3 -3
- package/esm/parse/v3-0/_merge-all-of/merge-properties.d.ts +2 -2
- package/esm/parse/v3-0/_merge-all-of/merge-properties.js +2 -2
- package/esm/parse/v3-0/_merge-all-of/merge-string-constraints.d.ts +2 -2
- package/esm/parse/v3-0/_merge-all-of/merge-string-constraints.js +3 -3
- package/esm/parse/v3-0/_merge-all-of/merge-union.d.ts +10 -3
- package/esm/parse/v3-0/_merge-all-of/merge-union.js +50 -12
- package/esm/parse/v3-0/_merge-all-of/merge.d.ts +2 -2
- package/esm/parse/v3-0/_merge-all-of/merge.js +78 -27
- package/esm/parse/v3-0/_merge-all-of/nullable-merge.d.ts +4 -0
- package/esm/parse/v3-0/_merge-all-of/nullable-merge.js +9 -7
- package/esm/parse/v3-0/_merge-all-of/types.d.ts +33 -0
- package/esm/parse/v3-0/mediaType/toMediaTypeItemV3.js +4 -3
- package/esm/parse/v3-0/parameter/toParameterV3.js +4 -3
- package/esm/parse/v3-0/ref/toRefV31.d.ts +7 -1
- package/esm/parse/v3-0/ref/toRefV31.js +6 -3
- package/esm/parse/v3-0/schema/toSchemasV3.js +107 -15
- package/esm/parse/v3-1/_merge-all-of/decompose-union.d.ts +7 -1
- package/esm/parse/v3-1/_merge-all-of/decompose-union.js +8 -2
- package/esm/parse/v3-1/_merge-all-of/generic-merge.d.ts +2 -3
- package/esm/parse/v3-1/_merge-all-of/generic-merge.js +2 -2
- package/esm/parse/v3-1/_merge-all-of/merge-array-constraints.d.ts +3 -2
- package/esm/parse/v3-1/_merge-all-of/merge-array-constraints.js +5 -5
- package/esm/parse/v3-1/_merge-all-of/merge-boolean-constraints.d.ts +2 -2
- package/esm/parse/v3-1/_merge-all-of/merge-boolean-constraints.js +2 -2
- package/esm/parse/v3-1/_merge-all-of/merge-integer-constraints.d.ts +2 -2
- package/esm/parse/v3-1/_merge-all-of/merge-integer-constraints.js +2 -2
- package/esm/parse/v3-1/_merge-all-of/merge-intersection.d.ts +3 -2
- package/esm/parse/v3-1/_merge-all-of/merge-intersection.js +2 -2
- package/esm/parse/v3-1/_merge-all-of/merge-number-constraints.d.ts +2 -2
- package/esm/parse/v3-1/_merge-all-of/merge-number-constraints.js +2 -2
- package/esm/parse/v3-1/_merge-all-of/merge-object-constraints.d.ts +2 -2
- package/esm/parse/v3-1/_merge-all-of/merge-object-constraints.js +3 -3
- package/esm/parse/v3-1/_merge-all-of/merge-properties.d.ts +2 -2
- package/esm/parse/v3-1/_merge-all-of/merge-properties.js +2 -2
- package/esm/parse/v3-1/_merge-all-of/merge-string-constraints.d.ts +2 -2
- package/esm/parse/v3-1/_merge-all-of/merge-string-constraints.js +3 -3
- package/esm/parse/v3-1/_merge-all-of/merge-union.d.ts +10 -3
- package/esm/parse/v3-1/_merge-all-of/merge-union.js +54 -15
- package/esm/parse/v3-1/_merge-all-of/merge.d.ts +3 -2
- package/esm/parse/v3-1/_merge-all-of/merge.js +88 -29
- package/esm/parse/v3-1/_merge-all-of/nullable-merge.d.ts +4 -0
- package/esm/parse/v3-1/_merge-all-of/nullable-merge.js +9 -7
- package/esm/parse/v3-1/_merge-all-of/types.d.ts +37 -0
- package/esm/parse/v3-1/mediaType/toMediaTypeItemV3.js +4 -3
- package/esm/parse/v3-1/parameter/toParameterV3.js +4 -3
- package/esm/parse/v3-1/ref/toRefV31.d.ts +7 -1
- package/esm/parse/v3-1/ref/toRefV31.js +6 -3
- package/esm/parse/v3-1/schema/toSchemasV3.js +111 -16
- package/esm/parse/v3-2/_merge-all-of/decompose-union.d.ts +7 -1
- package/esm/parse/v3-2/_merge-all-of/decompose-union.js +8 -2
- package/esm/parse/v3-2/_merge-all-of/generic-merge.d.ts +2 -3
- package/esm/parse/v3-2/_merge-all-of/generic-merge.js +2 -2
- package/esm/parse/v3-2/_merge-all-of/merge-array-constraints.d.ts +3 -2
- package/esm/parse/v3-2/_merge-all-of/merge-array-constraints.js +5 -5
- package/esm/parse/v3-2/_merge-all-of/merge-boolean-constraints.d.ts +2 -2
- package/esm/parse/v3-2/_merge-all-of/merge-boolean-constraints.js +2 -2
- package/esm/parse/v3-2/_merge-all-of/merge-integer-constraints.d.ts +2 -2
- package/esm/parse/v3-2/_merge-all-of/merge-integer-constraints.js +2 -2
- package/esm/parse/v3-2/_merge-all-of/merge-intersection.d.ts +3 -2
- package/esm/parse/v3-2/_merge-all-of/merge-intersection.js +2 -2
- package/esm/parse/v3-2/_merge-all-of/merge-number-constraints.d.ts +2 -2
- package/esm/parse/v3-2/_merge-all-of/merge-number-constraints.js +2 -2
- package/esm/parse/v3-2/_merge-all-of/merge-object-constraints.d.ts +2 -2
- package/esm/parse/v3-2/_merge-all-of/merge-object-constraints.js +3 -3
- package/esm/parse/v3-2/_merge-all-of/merge-properties.d.ts +2 -2
- package/esm/parse/v3-2/_merge-all-of/merge-properties.js +2 -2
- package/esm/parse/v3-2/_merge-all-of/merge-string-constraints.d.ts +2 -2
- package/esm/parse/v3-2/_merge-all-of/merge-string-constraints.js +3 -3
- package/esm/parse/v3-2/_merge-all-of/merge-union.d.ts +10 -3
- package/esm/parse/v3-2/_merge-all-of/merge-union.js +54 -15
- package/esm/parse/v3-2/_merge-all-of/merge.d.ts +3 -2
- package/esm/parse/v3-2/_merge-all-of/merge.js +88 -29
- package/esm/parse/v3-2/_merge-all-of/nullable-merge.d.ts +4 -0
- package/esm/parse/v3-2/_merge-all-of/nullable-merge.js +9 -7
- package/esm/parse/v3-2/_merge-all-of/types.d.ts +37 -0
- package/esm/parse/v3-2/mediaType/toMediaTypeItemV3.js +4 -3
- package/esm/parse/v3-2/parameter/toParameterV3.js +4 -3
- package/esm/parse/v3-2/ref/toRefV31.d.ts +7 -1
- package/esm/parse/v3-2/ref/toRefV31.js +6 -3
- package/esm/parse/v3-2/schema/toSchemasV3.js +111 -16
- package/esm/types/OasBase.d.ts +1 -1
- package/esm/types/Settings.d.ts +44 -0
- package/esm/types/Settings.js +9 -0
- package/package.json +5 -1
- package/script/context/CoreContext.js +22 -8
- package/script/context/GenerateContext.d.ts +6 -5
- package/script/context/GenerateContext.js +112 -38
- package/script/context/ParseContext.d.ts +18 -1
- package/script/context/ParseContext.js +102 -3
- package/script/context/generateTypes.d.ts +33 -4
- package/script/context/generateTypes.js +4 -0
- package/script/context/toGenerationFailure.d.ts +21 -0
- package/script/context/toGenerationFailure.js +43 -0
- package/script/context/tryParseAt.d.ts +4 -1
- package/script/context/tryParseAt.js +10 -3
- package/script/dsl/CustomValue.d.ts +4 -0
- package/script/dsl/CustomValue.js +8 -0
- package/script/dsl/Definition.d.ts +10 -0
- package/script/dsl/Definition.js +14 -0
- package/script/dsl/PendingDefinition.d.ts +47 -0
- package/script/dsl/PendingDefinition.js +87 -0
- package/script/dsl/model/ModelDriver.d.ts +55 -1
- package/script/dsl/model/ModelDriver.js +231 -52
- package/script/dsl/model/toModelEntry.d.ts +1 -1
- package/script/dsl/model/toModelEntry.js +1 -1
- package/script/dsl/model/types.d.ts +1 -1
- package/script/dsl/operation/gql/GqlOperationDriver.js +1 -4
- package/script/dsl/webhook/WebhookDriver.js +1 -4
- package/script/enrichments/parseEnrichmentUmbrella.d.ts +5 -6
- package/script/enrichments/parseEnrichmentUmbrella.js +23 -41
- package/script/enrichments/parseEnrichmentValue.d.ts +17 -0
- package/script/enrichments/parseEnrichmentValue.js +69 -0
- package/script/enrichments/readEnrichments.d.ts +5 -5
- package/script/enrichments/readEnrichments.js +17 -40
- package/script/helpers/collateExamples.js +15 -5
- package/script/helpers/refFns.d.ts +6 -2
- package/script/helpers/refFns.js +24 -7
- package/script/mod.d.ts +2 -0
- package/script/mod.js +2 -0
- package/script/oas/array/Array.d.ts +19 -0
- package/script/oas/array/Array.js +47 -0
- package/script/oas/boolean/Boolean.d.ts +19 -0
- package/script/oas/boolean/Boolean.js +51 -8
- package/script/oas/example/Example.d.ts +4 -0
- package/script/oas/example/Example.js +8 -0
- package/script/oas/header/Header.d.ts +4 -0
- package/script/oas/header/Header.js +8 -0
- package/script/oas/integer/Integer.d.ts +19 -0
- package/script/oas/integer/Integer.js +49 -0
- package/script/oas/link/Link.d.ts +4 -0
- package/script/oas/link/Link.js +8 -0
- package/script/oas/number/Number.d.ts +19 -0
- package/script/oas/number/Number.js +49 -0
- package/script/oas/object/Object.d.ts +19 -0
- package/script/oas/object/Object.js +68 -18
- package/script/oas/operation/Operation.d.ts +8 -1
- package/script/oas/operation/Operation.js +18 -5
- package/script/oas/operation/toEffectiveParameters.d.ts +24 -0
- package/script/oas/operation/toEffectiveParameters.js +47 -0
- package/script/oas/parameter/Parameter.d.ts +4 -0
- package/script/oas/parameter/Parameter.js +8 -0
- package/script/oas/ref/DanglingRefError.d.ts +22 -0
- package/script/oas/ref/DanglingRefError.js +37 -0
- package/script/oas/ref/Ref.d.ts +152 -25
- package/script/oas/ref/Ref.js +414 -26
- package/script/oas/requestBody/RequestBody.d.ts +4 -0
- package/script/oas/requestBody/RequestBody.js +8 -0
- package/script/oas/response/Response.d.ts +4 -0
- package/script/oas/response/Response.js +8 -0
- package/script/oas/schema/siblings.d.ts +127 -0
- package/script/oas/schema/siblings.js +305 -0
- package/script/oas/securitySchemes/SecurityScheme.d.ts +16 -0
- package/script/oas/securitySchemes/SecurityScheme.js +32 -0
- package/script/oas/string/String.d.ts +19 -0
- package/script/oas/string/String.js +47 -0
- package/script/oas/union/Union.d.ts +32 -0
- package/script/oas/union/Union.js +111 -0
- package/script/oas/unknown/Unknown.d.ts +18 -0
- package/script/oas/unknown/Unknown.js +38 -0
- package/script/oas/void/Void.d.ts +4 -0
- package/script/oas/void/Void.js +8 -0
- package/script/oas/webhook/Webhook.d.ts +2 -2
- package/script/oas/webhook/Webhook.js +4 -5
- package/script/parse/allOfSystem.d.ts +32 -0
- package/script/parse/allOfSystem.js +35 -0
- package/script/parse/anyOfSystem.d.ts +68 -0
- package/script/parse/anyOfSystem.js +116 -0
- package/script/parse/securityRequirements.d.ts +6 -0
- package/script/parse/securityRequirements.js +8 -0
- package/script/parse/toSiblingKeywords.d.ts +28 -0
- package/script/parse/toSiblingKeywords.js +146 -0
- package/script/parse/v3-0/_merge-all-of/decompose-union.d.ts +8 -0
- package/script/parse/v3-0/_merge-all-of/decompose-union.js +11 -2
- package/script/parse/v3-0/_merge-all-of/generic-merge.d.ts +2 -3
- package/script/parse/v3-0/_merge-all-of/generic-merge.js +2 -2
- package/script/parse/v3-0/_merge-all-of/merge-array-constraints.d.ts +2 -2
- package/script/parse/v3-0/_merge-all-of/merge-array-constraints.js +5 -5
- package/script/parse/v3-0/_merge-all-of/merge-boolean-constraints.d.ts +2 -2
- package/script/parse/v3-0/_merge-all-of/merge-boolean-constraints.js +2 -2
- package/script/parse/v3-0/_merge-all-of/merge-integer-constraints.d.ts +2 -2
- package/script/parse/v3-0/_merge-all-of/merge-integer-constraints.js +2 -2
- package/script/parse/v3-0/_merge-all-of/merge-intersection.d.ts +3 -2
- package/script/parse/v3-0/_merge-all-of/merge-intersection.js +2 -2
- package/script/parse/v3-0/_merge-all-of/merge-number-constraints.d.ts +2 -2
- package/script/parse/v3-0/_merge-all-of/merge-number-constraints.js +2 -2
- package/script/parse/v3-0/_merge-all-of/merge-object-constraints.d.ts +2 -2
- package/script/parse/v3-0/_merge-all-of/merge-object-constraints.js +3 -3
- package/script/parse/v3-0/_merge-all-of/merge-properties.d.ts +2 -2
- package/script/parse/v3-0/_merge-all-of/merge-properties.js +2 -2
- package/script/parse/v3-0/_merge-all-of/merge-string-constraints.d.ts +2 -2
- package/script/parse/v3-0/_merge-all-of/merge-string-constraints.js +3 -3
- package/script/parse/v3-0/_merge-all-of/merge-union.d.ts +10 -3
- package/script/parse/v3-0/_merge-all-of/merge-union.js +52 -13
- package/script/parse/v3-0/_merge-all-of/merge.d.ts +2 -2
- package/script/parse/v3-0/_merge-all-of/merge.js +77 -26
- package/script/parse/v3-0/_merge-all-of/nullable-merge.d.ts +4 -0
- package/script/parse/v3-0/_merge-all-of/nullable-merge.js +9 -7
- package/script/parse/v3-0/_merge-all-of/types.d.ts +33 -0
- package/script/parse/v3-0/mediaType/toMediaTypeItemV3.js +4 -3
- package/script/parse/v3-0/parameter/toParameterV3.js +4 -3
- package/script/parse/v3-0/ref/toRefV31.d.ts +7 -1
- package/script/parse/v3-0/ref/toRefV31.js +6 -3
- package/script/parse/v3-0/schema/toSchemasV3.js +107 -15
- package/script/parse/v3-1/_merge-all-of/decompose-union.d.ts +7 -1
- package/script/parse/v3-1/_merge-all-of/decompose-union.js +8 -2
- package/script/parse/v3-1/_merge-all-of/generic-merge.d.ts +2 -3
- package/script/parse/v3-1/_merge-all-of/generic-merge.js +2 -2
- package/script/parse/v3-1/_merge-all-of/merge-array-constraints.d.ts +3 -2
- package/script/parse/v3-1/_merge-all-of/merge-array-constraints.js +5 -5
- package/script/parse/v3-1/_merge-all-of/merge-boolean-constraints.d.ts +2 -2
- package/script/parse/v3-1/_merge-all-of/merge-boolean-constraints.js +2 -2
- package/script/parse/v3-1/_merge-all-of/merge-integer-constraints.d.ts +2 -2
- package/script/parse/v3-1/_merge-all-of/merge-integer-constraints.js +2 -2
- package/script/parse/v3-1/_merge-all-of/merge-intersection.d.ts +3 -2
- package/script/parse/v3-1/_merge-all-of/merge-intersection.js +2 -2
- package/script/parse/v3-1/_merge-all-of/merge-number-constraints.d.ts +2 -2
- package/script/parse/v3-1/_merge-all-of/merge-number-constraints.js +2 -2
- package/script/parse/v3-1/_merge-all-of/merge-object-constraints.d.ts +2 -2
- package/script/parse/v3-1/_merge-all-of/merge-object-constraints.js +3 -3
- package/script/parse/v3-1/_merge-all-of/merge-properties.d.ts +2 -2
- package/script/parse/v3-1/_merge-all-of/merge-properties.js +2 -2
- package/script/parse/v3-1/_merge-all-of/merge-string-constraints.d.ts +2 -2
- package/script/parse/v3-1/_merge-all-of/merge-string-constraints.js +3 -3
- package/script/parse/v3-1/_merge-all-of/merge-union.d.ts +10 -3
- package/script/parse/v3-1/_merge-all-of/merge-union.js +56 -16
- package/script/parse/v3-1/_merge-all-of/merge.d.ts +3 -2
- package/script/parse/v3-1/_merge-all-of/merge.js +87 -28
- package/script/parse/v3-1/_merge-all-of/nullable-merge.d.ts +4 -0
- package/script/parse/v3-1/_merge-all-of/nullable-merge.js +9 -7
- package/script/parse/v3-1/_merge-all-of/types.d.ts +37 -0
- package/script/parse/v3-1/mediaType/toMediaTypeItemV3.js +4 -3
- package/script/parse/v3-1/parameter/toParameterV3.js +4 -3
- package/script/parse/v3-1/ref/toRefV31.d.ts +7 -1
- package/script/parse/v3-1/ref/toRefV31.js +6 -3
- package/script/parse/v3-1/schema/toSchemasV3.js +111 -16
- package/script/parse/v3-2/_merge-all-of/decompose-union.d.ts +7 -1
- package/script/parse/v3-2/_merge-all-of/decompose-union.js +8 -2
- package/script/parse/v3-2/_merge-all-of/generic-merge.d.ts +2 -3
- package/script/parse/v3-2/_merge-all-of/generic-merge.js +2 -2
- package/script/parse/v3-2/_merge-all-of/merge-array-constraints.d.ts +3 -2
- package/script/parse/v3-2/_merge-all-of/merge-array-constraints.js +5 -5
- package/script/parse/v3-2/_merge-all-of/merge-boolean-constraints.d.ts +2 -2
- package/script/parse/v3-2/_merge-all-of/merge-boolean-constraints.js +2 -2
- package/script/parse/v3-2/_merge-all-of/merge-integer-constraints.d.ts +2 -2
- package/script/parse/v3-2/_merge-all-of/merge-integer-constraints.js +2 -2
- package/script/parse/v3-2/_merge-all-of/merge-intersection.d.ts +3 -2
- package/script/parse/v3-2/_merge-all-of/merge-intersection.js +2 -2
- package/script/parse/v3-2/_merge-all-of/merge-number-constraints.d.ts +2 -2
- package/script/parse/v3-2/_merge-all-of/merge-number-constraints.js +2 -2
- package/script/parse/v3-2/_merge-all-of/merge-object-constraints.d.ts +2 -2
- package/script/parse/v3-2/_merge-all-of/merge-object-constraints.js +3 -3
- package/script/parse/v3-2/_merge-all-of/merge-properties.d.ts +2 -2
- package/script/parse/v3-2/_merge-all-of/merge-properties.js +2 -2
- package/script/parse/v3-2/_merge-all-of/merge-string-constraints.d.ts +2 -2
- package/script/parse/v3-2/_merge-all-of/merge-string-constraints.js +3 -3
- package/script/parse/v3-2/_merge-all-of/merge-union.d.ts +10 -3
- package/script/parse/v3-2/_merge-all-of/merge-union.js +56 -16
- package/script/parse/v3-2/_merge-all-of/merge.d.ts +3 -2
- package/script/parse/v3-2/_merge-all-of/merge.js +87 -28
- package/script/parse/v3-2/_merge-all-of/nullable-merge.d.ts +4 -0
- package/script/parse/v3-2/_merge-all-of/nullable-merge.js +9 -7
- package/script/parse/v3-2/_merge-all-of/types.d.ts +37 -0
- package/script/parse/v3-2/mediaType/toMediaTypeItemV3.js +4 -3
- package/script/parse/v3-2/parameter/toParameterV3.js +4 -3
- package/script/parse/v3-2/ref/toRefV31.d.ts +7 -1
- package/script/parse/v3-2/ref/toRefV31.js +6 -3
- package/script/parse/v3-2/schema/toSchemasV3.js +111 -16
- package/script/types/OasBase.d.ts +1 -1
- package/script/types/Settings.d.ts +44 -0
- package/script/types/Settings.js +10 -1
package/esm/oas/ref/Ref.js
CHANGED
|
@@ -9,11 +9,13 @@ 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 { DanglingRefError } from './DanglingRefError.js';
|
|
18
|
+
import { changesTarget, changesValues, hasSiblingKeywords, mergeSiblingKeywords, toSkippedSiblings } from '../schema/siblings.js';
|
|
17
19
|
const MAX_LOOKUPS = 10;
|
|
18
20
|
/**
|
|
19
21
|
* Converts a ref type to its plural components path.
|
|
@@ -42,6 +44,18 @@ function refTypeToPluralPath(refType) {
|
|
|
42
44
|
}
|
|
43
45
|
}
|
|
44
46
|
}
|
|
47
|
+
/**
|
|
48
|
+
* The name `resolveOnce` looks up. `toRefName` throws for a `$ref` whose last
|
|
49
|
+
* segment is empty (`#/components/schemas/`): that `$ref` names nothing.
|
|
50
|
+
*/
|
|
51
|
+
const toLookupName = ($ref) => {
|
|
52
|
+
try {
|
|
53
|
+
return toRefName($ref);
|
|
54
|
+
}
|
|
55
|
+
catch {
|
|
56
|
+
throw new DanglingRefError($ref);
|
|
57
|
+
}
|
|
58
|
+
};
|
|
45
59
|
/**
|
|
46
60
|
* Represents an OpenAPI reference ($ref) in the SKMTC OAS processing system.
|
|
47
61
|
*
|
|
@@ -133,10 +147,11 @@ export class OasRef extends OasBase {
|
|
|
133
147
|
* Creates a new OAS reference instance.
|
|
134
148
|
*
|
|
135
149
|
* @param fields - Reference field data including refType and $ref
|
|
136
|
-
* @param
|
|
137
|
-
*
|
|
138
|
-
*
|
|
139
|
-
* schema refs)
|
|
150
|
+
* @param context - The parse context, or what `clone` passes in its place:
|
|
151
|
+
* the discriminated document containing the referenced component (for
|
|
152
|
+
* OAS, refs resolve through the document's components; for GQL, through
|
|
153
|
+
* the document's registry, as GQL only ever creates schema refs) and the
|
|
154
|
+
* current trail.
|
|
140
155
|
*/
|
|
141
156
|
constructor(fields, context) {
|
|
142
157
|
super(context);
|
|
@@ -155,9 +170,257 @@ export class OasRef extends OasBase {
|
|
|
155
170
|
writable: true,
|
|
156
171
|
value: 'ref'
|
|
157
172
|
});
|
|
158
|
-
|
|
173
|
+
/** The kind of component the reference points to. */
|
|
174
|
+
Object.defineProperty(this, "refType", {
|
|
175
|
+
enumerable: true,
|
|
176
|
+
configurable: true,
|
|
177
|
+
writable: true,
|
|
178
|
+
value: void 0
|
|
179
|
+
});
|
|
180
|
+
/** The JSON Reference: `#/components/<bucket>/<name>`. */
|
|
181
|
+
Object.defineProperty(this, "$ref", {
|
|
182
|
+
enumerable: true,
|
|
183
|
+
configurable: true,
|
|
184
|
+
writable: true,
|
|
185
|
+
value: void 0
|
|
186
|
+
});
|
|
187
|
+
/**
|
|
188
|
+
* Use-site nullability (see {@link SiblingKeywords.nullable}). Assigned
|
|
189
|
+
* even when `undefined`, so `'nullable' in ref` is always true and the
|
|
190
|
+
* value-function nullable read picks it up uniformly.
|
|
191
|
+
*/
|
|
192
|
+
Object.defineProperty(this, "nullable", {
|
|
193
|
+
enumerable: true,
|
|
194
|
+
configurable: true,
|
|
195
|
+
writable: true,
|
|
196
|
+
value: void 0
|
|
197
|
+
});
|
|
198
|
+
/** Use-site `readOnly` (see {@link SiblingKeywords.readOnly}). */
|
|
199
|
+
Object.defineProperty(this, "readOnly", {
|
|
200
|
+
enumerable: true,
|
|
201
|
+
configurable: true,
|
|
202
|
+
writable: true,
|
|
203
|
+
value: void 0
|
|
204
|
+
});
|
|
205
|
+
/** Use-site `writeOnly` (see {@link SiblingKeywords.writeOnly}). */
|
|
206
|
+
Object.defineProperty(this, "writeOnly", {
|
|
207
|
+
enumerable: true,
|
|
208
|
+
configurable: true,
|
|
209
|
+
writable: true,
|
|
210
|
+
value: void 0
|
|
211
|
+
});
|
|
212
|
+
/** The `type` written next to this reference (see {@link SiblingKeywords._type}). */
|
|
213
|
+
Object.defineProperty(this, "_type", {
|
|
214
|
+
enumerable: true,
|
|
215
|
+
configurable: true,
|
|
216
|
+
writable: true,
|
|
217
|
+
value: void 0
|
|
218
|
+
});
|
|
219
|
+
/** The `title` next to this reference (see {@link SiblingKeywords}). */
|
|
220
|
+
Object.defineProperty(this, "title", {
|
|
221
|
+
enumerable: true,
|
|
222
|
+
configurable: true,
|
|
223
|
+
writable: true,
|
|
224
|
+
value: void 0
|
|
225
|
+
});
|
|
226
|
+
/** The `description` next to this reference (see {@link SiblingKeywords}). */
|
|
227
|
+
Object.defineProperty(this, "description", {
|
|
228
|
+
enumerable: true,
|
|
229
|
+
configurable: true,
|
|
230
|
+
writable: true,
|
|
231
|
+
value: void 0
|
|
232
|
+
});
|
|
233
|
+
/** The `deprecated` next to this reference (see {@link SiblingKeywords}). */
|
|
234
|
+
Object.defineProperty(this, "deprecated", {
|
|
235
|
+
enumerable: true,
|
|
236
|
+
configurable: true,
|
|
237
|
+
writable: true,
|
|
238
|
+
value: void 0
|
|
239
|
+
});
|
|
240
|
+
/** The `example` next to this reference (see {@link SiblingKeywords}). */
|
|
241
|
+
Object.defineProperty(this, "example", {
|
|
242
|
+
enumerable: true,
|
|
243
|
+
configurable: true,
|
|
244
|
+
writable: true,
|
|
245
|
+
value: void 0
|
|
246
|
+
});
|
|
247
|
+
/** The `default` next to this reference (see {@link SiblingKeywords}). */
|
|
248
|
+
Object.defineProperty(this, "default", {
|
|
249
|
+
enumerable: true,
|
|
250
|
+
configurable: true,
|
|
251
|
+
writable: true,
|
|
252
|
+
value: void 0
|
|
253
|
+
});
|
|
254
|
+
/** The `enum` next to this reference (see {@link SiblingKeywords}). */
|
|
255
|
+
Object.defineProperty(this, "enums", {
|
|
256
|
+
enumerable: true,
|
|
257
|
+
configurable: true,
|
|
258
|
+
writable: true,
|
|
259
|
+
value: void 0
|
|
260
|
+
});
|
|
261
|
+
/** The extensions (`x-*`) next to this reference (see {@link SiblingKeywords}). */
|
|
262
|
+
Object.defineProperty(this, "extensionFields", {
|
|
263
|
+
enumerable: true,
|
|
264
|
+
configurable: true,
|
|
265
|
+
writable: true,
|
|
266
|
+
value: void 0
|
|
267
|
+
});
|
|
268
|
+
/** The `format` next to this reference (see {@link SiblingKeywords}). */
|
|
269
|
+
Object.defineProperty(this, "format", {
|
|
270
|
+
enumerable: true,
|
|
271
|
+
configurable: true,
|
|
272
|
+
writable: true,
|
|
273
|
+
value: void 0
|
|
274
|
+
});
|
|
275
|
+
/** The `minLength` next to this reference (see {@link SiblingKeywords}). */
|
|
276
|
+
Object.defineProperty(this, "minLength", {
|
|
277
|
+
enumerable: true,
|
|
278
|
+
configurable: true,
|
|
279
|
+
writable: true,
|
|
280
|
+
value: void 0
|
|
281
|
+
});
|
|
282
|
+
/** The `maxLength` next to this reference (see {@link SiblingKeywords}). */
|
|
283
|
+
Object.defineProperty(this, "maxLength", {
|
|
284
|
+
enumerable: true,
|
|
285
|
+
configurable: true,
|
|
286
|
+
writable: true,
|
|
287
|
+
value: void 0
|
|
288
|
+
});
|
|
289
|
+
/** The `pattern` next to this reference (see {@link SiblingKeywords}). */
|
|
290
|
+
Object.defineProperty(this, "pattern", {
|
|
291
|
+
enumerable: true,
|
|
292
|
+
configurable: true,
|
|
293
|
+
writable: true,
|
|
294
|
+
value: void 0
|
|
295
|
+
});
|
|
296
|
+
/** The `multipleOf` next to this reference (see {@link SiblingKeywords}). */
|
|
297
|
+
Object.defineProperty(this, "multipleOf", {
|
|
298
|
+
enumerable: true,
|
|
299
|
+
configurable: true,
|
|
300
|
+
writable: true,
|
|
301
|
+
value: void 0
|
|
302
|
+
});
|
|
303
|
+
/** The `minimum` next to this reference (see {@link SiblingKeywords}). */
|
|
304
|
+
Object.defineProperty(this, "minimum", {
|
|
305
|
+
enumerable: true,
|
|
306
|
+
configurable: true,
|
|
307
|
+
writable: true,
|
|
308
|
+
value: void 0
|
|
309
|
+
});
|
|
310
|
+
/** The `maximum` next to this reference (see {@link SiblingKeywords}). */
|
|
311
|
+
Object.defineProperty(this, "maximum", {
|
|
312
|
+
enumerable: true,
|
|
313
|
+
configurable: true,
|
|
314
|
+
writable: true,
|
|
315
|
+
value: void 0
|
|
316
|
+
});
|
|
317
|
+
/** The `exclusiveMinimum` next to this reference (see {@link SiblingKeywords}). */
|
|
318
|
+
Object.defineProperty(this, "exclusiveMinimum", {
|
|
319
|
+
enumerable: true,
|
|
320
|
+
configurable: true,
|
|
321
|
+
writable: true,
|
|
322
|
+
value: void 0
|
|
323
|
+
});
|
|
324
|
+
/** The `exclusiveMaximum` next to this reference (see {@link SiblingKeywords}). */
|
|
325
|
+
Object.defineProperty(this, "exclusiveMaximum", {
|
|
326
|
+
enumerable: true,
|
|
327
|
+
configurable: true,
|
|
328
|
+
writable: true,
|
|
329
|
+
value: void 0
|
|
330
|
+
});
|
|
331
|
+
/** The `minItems` next to this reference (see {@link SiblingKeywords}). */
|
|
332
|
+
Object.defineProperty(this, "minItems", {
|
|
333
|
+
enumerable: true,
|
|
334
|
+
configurable: true,
|
|
335
|
+
writable: true,
|
|
336
|
+
value: void 0
|
|
337
|
+
});
|
|
338
|
+
/** The `maxItems` next to this reference (see {@link SiblingKeywords}). */
|
|
339
|
+
Object.defineProperty(this, "maxItems", {
|
|
340
|
+
enumerable: true,
|
|
341
|
+
configurable: true,
|
|
342
|
+
writable: true,
|
|
343
|
+
value: void 0
|
|
344
|
+
});
|
|
345
|
+
/** The `uniqueItems` next to this reference (see {@link SiblingKeywords}). */
|
|
346
|
+
Object.defineProperty(this, "uniqueItems", {
|
|
347
|
+
enumerable: true,
|
|
348
|
+
configurable: true,
|
|
349
|
+
writable: true,
|
|
350
|
+
value: void 0
|
|
351
|
+
});
|
|
352
|
+
/** The `properties` next to this reference (see {@link SiblingKeywords}). */
|
|
353
|
+
Object.defineProperty(this, "properties", {
|
|
354
|
+
enumerable: true,
|
|
355
|
+
configurable: true,
|
|
356
|
+
writable: true,
|
|
357
|
+
value: void 0
|
|
358
|
+
});
|
|
359
|
+
/** The `required` next to this reference (see {@link SiblingKeywords}). */
|
|
360
|
+
Object.defineProperty(this, "required", {
|
|
361
|
+
enumerable: true,
|
|
362
|
+
configurable: true,
|
|
363
|
+
writable: true,
|
|
364
|
+
value: void 0
|
|
365
|
+
});
|
|
366
|
+
/** The `additionalProperties` next to this reference (see {@link SiblingKeywords}). */
|
|
367
|
+
Object.defineProperty(this, "additionalProperties", {
|
|
368
|
+
enumerable: true,
|
|
369
|
+
configurable: true,
|
|
370
|
+
writable: true,
|
|
371
|
+
value: void 0
|
|
372
|
+
});
|
|
373
|
+
/** The `minProperties` next to this reference (see {@link SiblingKeywords}). */
|
|
374
|
+
Object.defineProperty(this, "minProperties", {
|
|
375
|
+
enumerable: true,
|
|
376
|
+
configurable: true,
|
|
377
|
+
writable: true,
|
|
378
|
+
value: void 0
|
|
379
|
+
});
|
|
380
|
+
/** The `maxProperties` next to this reference (see {@link SiblingKeywords}). */
|
|
381
|
+
Object.defineProperty(this, "maxProperties", {
|
|
382
|
+
enumerable: true,
|
|
383
|
+
configurable: true,
|
|
384
|
+
writable: true,
|
|
385
|
+
value: void 0
|
|
386
|
+
});
|
|
159
387
|
_OasRef_document.set(this, void 0);
|
|
160
|
-
|
|
388
|
+
/**
|
|
389
|
+
* What {@link resolve} found, kept for every later call: the target, and
|
|
390
|
+
* the result (the target, or the copy with this reference's keywords). The
|
|
391
|
+
* document does not change after parse, so neither does the answer.
|
|
392
|
+
*/
|
|
393
|
+
_OasRef_resolution.set(this, void 0);
|
|
394
|
+
this.refType = fields.refType;
|
|
395
|
+
this.$ref = fields.$ref;
|
|
396
|
+
this.nullable = fields.nullable;
|
|
397
|
+
this.readOnly = fields.readOnly;
|
|
398
|
+
this.writeOnly = fields.writeOnly;
|
|
399
|
+
this._type = fields._type;
|
|
400
|
+
this.title = fields.title;
|
|
401
|
+
this.description = fields.description;
|
|
402
|
+
this.deprecated = fields.deprecated;
|
|
403
|
+
this.example = fields.example;
|
|
404
|
+
this.default = fields.default;
|
|
405
|
+
this.enums = fields.enums;
|
|
406
|
+
this.extensionFields = fields.extensionFields;
|
|
407
|
+
this.format = fields.format;
|
|
408
|
+
this.minLength = fields.minLength;
|
|
409
|
+
this.maxLength = fields.maxLength;
|
|
410
|
+
this.pattern = fields.pattern;
|
|
411
|
+
this.multipleOf = fields.multipleOf;
|
|
412
|
+
this.minimum = fields.minimum;
|
|
413
|
+
this.maximum = fields.maximum;
|
|
414
|
+
this.exclusiveMinimum = fields.exclusiveMinimum;
|
|
415
|
+
this.exclusiveMaximum = fields.exclusiveMaximum;
|
|
416
|
+
this.minItems = fields.minItems;
|
|
417
|
+
this.maxItems = fields.maxItems;
|
|
418
|
+
this.uniqueItems = fields.uniqueItems;
|
|
419
|
+
this.properties = fields.properties;
|
|
420
|
+
this.required = fields.required;
|
|
421
|
+
this.additionalProperties = fields.additionalProperties;
|
|
422
|
+
this.minProperties = fields.minProperties;
|
|
423
|
+
this.maxProperties = fields.maxProperties;
|
|
161
424
|
__classPrivateFieldSet(this, _OasRef_document, context.parsedDocument, "f");
|
|
162
425
|
}
|
|
163
426
|
/**
|
|
@@ -172,18 +435,22 @@ export class OasRef extends OasBase {
|
|
|
172
435
|
* Recursively resolves this reference to its final target component.
|
|
173
436
|
*
|
|
174
437
|
* Follows reference chains until reaching a non-reference component,
|
|
175
|
-
* with protection against infinite loops.
|
|
438
|
+
* with protection against infinite loops. A schema reference returns the
|
|
439
|
+
* schema at this site: when the keywords next to it, or next to a
|
|
440
|
+
* reference on the chain ({@link SiblingKeywords}), change the target, a
|
|
441
|
+
* copy of the target with them applied. When they change nothing, the
|
|
442
|
+
* shared target itself. `resolveOnce()` applies no siblings.
|
|
443
|
+
*
|
|
444
|
+
* The result is shared, so do not modify it: the shared target is the
|
|
445
|
+
* model every reference to it sees, and a copy is built once, kept on
|
|
446
|
+
* this reference, and returned on every call.
|
|
176
447
|
*
|
|
177
448
|
* @param lookupsPerformed - Internal counter to prevent infinite recursion
|
|
178
449
|
* @returns The resolved component
|
|
179
450
|
* @throws Error if maximum lookup depth is exceeded
|
|
180
451
|
*/
|
|
181
452
|
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;
|
|
453
|
+
return __classPrivateFieldGet(this, _OasRef_instances, "m", _OasRef_toResolution).call(this, lookupsPerformed).resolved;
|
|
187
454
|
}
|
|
188
455
|
/**
|
|
189
456
|
* Resolves this reference one level. Dispatches on the document's
|
|
@@ -191,14 +458,19 @@ export class OasRef extends OasBase {
|
|
|
191
458
|
* reads from `document.registry.schemas`.
|
|
192
459
|
*
|
|
193
460
|
* @returns Either the resolved component or another reference in the chain
|
|
461
|
+
* @throws {DanglingRefError} when the reference names nothing in the
|
|
462
|
+
* document (kept under `client.json` `system.danglingRefs: keep`),
|
|
463
|
+
* including a `$ref` with no name, such as `#/components/schemas/`
|
|
464
|
+
* @throws Error when it names a component of another kind, such as a
|
|
465
|
+
* `requestBody` ref to `#/components/schemas/…`
|
|
194
466
|
*/
|
|
195
467
|
resolveOnce() {
|
|
196
|
-
const refName =
|
|
468
|
+
const refName = toLookupName(this.$ref);
|
|
197
469
|
const resolved = __classPrivateFieldGet(this, _OasRef_document, "f").type === 'oas'
|
|
198
470
|
? __classPrivateFieldGet(this, _OasRef_instances, "m", _OasRef_resolveOasOnce).call(this, __classPrivateFieldGet(this, _OasRef_document, "f").value, refName)
|
|
199
471
|
: __classPrivateFieldGet(this, _OasRef_instances, "m", _OasRef_resolveGqlOnce).call(this, __classPrivateFieldGet(this, _OasRef_document, "f").value, refName);
|
|
200
472
|
if (!resolved) {
|
|
201
|
-
throw new
|
|
473
|
+
throw new DanglingRefError(this.$ref);
|
|
202
474
|
}
|
|
203
475
|
if (resolved.isRef()) {
|
|
204
476
|
if (resolved.refType !== this.refType) {
|
|
@@ -213,7 +485,7 @@ export class OasRef extends OasBase {
|
|
|
213
485
|
return resolved;
|
|
214
486
|
}
|
|
215
487
|
toRefName() {
|
|
216
|
-
return toRefName(
|
|
488
|
+
return toRefName(this.$ref);
|
|
217
489
|
}
|
|
218
490
|
/**
|
|
219
491
|
* Narrows this reference to a schema reference.
|
|
@@ -242,19 +514,96 @@ export class OasRef extends OasBase {
|
|
|
242
514
|
}
|
|
243
515
|
return traverseSchema(this, path);
|
|
244
516
|
}
|
|
245
|
-
|
|
246
|
-
|
|
517
|
+
/**
|
|
518
|
+
* Whether this reference adds anything at its site: a use-site flag
|
|
519
|
+
* (`nullable`, `readOnly`, `writeOnly`) or another keyword next to it (see
|
|
520
|
+
* {@link RefFields}). {@link resolve} then returns a copy of the target with
|
|
521
|
+
* them applied, not the shared target.
|
|
522
|
+
*/
|
|
523
|
+
hasSiblings() {
|
|
524
|
+
return hasSiblingKeywords(this);
|
|
525
|
+
}
|
|
526
|
+
/**
|
|
527
|
+
* A copy of this reference with what `ref` adds at its site merged in: its
|
|
528
|
+
* flags, and its keywords over this reference's own
|
|
529
|
+
* ({@link mergeSiblingKeywords}). It points at the same target. Each schema
|
|
530
|
+
* class's `clone` does the same for a schema, so one step along a chain of
|
|
531
|
+
* references can carry a site's keywords (`resolveSchemaRefOnce`). This
|
|
532
|
+
* reference does not change.
|
|
533
|
+
*/
|
|
534
|
+
clone(ref) {
|
|
535
|
+
const copy = new OasRef({ refType: this.refType, $ref: this.$ref, ...mergeSiblingKeywords(this, ref) }, { parsedDocument: __classPrivateFieldGet(this, _OasRef_document, "f"), currentStackTrail: undefined });
|
|
536
|
+
copy.stackTrail = this.stackTrail;
|
|
537
|
+
return copy;
|
|
538
|
+
}
|
|
539
|
+
/**
|
|
540
|
+
* Whether the keywords next to this reference change which values it
|
|
541
|
+
* accepts (`minLength` next to a string, `properties` next to an object),
|
|
542
|
+
* not only how it is described (`description`, `deprecated`, `x-*`). No
|
|
543
|
+
* shared model accepts the same values as such a site, so a generator
|
|
544
|
+
* applies these keywords where it renders the reference by name. See
|
|
545
|
+
* {@link changesValues}.
|
|
546
|
+
*/
|
|
547
|
+
hasValueSiblings() {
|
|
548
|
+
if (!this.hasSiblings()) {
|
|
549
|
+
return false;
|
|
550
|
+
}
|
|
551
|
+
const { target, resolved } = __classPrivateFieldGet(this, _OasRef_instances, "m", _OasRef_toResolution).call(this, 0);
|
|
552
|
+
// Widened from the generic ResolvedRef<T>, so `oasType` narrows them.
|
|
553
|
+
const original = target;
|
|
554
|
+
const applied = resolved;
|
|
555
|
+
return (applied !== original &&
|
|
556
|
+
applied.oasType === 'schema' &&
|
|
557
|
+
original.oasType === 'schema' &&
|
|
558
|
+
changesValues(applied, original, this));
|
|
559
|
+
}
|
|
560
|
+
/**
|
|
561
|
+
* The keywords next to this reference that {@link resolve} leaves out, by
|
|
562
|
+
* their names in the document: ones the target's type does not take
|
|
563
|
+
* (`minLength` next to an array), a `type` that disagrees, and values that
|
|
564
|
+
* do not fit. The parser cannot tell them while the reference is lazy, so a
|
|
565
|
+
* generator logs them when it renders the site. See {@link toSkippedSiblings}.
|
|
566
|
+
*/
|
|
567
|
+
toSkippedSiblings() {
|
|
568
|
+
if (!this.hasSiblings()) {
|
|
569
|
+
return [];
|
|
570
|
+
}
|
|
571
|
+
const component = this.resolve();
|
|
572
|
+
return component.oasType === 'schema' ? toSkippedSiblings(component, this, component.nullable) : [];
|
|
247
573
|
}
|
|
248
|
-
|
|
249
|
-
|
|
574
|
+
/**
|
|
575
|
+
* Whether the value is `readOnly` at this site, as Forge reads it: on this
|
|
576
|
+
* reference (`{ allOf: [{ $ref }], readOnly: true }`), or on what it points
|
|
577
|
+
* to, through any chain of references. A `readOnly: false` does not undo
|
|
578
|
+
* another's `true`. `false` for a reference to anything but a schema.
|
|
579
|
+
*
|
|
580
|
+
* @param lookupsPerformed - Internal counter that stops a chain of references with no schema
|
|
581
|
+
*/
|
|
582
|
+
isReadOnly(lookupsPerformed = 0) {
|
|
583
|
+
if (this.readOnly === true) {
|
|
584
|
+
return true;
|
|
585
|
+
}
|
|
586
|
+
if (lookupsPerformed >= MAX_LOOKUPS) {
|
|
587
|
+
return false;
|
|
588
|
+
}
|
|
589
|
+
const resolved = this.resolveOnce();
|
|
590
|
+
return resolved.isRef() ? resolved.isReadOnly(lookupsPerformed + 1) : resolved.isReadOnly();
|
|
250
591
|
}
|
|
251
592
|
/**
|
|
252
|
-
*
|
|
253
|
-
*
|
|
254
|
-
*
|
|
593
|
+
* Whether the value is `writeOnly` at this site: on this reference, or on
|
|
594
|
+
* what it points to, as {@link isReadOnly} reads `readOnly`.
|
|
595
|
+
*
|
|
596
|
+
* @param lookupsPerformed - Internal counter that stops a chain of references with no schema
|
|
255
597
|
*/
|
|
256
|
-
|
|
257
|
-
|
|
598
|
+
isWriteOnly(lookupsPerformed = 0) {
|
|
599
|
+
if (this.writeOnly === true) {
|
|
600
|
+
return true;
|
|
601
|
+
}
|
|
602
|
+
if (lookupsPerformed >= MAX_LOOKUPS) {
|
|
603
|
+
return false;
|
|
604
|
+
}
|
|
605
|
+
const resolved = this.resolveOnce();
|
|
606
|
+
return resolved.isRef() ? resolved.isWriteOnly(lookupsPerformed + 1) : resolved.isWriteOnly();
|
|
258
607
|
}
|
|
259
608
|
/**
|
|
260
609
|
* Returns the discriminated parsed document this ref resolves
|
|
@@ -265,6 +614,12 @@ export class OasRef extends OasBase {
|
|
|
265
614
|
get document() {
|
|
266
615
|
return __classPrivateFieldGet(this, _OasRef_document, "f");
|
|
267
616
|
}
|
|
617
|
+
/**
|
|
618
|
+
* The reference as JSON Schema. With `resolve`, the schema at this site,
|
|
619
|
+
* with the keywords next to the reference applied. Without it, only
|
|
620
|
+
* `{ $ref }`: the keywords next to the reference are not written yet
|
|
621
|
+
* (skmtc/skmtc#338).
|
|
622
|
+
*/
|
|
268
623
|
toJsonSchema({ resolve }) {
|
|
269
624
|
if (resolve) {
|
|
270
625
|
const resolved = this.resolve().toJsonSchema({ resolve });
|
|
@@ -275,13 +630,46 @@ export class OasRef extends OasBase {
|
|
|
275
630
|
};
|
|
276
631
|
return ref;
|
|
277
632
|
}
|
|
633
|
+
/** `{ $ref }` only, as {@link toJsonSchema} without `resolve` (skmtc/skmtc#338). */
|
|
278
634
|
toJSON() {
|
|
279
635
|
return {
|
|
280
636
|
$ref: `#/components/${refTypeToPluralPath(this.refType)}/${this.toRefName()}`
|
|
281
637
|
};
|
|
282
638
|
}
|
|
283
639
|
}
|
|
284
|
-
|
|
640
|
+
_OasRef_document = new WeakMap(), _OasRef_resolution = new WeakMap(), _OasRef_instances = new WeakSet(), _OasRef_toResolution = function _OasRef_toResolution(lookupsPerformed) {
|
|
641
|
+
if (__classPrivateFieldGet(this, _OasRef_resolution, "f") !== undefined) {
|
|
642
|
+
return __classPrivateFieldGet(this, _OasRef_resolution, "f");
|
|
643
|
+
}
|
|
644
|
+
if (lookupsPerformed >= MAX_LOOKUPS) {
|
|
645
|
+
throw new Error('Max lookups reached');
|
|
646
|
+
}
|
|
647
|
+
const resolved = this.resolveOnce();
|
|
648
|
+
const target = resolved.isRef() ? resolved.resolve(lookupsPerformed + 1) : resolved;
|
|
649
|
+
const resolution = { target, resolved: __classPrivateFieldGet(this, _OasRef_instances, "m", _OasRef_toSiteSchema).call(this, target) };
|
|
650
|
+
__classPrivateFieldSet(this, _OasRef_resolution, resolution, "f");
|
|
651
|
+
return resolution;
|
|
652
|
+
}, _OasRef_toSiteSchema = function _OasRef_toSiteSchema(target) {
|
|
653
|
+
// Widened from the generic ResolvedRef<T>, so `oasType` narrows it.
|
|
654
|
+
const component = target;
|
|
655
|
+
// `oasType` narrows the target and `isSchemaRef()` this reference;
|
|
656
|
+
// resolveOnce() has checked that the two agree.
|
|
657
|
+
if (!this.hasSiblings() || component.oasType !== 'schema' || !this.isSchemaRef()) {
|
|
658
|
+
return target;
|
|
659
|
+
}
|
|
660
|
+
const copy = component.clone(this);
|
|
661
|
+
// A schema's copy is a schema of the same class. TypeScript cannot relate
|
|
662
|
+
// OasSchema to ResolvedRef<T> for a generic T, as in resolveOnce().
|
|
663
|
+
return changesTarget(copy, component, this) ? copy : target;
|
|
664
|
+
}, _OasRef_resolveOasOnce = function _OasRef_resolveOasOnce(document, refName) {
|
|
665
|
+
// A `#/components/<bucket>/<name>` ref names its bucket. A request body
|
|
666
|
+
// that is a `$ref` to `#/components/schemas/Pet` names a schema, so it is
|
|
667
|
+
// never looked up in the request bodies.
|
|
668
|
+
const bucket = /^#\/components\/([^/]+)\//.exec(this.$ref)?.[1];
|
|
669
|
+
const expected = refTypeToPluralPath(this.refType);
|
|
670
|
+
if (bucket !== undefined && bucket !== expected) {
|
|
671
|
+
throw new Error(`Ref type mismatch for "${this.$ref}". Expected a ref into "components/${expected}" but it names one in "components/${bucket}"`);
|
|
672
|
+
}
|
|
285
673
|
const c = document.components;
|
|
286
674
|
const refType = this.refType;
|
|
287
675
|
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
|
}
|