@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/link/Link.js
CHANGED
|
@@ -90,6 +90,14 @@ class OasLink {
|
|
|
90
90
|
isRef() {
|
|
91
91
|
return false;
|
|
92
92
|
}
|
|
93
|
+
/** Always `false`: `readOnly` is a schema keyword. */
|
|
94
|
+
isReadOnly() {
|
|
95
|
+
return false;
|
|
96
|
+
}
|
|
97
|
+
/** Always `false`: `writeOnly` is a schema keyword. */
|
|
98
|
+
isWriteOnly() {
|
|
99
|
+
return false;
|
|
100
|
+
}
|
|
93
101
|
/** Returns itself */
|
|
94
102
|
resolve() {
|
|
95
103
|
return this;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import "../../_dnt.polyfills.js";
|
|
2
|
+
import type { OasUnknown } from '../unknown/Unknown.js';
|
|
2
3
|
import type { SchemaPath } from '../../types/SchemaPath.js';
|
|
3
4
|
import type { OasRef } from '../ref/Ref.js';
|
|
4
5
|
import type { OpenAPIV3 } from 'openapi-types';
|
|
@@ -116,8 +117,26 @@ export declare class OasNumber<Nullable extends boolean | undefined = boolean |
|
|
|
116
117
|
* Whether the number is deprecated.
|
|
117
118
|
*/
|
|
118
119
|
deprecated: boolean | undefined;
|
|
120
|
+
/**
|
|
121
|
+
* The schema's `not`, kept as an `OasUnknown` under `client.json`
|
|
122
|
+
* `system.not: unknown`: the document says "not something", and core does
|
|
123
|
+
* not read what. `undefined` otherwise.
|
|
124
|
+
*/
|
|
125
|
+
not: OasUnknown | undefined;
|
|
119
126
|
constructor(fields?: NumberFields<Nullable>, context?: ParseContextType);
|
|
120
127
|
isRef(): this is OasRef<'schema'>;
|
|
128
|
+
/** Whether the value is `readOnly`: sent by the API only, never in a request. */
|
|
129
|
+
isReadOnly(): boolean;
|
|
130
|
+
/** Whether the value is `writeOnly`: sent in a request only, never by the API. */
|
|
131
|
+
isWriteOnly(): boolean;
|
|
132
|
+
/**
|
|
133
|
+
* A copy of this schema with what `ref` adds at its site applied: its
|
|
134
|
+
* `nullable`, `readOnly`, `writeOnly` and the keywords next to it (`SiblingKeywords`) that
|
|
135
|
+
* this type takes, a sibling's value winning. A value that does not fit
|
|
136
|
+
* this type is left out (the parser reports it). For `OasRef.resolve()`.
|
|
137
|
+
* This schema does not change, and the copy shares its child schemas.
|
|
138
|
+
*/
|
|
139
|
+
clone(ref?: OasRef<'schema'>): OasNumber;
|
|
121
140
|
traverse(path: SchemaPath): OasSchema | OasRef<'schema'>;
|
|
122
141
|
resolve(): OasNumber<Nullable>;
|
|
123
142
|
resolveOnce(): OasNumber<Nullable>;
|
|
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.OasNumber = void 0;
|
|
4
4
|
require("../../_dnt.polyfills.js");
|
|
5
5
|
const traverseSchema_js_1 = require("../schemaPath/traverseSchema.js");
|
|
6
|
+
const siblings_js_1 = require("../schema/siblings.js");
|
|
6
7
|
const OasBase_js_1 = require("../../types/OasBase.js");
|
|
7
8
|
class OasNumber extends OasBase_js_1.OasBase {
|
|
8
9
|
constructor(fields = {}, context) {
|
|
@@ -168,6 +169,17 @@ class OasNumber extends OasBase_js_1.OasBase {
|
|
|
168
169
|
writable: true,
|
|
169
170
|
value: void 0
|
|
170
171
|
});
|
|
172
|
+
/**
|
|
173
|
+
* The schema's `not`, kept as an `OasUnknown` under `client.json`
|
|
174
|
+
* `system.not: unknown`: the document says "not something", and core does
|
|
175
|
+
* not read what. `undefined` otherwise.
|
|
176
|
+
*/
|
|
177
|
+
Object.defineProperty(this, "not", {
|
|
178
|
+
enumerable: true,
|
|
179
|
+
configurable: true,
|
|
180
|
+
writable: true,
|
|
181
|
+
value: undefined
|
|
182
|
+
});
|
|
171
183
|
this.title = fields.title;
|
|
172
184
|
this.description = fields.description;
|
|
173
185
|
this.nullable = fields.nullable;
|
|
@@ -188,6 +200,43 @@ class OasNumber extends OasBase_js_1.OasBase {
|
|
|
188
200
|
isRef() {
|
|
189
201
|
return false;
|
|
190
202
|
}
|
|
203
|
+
/** Whether the value is `readOnly`: sent by the API only, never in a request. */
|
|
204
|
+
isReadOnly() {
|
|
205
|
+
return this.readOnly === true;
|
|
206
|
+
}
|
|
207
|
+
/** Whether the value is `writeOnly`: sent in a request only, never by the API. */
|
|
208
|
+
isWriteOnly() {
|
|
209
|
+
return this.writeOnly === true;
|
|
210
|
+
}
|
|
211
|
+
/**
|
|
212
|
+
* A copy of this schema with what `ref` adds at its site applied: its
|
|
213
|
+
* `nullable`, `readOnly`, `writeOnly` and the keywords next to it (`SiblingKeywords`) that
|
|
214
|
+
* this type takes, a sibling's value winning. A value that does not fit
|
|
215
|
+
* this type is left out (the parser reports it). For `OasRef.resolve()`.
|
|
216
|
+
* This schema does not change, and the copy shares its child schemas.
|
|
217
|
+
*/
|
|
218
|
+
clone(ref) {
|
|
219
|
+
const nullable = this.nullable || ref?.nullable || undefined;
|
|
220
|
+
const copy = new OasNumber({
|
|
221
|
+
...(0, siblings_js_1.toSiblingAnnotations)(this, ref),
|
|
222
|
+
example: (0, siblings_js_1.toSiblingValue)(ref?.example, siblings_js_1.isNumberValue) ?? this.example,
|
|
223
|
+
nullable,
|
|
224
|
+
default: (0, siblings_js_1.toSiblingValue)(ref?.default, siblings_js_1.isNumberValue) ?? this.default,
|
|
225
|
+
enums: (0, siblings_js_1.toSiblingEnums)(ref?.enums, siblings_js_1.isNumberValue, nullable) ?? this.enums,
|
|
226
|
+
format: (0, siblings_js_1.toSiblingValue)(ref?.format, siblings_js_1.isNumberFormat) ?? this.format,
|
|
227
|
+
multipleOf: ref?.multipleOf ?? this.multipleOf,
|
|
228
|
+
maximum: ref?.maximum ?? this.maximum,
|
|
229
|
+
exclusiveMaximum: ref?.exclusiveMaximum ?? this.exclusiveMaximum,
|
|
230
|
+
minimum: ref?.minimum ?? this.minimum,
|
|
231
|
+
exclusiveMinimum: ref?.exclusiveMinimum ?? this.exclusiveMinimum,
|
|
232
|
+
readOnly: this.readOnly || ref?.readOnly || undefined,
|
|
233
|
+
writeOnly: this.writeOnly || ref?.writeOnly || undefined,
|
|
234
|
+
deprecated: ref?.deprecated ?? this.deprecated,
|
|
235
|
+
});
|
|
236
|
+
copy.stackTrail = this.stackTrail;
|
|
237
|
+
copy.not = this.not;
|
|
238
|
+
return copy;
|
|
239
|
+
}
|
|
191
240
|
traverse(path) {
|
|
192
241
|
return (0, traverseSchema_js_1.traverseSchema)(this, path);
|
|
193
242
|
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import "../../_dnt.polyfills.js";
|
|
2
|
+
import type { OasUnknown } from '../unknown/Unknown.js';
|
|
2
3
|
import type { SchemaPath } from '../../types/SchemaPath.js';
|
|
3
4
|
import type { OasRef } from '../ref/Ref.js';
|
|
4
5
|
import type { OasExternalDocs } from '../externalDocs/ExternalDocs.js';
|
|
@@ -222,6 +223,12 @@ export declare class OasObject<Nullable extends boolean | undefined = boolean |
|
|
|
222
223
|
* });
|
|
223
224
|
* ```
|
|
224
225
|
*/
|
|
226
|
+
/**
|
|
227
|
+
* The schema's `not`, kept as an `OasUnknown` under `client.json`
|
|
228
|
+
* `system.not: unknown`: the document says "not something", and core does
|
|
229
|
+
* not read what. `undefined` otherwise.
|
|
230
|
+
*/
|
|
231
|
+
not: OasUnknown | undefined;
|
|
225
232
|
constructor(fields?: OasObjectFields<Nullable>, context?: ParseContextType);
|
|
226
233
|
/**
|
|
227
234
|
* Creates a new empty OasObject with no properties.
|
|
@@ -327,6 +334,18 @@ export declare class OasObject<Nullable extends boolean | undefined = boolean |
|
|
|
327
334
|
*/
|
|
328
335
|
removeProperty(name: string): OasObject;
|
|
329
336
|
isRef(): this is OasRef<'schema'>;
|
|
337
|
+
/** Whether the value is `readOnly`: sent by the API only, never in a request. */
|
|
338
|
+
isReadOnly(): boolean;
|
|
339
|
+
/** Whether the value is `writeOnly`: sent in a request only, never by the API. */
|
|
340
|
+
isWriteOnly(): boolean;
|
|
341
|
+
/**
|
|
342
|
+
* A copy of this schema with what `ref` adds at its site applied: its
|
|
343
|
+
* `nullable`, `readOnly`, `writeOnly` and the keywords next to it (`SiblingKeywords`) that
|
|
344
|
+
* this type takes, a sibling's value winning. A value that does not fit
|
|
345
|
+
* this type is left out (the parser reports it). For `OasRef.resolve()`.
|
|
346
|
+
* This schema does not change, and the copy shares its child schemas.
|
|
347
|
+
*/
|
|
348
|
+
clone(ref?: OasRef<'schema'>): OasObject;
|
|
330
349
|
traverse(path: SchemaPath): OasSchema | OasRef<'schema'>;
|
|
331
350
|
resolve(): OasObject;
|
|
332
351
|
resolveOnce(): OasObject;
|
|
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.OasObject = void 0;
|
|
4
4
|
require("../../_dnt.polyfills.js");
|
|
5
5
|
const traverseSchema_js_1 = require("../schemaPath/traverseSchema.js");
|
|
6
|
+
const siblings_js_1 = require("../schema/siblings.js");
|
|
6
7
|
const OasBase_js_1 = require("../../types/OasBase.js");
|
|
7
8
|
/**
|
|
8
9
|
* Represents an object schema in the OpenAPI Specification.
|
|
@@ -90,24 +91,6 @@ const OasBase_js_1 = require("../../types/OasBase.js");
|
|
|
90
91
|
* ```
|
|
91
92
|
*/
|
|
92
93
|
class OasObject extends OasBase_js_1.OasBase {
|
|
93
|
-
/**
|
|
94
|
-
* Creates a new OasObject instance.
|
|
95
|
-
*
|
|
96
|
-
* @param fields - Object configuration fields
|
|
97
|
-
*
|
|
98
|
-
* @example
|
|
99
|
-
* ```typescript
|
|
100
|
-
* const userSchema = new OasObject({
|
|
101
|
-
* title: 'User',
|
|
102
|
-
* properties: {
|
|
103
|
-
* id: new OasString({ title: 'ID' }),
|
|
104
|
-
* name: new OasString({ title: 'Name' })
|
|
105
|
-
* },
|
|
106
|
-
* required: ['id'],
|
|
107
|
-
* additionalProperties: false
|
|
108
|
-
* });
|
|
109
|
-
* ```
|
|
110
|
-
*/
|
|
111
94
|
constructor(fields = {}, context) {
|
|
112
95
|
super(context);
|
|
113
96
|
/**
|
|
@@ -261,6 +244,35 @@ class OasObject extends OasBase_js_1.OasBase {
|
|
|
261
244
|
writable: true,
|
|
262
245
|
value: void 0
|
|
263
246
|
});
|
|
247
|
+
/**
|
|
248
|
+
* Creates a new OasObject instance.
|
|
249
|
+
*
|
|
250
|
+
* @param fields - Object configuration fields
|
|
251
|
+
*
|
|
252
|
+
* @example
|
|
253
|
+
* ```typescript
|
|
254
|
+
* const userSchema = new OasObject({
|
|
255
|
+
* title: 'User',
|
|
256
|
+
* properties: {
|
|
257
|
+
* id: new OasString({ title: 'ID' }),
|
|
258
|
+
* name: new OasString({ title: 'Name' })
|
|
259
|
+
* },
|
|
260
|
+
* required: ['id'],
|
|
261
|
+
* additionalProperties: false
|
|
262
|
+
* });
|
|
263
|
+
* ```
|
|
264
|
+
*/
|
|
265
|
+
/**
|
|
266
|
+
* The schema's `not`, kept as an `OasUnknown` under `client.json`
|
|
267
|
+
* `system.not: unknown`: the document says "not something", and core does
|
|
268
|
+
* not read what. `undefined` otherwise.
|
|
269
|
+
*/
|
|
270
|
+
Object.defineProperty(this, "not", {
|
|
271
|
+
enumerable: true,
|
|
272
|
+
configurable: true,
|
|
273
|
+
writable: true,
|
|
274
|
+
value: undefined
|
|
275
|
+
});
|
|
264
276
|
this.title = fields.title;
|
|
265
277
|
this.description = fields.description;
|
|
266
278
|
this.externalDocs = fields.externalDocs;
|
|
@@ -274,6 +286,7 @@ class OasObject extends OasBase_js_1.OasBase {
|
|
|
274
286
|
this.maxProperties = fields.maxProperties;
|
|
275
287
|
this.minProperties = fields.minProperties;
|
|
276
288
|
this.readOnly = fields.readOnly;
|
|
289
|
+
this.writeOnly = fields.writeOnly;
|
|
277
290
|
this.deprecated = fields.deprecated;
|
|
278
291
|
this.enums = fields.enums;
|
|
279
292
|
}
|
|
@@ -419,6 +432,43 @@ class OasObject extends OasBase_js_1.OasBase {
|
|
|
419
432
|
isRef() {
|
|
420
433
|
return false;
|
|
421
434
|
}
|
|
435
|
+
/** Whether the value is `readOnly`: sent by the API only, never in a request. */
|
|
436
|
+
isReadOnly() {
|
|
437
|
+
return this.readOnly === true;
|
|
438
|
+
}
|
|
439
|
+
/** Whether the value is `writeOnly`: sent in a request only, never by the API. */
|
|
440
|
+
isWriteOnly() {
|
|
441
|
+
return this.writeOnly === true;
|
|
442
|
+
}
|
|
443
|
+
/**
|
|
444
|
+
* A copy of this schema with what `ref` adds at its site applied: its
|
|
445
|
+
* `nullable`, `readOnly`, `writeOnly` and the keywords next to it (`SiblingKeywords`) that
|
|
446
|
+
* this type takes, a sibling's value winning. A value that does not fit
|
|
447
|
+
* this type is left out (the parser reports it). For `OasRef.resolve()`.
|
|
448
|
+
* This schema does not change, and the copy shares its child schemas.
|
|
449
|
+
*/
|
|
450
|
+
clone(ref) {
|
|
451
|
+
const nullable = this.nullable || ref?.nullable || undefined;
|
|
452
|
+
const copy = new OasObject({
|
|
453
|
+
...(0, siblings_js_1.toSiblingAnnotations)(this, ref),
|
|
454
|
+
example: (0, siblings_js_1.toSiblingValue)(ref?.example, siblings_js_1.isObjectValue) ?? this.example,
|
|
455
|
+
externalDocs: this.externalDocs,
|
|
456
|
+
properties: ref?.properties === undefined ? (this.properties ?? undefined) : { ...this.properties, ...ref.properties },
|
|
457
|
+
required: ref?.required === undefined ? this.required : [...new Set([...(this.required ?? []), ...ref.required])],
|
|
458
|
+
additionalProperties: ref?.additionalProperties ?? this.additionalProperties,
|
|
459
|
+
nullable,
|
|
460
|
+
default: (0, siblings_js_1.toSiblingValue)(ref?.default, siblings_js_1.isObjectValue) ?? this.default,
|
|
461
|
+
maxProperties: ref?.maxProperties ?? this.maxProperties,
|
|
462
|
+
minProperties: ref?.minProperties ?? this.minProperties,
|
|
463
|
+
readOnly: this.readOnly || ref?.readOnly || undefined,
|
|
464
|
+
writeOnly: this.writeOnly || ref?.writeOnly || undefined,
|
|
465
|
+
deprecated: ref?.deprecated ?? this.deprecated,
|
|
466
|
+
enums: (0, siblings_js_1.toSiblingEnums)(ref?.enums, siblings_js_1.isObjectValue, nullable) ?? this.enums,
|
|
467
|
+
});
|
|
468
|
+
copy.stackTrail = this.stackTrail;
|
|
469
|
+
copy.not = this.not;
|
|
470
|
+
return copy;
|
|
471
|
+
}
|
|
422
472
|
traverse(path) {
|
|
423
473
|
return (0, traverseSchema_js_1.traverseSchema)(this, path);
|
|
424
474
|
}
|
|
@@ -147,7 +147,14 @@ export declare class OasOperation extends OasBase {
|
|
|
147
147
|
*/
|
|
148
148
|
traverse(path: SchemaPath, mediaType?: string): OasSchema | OasRef<'schema'>;
|
|
149
149
|
/**
|
|
150
|
-
* Resolve all parameters and optionally filter by location
|
|
150
|
+
* Resolve all parameters and optionally filter by location.
|
|
151
|
+
*
|
|
152
|
+
* As OpenAPI defines them: the path item's parameters apply to each of its
|
|
153
|
+
* operations, and an operation's own parameter with the same name and
|
|
154
|
+
* location replaces the path item's. The path item's come first. A
|
|
155
|
+
* reference that names nothing (kept under `system.danglingRefs: keep`) is
|
|
156
|
+
* left out: it has no name or location, and the parser logged a
|
|
157
|
+
* `DANGLING_REF` warning for it.
|
|
151
158
|
*
|
|
152
159
|
* @param filter - only include parameters from specified locations
|
|
153
160
|
* @returns
|
|
@@ -6,6 +6,7 @@ const traverseSchema_js_1 = require("../schemaPath/traverseSchema.js");
|
|
|
6
6
|
const Object_js_1 = require("../object/Object.js");
|
|
7
7
|
const toPrimaryResponseCode_js_1 = require("../response/toPrimaryResponseCode.js");
|
|
8
8
|
const OasBase_js_1 = require("../../types/OasBase.js");
|
|
9
|
+
const toEffectiveParameters_js_1 = require("./toEffectiveParameters.js");
|
|
9
10
|
class OasOperation extends OasBase_js_1.OasBase {
|
|
10
11
|
/**
|
|
11
12
|
* Creates a new OasOperation instance from operation field data.
|
|
@@ -221,15 +222,20 @@ class OasOperation extends OasBase_js_1.OasBase {
|
|
|
221
222
|
return (0, traverseSchema_js_1.traverseSchema)(rootSchema, rest);
|
|
222
223
|
}
|
|
223
224
|
/**
|
|
224
|
-
* Resolve all parameters and optionally filter by location
|
|
225
|
+
* Resolve all parameters and optionally filter by location.
|
|
226
|
+
*
|
|
227
|
+
* As OpenAPI defines them: the path item's parameters apply to each of its
|
|
228
|
+
* operations, and an operation's own parameter with the same name and
|
|
229
|
+
* location replaces the path item's. The path item's come first. A
|
|
230
|
+
* reference that names nothing (kept under `system.danglingRefs: keep`) is
|
|
231
|
+
* left out: it has no name or location, and the parser logged a
|
|
232
|
+
* `DANGLING_REF` warning for it.
|
|
225
233
|
*
|
|
226
234
|
* @param filter - only include parameters from specified locations
|
|
227
235
|
* @returns
|
|
228
236
|
*/
|
|
229
237
|
toParams(filter) {
|
|
230
|
-
return (this.parameters
|
|
231
|
-
?.map(param => param.resolve())
|
|
232
|
-
.filter(param => (filter?.length ? filter.includes(param.location) : true)) ?? []);
|
|
238
|
+
return (0, toEffectiveParameters_js_1.toResolvedParameters)((0, toEffectiveParameters_js_1.toEffectiveParameters)({ own: this.parameters, shared: this.pathItem?.parameters })).filter(param => (filter?.length ? filter.includes(param.location) : true));
|
|
233
239
|
}
|
|
234
240
|
/**
|
|
235
241
|
* Creates an OAS object representation of operation parameters.
|
|
@@ -254,12 +260,19 @@ class OasOperation extends OasBase_js_1.OasBase {
|
|
|
254
260
|
* @returns OpenAPI v3 operation object
|
|
255
261
|
*/
|
|
256
262
|
toJsonSchema(options) {
|
|
263
|
+
const parameters = (0, toEffectiveParameters_js_1.toEffectiveParameters)({
|
|
264
|
+
own: this.parameters,
|
|
265
|
+
shared: this.pathItem?.parameters
|
|
266
|
+
});
|
|
257
267
|
return {
|
|
258
268
|
tags: this.tags,
|
|
259
269
|
summary: this.summary,
|
|
260
270
|
description: this.description,
|
|
261
271
|
operationId: this.operationId,
|
|
262
|
-
parameters:
|
|
272
|
+
// The path item's parameters too: the operation is written on its own.
|
|
273
|
+
parameters: parameters.length > 0 || this.parameters !== undefined
|
|
274
|
+
? parameters.map(param => param.toJsonSchema(options))
|
|
275
|
+
: undefined,
|
|
263
276
|
requestBody: this.requestBody?.toJsonSchema(options),
|
|
264
277
|
responses: Object.fromEntries(Object.entries(this.responses).map(([key, value]) => [key, value.toJsonSchema(options)])),
|
|
265
278
|
security: this.security?.map(security => security.toJsonSchema()),
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { OasParameter } from '../parameter/Parameter.js';
|
|
2
|
+
import type { OasRef } from '../ref/Ref.js';
|
|
3
|
+
type Parameter = OasParameter | OasRef<'parameter'>;
|
|
4
|
+
type ToEffectiveParametersArgs = {
|
|
5
|
+
/** The operation's own parameters. */
|
|
6
|
+
own: Parameter[] | undefined;
|
|
7
|
+
/** The parameters of the operation's path item. */
|
|
8
|
+
shared: Parameter[] | undefined;
|
|
9
|
+
};
|
|
10
|
+
/**
|
|
11
|
+
* The parameters that apply to an operation or webhook, as OpenAPI defines
|
|
12
|
+
* them: the path item's first, then its own. An own parameter with the same
|
|
13
|
+
* name and location replaces the path item's. References stay references.
|
|
14
|
+
* A reference that names nothing (kept under `system.danglingRefs: keep`)
|
|
15
|
+
* has no name or location, so it replaces nothing and nothing replaces it.
|
|
16
|
+
*/
|
|
17
|
+
export declare const toEffectiveParameters: ({ own, shared }: ToEffectiveParametersArgs) => Parameter[];
|
|
18
|
+
/**
|
|
19
|
+
* Resolves each parameter. A reference that names nothing is left out: it
|
|
20
|
+
* has no name or location to render, and the parser logged a `DANGLING_REF`
|
|
21
|
+
* warning for it.
|
|
22
|
+
*/
|
|
23
|
+
export declare const toResolvedParameters: (parameters: Parameter[]) => OasParameter[];
|
|
24
|
+
export {};
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.toResolvedParameters = exports.toEffectiveParameters = void 0;
|
|
4
|
+
const DanglingRefError_js_1 = require("../ref/DanglingRefError.js");
|
|
5
|
+
/**
|
|
6
|
+
* The parameters that apply to an operation or webhook, as OpenAPI defines
|
|
7
|
+
* them: the path item's first, then its own. An own parameter with the same
|
|
8
|
+
* name and location replaces the path item's. References stay references.
|
|
9
|
+
* A reference that names nothing (kept under `system.danglingRefs: keep`)
|
|
10
|
+
* has no name or location, so it replaces nothing and nothing replaces it.
|
|
11
|
+
*/
|
|
12
|
+
const toEffectiveParameters = ({ own = [], shared = [] }) => {
|
|
13
|
+
const ownKeys = new Set(own.map(toParameterKey));
|
|
14
|
+
return [
|
|
15
|
+
...shared.filter(parameter => {
|
|
16
|
+
const key = toParameterKey(parameter);
|
|
17
|
+
return key === undefined || !ownKeys.has(key);
|
|
18
|
+
}),
|
|
19
|
+
...own
|
|
20
|
+
];
|
|
21
|
+
};
|
|
22
|
+
exports.toEffectiveParameters = toEffectiveParameters;
|
|
23
|
+
/**
|
|
24
|
+
* Resolves each parameter. A reference that names nothing is left out: it
|
|
25
|
+
* has no name or location to render, and the parser logged a `DANGLING_REF`
|
|
26
|
+
* warning for it.
|
|
27
|
+
*/
|
|
28
|
+
const toResolvedParameters = (parameters) => parameters.flatMap(parameter => {
|
|
29
|
+
const resolved = toResolvedParameter(parameter);
|
|
30
|
+
return resolved === undefined ? [] : [resolved];
|
|
31
|
+
});
|
|
32
|
+
exports.toResolvedParameters = toResolvedParameters;
|
|
33
|
+
const toParameterKey = (parameter) => {
|
|
34
|
+
const resolved = toResolvedParameter(parameter);
|
|
35
|
+
return resolved === undefined ? undefined : `${resolved.location}:${resolved.name}`;
|
|
36
|
+
};
|
|
37
|
+
const toResolvedParameter = (parameter) => {
|
|
38
|
+
try {
|
|
39
|
+
return parameter.resolve();
|
|
40
|
+
}
|
|
41
|
+
catch (error) {
|
|
42
|
+
if (DanglingRefError_js_1.DanglingRefError.is(error)) {
|
|
43
|
+
return undefined;
|
|
44
|
+
}
|
|
45
|
+
throw error;
|
|
46
|
+
}
|
|
47
|
+
};
|
|
@@ -224,6 +224,10 @@ export declare class OasParameter extends OasBase {
|
|
|
224
224
|
* @returns Always false since this is a concrete parameter instance, not a reference
|
|
225
225
|
*/
|
|
226
226
|
isRef(): this is OasRef<'parameter'>;
|
|
227
|
+
/** Always `false`: `readOnly` is a schema keyword. */
|
|
228
|
+
isReadOnly(): boolean;
|
|
229
|
+
/** Always `false`: `writeOnly` is a schema keyword. */
|
|
230
|
+
isWriteOnly(): boolean;
|
|
227
231
|
/**
|
|
228
232
|
* Resolves this parameter object.
|
|
229
233
|
*
|
|
@@ -276,6 +276,14 @@ class OasParameter extends OasBase_js_1.OasBase {
|
|
|
276
276
|
isRef() {
|
|
277
277
|
return false;
|
|
278
278
|
}
|
|
279
|
+
/** Always `false`: `readOnly` is a schema keyword. */
|
|
280
|
+
isReadOnly() {
|
|
281
|
+
return false;
|
|
282
|
+
}
|
|
283
|
+
/** Always `false`: `writeOnly` is a schema keyword. */
|
|
284
|
+
isWriteOnly() {
|
|
285
|
+
return false;
|
|
286
|
+
}
|
|
279
287
|
/**
|
|
280
288
|
* Resolves this parameter object.
|
|
281
289
|
*
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Thrown when a reference that names nothing in the document is resolved.
|
|
3
|
+
*
|
|
4
|
+
* Under `client.json` `system.danglingRefs: strict` (the default) the parser
|
|
5
|
+
* removes what holds such a reference, so a generator never meets one. Under
|
|
6
|
+
* `keep` the reference stays, and a generator that resolves it can catch
|
|
7
|
+
* this error and render something else in its place. Test for it with
|
|
8
|
+
* {@link DanglingRefError.is}, not `instanceof`.
|
|
9
|
+
*/
|
|
10
|
+
import "../../_dnt.polyfills.js";
|
|
11
|
+
export declare class DanglingRefError extends Error {
|
|
12
|
+
/** The `$ref`, or the component name, that names nothing. */
|
|
13
|
+
ref: string;
|
|
14
|
+
constructor(ref: string);
|
|
15
|
+
/**
|
|
16
|
+
* True when `error` is a `DanglingRefError`. It reads the error's name,
|
|
17
|
+
* not its class, so it is also true for one thrown by another copy of
|
|
18
|
+
* `@skmtc/core`, such as the copy a generator bundle resolves, where
|
|
19
|
+
* `instanceof` is false.
|
|
20
|
+
*/
|
|
21
|
+
static is(error: unknown): error is DanglingRefError;
|
|
22
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.DanglingRefError = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* Thrown when a reference that names nothing in the document is resolved.
|
|
6
|
+
*
|
|
7
|
+
* Under `client.json` `system.danglingRefs: strict` (the default) the parser
|
|
8
|
+
* removes what holds such a reference, so a generator never meets one. Under
|
|
9
|
+
* `keep` the reference stays, and a generator that resolves it can catch
|
|
10
|
+
* this error and render something else in its place. Test for it with
|
|
11
|
+
* {@link DanglingRefError.is}, not `instanceof`.
|
|
12
|
+
*/
|
|
13
|
+
require("../../_dnt.polyfills.js");
|
|
14
|
+
class DanglingRefError extends Error {
|
|
15
|
+
constructor(ref) {
|
|
16
|
+
super(`Ref "${ref}" names nothing in the document`);
|
|
17
|
+
/** The `$ref`, or the component name, that names nothing. */
|
|
18
|
+
Object.defineProperty(this, "ref", {
|
|
19
|
+
enumerable: true,
|
|
20
|
+
configurable: true,
|
|
21
|
+
writable: true,
|
|
22
|
+
value: void 0
|
|
23
|
+
});
|
|
24
|
+
this.name = 'DanglingRefError';
|
|
25
|
+
this.ref = ref;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* True when `error` is a `DanglingRefError`. It reads the error's name,
|
|
29
|
+
* not its class, so it is also true for one thrown by another copy of
|
|
30
|
+
* `@skmtc/core`, such as the copy a generator bundle resolves, where
|
|
31
|
+
* `instanceof` is false.
|
|
32
|
+
*/
|
|
33
|
+
static is(error) {
|
|
34
|
+
return error instanceof Error && error.name === 'DanglingRefError';
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
exports.DanglingRefError = DanglingRefError;
|