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