@skmtc/core 0.0.300 → 0.0.302
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.d.ts +2 -2
- package/esm/context/CoreContext.d.ts.map +1 -1
- package/esm/context/CoreContext.js +3 -3
- package/esm/context/GenerateContext.d.ts +2 -2
- package/esm/context/GenerateContext.d.ts.map +1 -1
- package/esm/context/ParseContext.d.ts +14 -6
- package/esm/context/ParseContext.d.ts.map +1 -1
- package/esm/context/ParseContext.js +28 -12
- package/esm/context/StackTrail.d.ts +3 -3
- package/esm/context/StackTrail.d.ts.map +1 -1
- package/esm/context/StackTrail.js +9 -1
- package/esm/helpers/tracer.d.ts +7 -0
- package/esm/helpers/tracer.d.ts.map +1 -0
- package/esm/helpers/tracer.js +6 -0
- package/esm/oas/array/Array.d.ts +2 -12
- package/esm/oas/array/Array.d.ts.map +1 -1
- package/esm/oas/array/Array.js +2 -4
- package/esm/oas/array/toArray.d.ts +3 -5
- package/esm/oas/array/toArray.d.ts.map +1 -1
- package/esm/oas/array/toArray.js +5 -7
- package/esm/oas/boolean/Boolean.d.ts +2 -12
- package/esm/oas/boolean/Boolean.d.ts.map +1 -1
- package/esm/oas/boolean/Boolean.js +2 -4
- package/esm/oas/boolean/toBoolean.d.ts +3 -5
- package/esm/oas/boolean/toBoolean.d.ts.map +1 -1
- package/esm/oas/boolean/toBoolean.js +3 -2
- package/esm/oas/components/Components.d.ts +2 -12
- package/esm/oas/components/Components.d.ts.map +1 -1
- package/esm/oas/components/Components.js +2 -4
- package/esm/oas/components/toComponentsV3.d.ts +3 -5
- package/esm/oas/components/toComponentsV3.d.ts.map +1 -1
- package/esm/oas/components/toComponentsV3.js +10 -22
- package/esm/oas/discriminator/Discriminator.d.ts +2 -12
- package/esm/oas/discriminator/Discriminator.d.ts.map +1 -1
- package/esm/oas/discriminator/Discriminator.js +2 -4
- package/esm/oas/discriminator/toDiscriminatorV3.d.ts +3 -5
- package/esm/oas/discriminator/toDiscriminatorV3.d.ts.map +1 -1
- package/esm/oas/discriminator/toDiscriminatorV3.js +3 -2
- package/esm/oas/document/Document.d.ts +3 -12
- package/esm/oas/document/Document.d.ts.map +1 -1
- package/esm/oas/document/Document.js +20 -4
- package/esm/oas/document/toDocumentFieldsV3.d.ts +10 -0
- package/esm/oas/document/toDocumentFieldsV3.d.ts.map +1 -0
- package/esm/oas/document/toDocumentFieldsV3.js +17 -0
- package/esm/oas/example/Example.d.ts +2 -12
- package/esm/oas/example/Example.d.ts.map +1 -1
- package/esm/oas/example/Example.js +2 -4
- package/esm/oas/example/toExamplesV3.d.ts +6 -11
- package/esm/oas/example/toExamplesV3.d.ts.map +1 -1
- package/esm/oas/example/toExamplesV3.js +18 -17
- package/esm/oas/header/Header.d.ts +2 -12
- package/esm/oas/header/Header.d.ts.map +1 -1
- package/esm/oas/header/Header.js +2 -4
- package/esm/oas/header/toHeadersV3.d.ts +3 -5
- package/esm/oas/header/toHeadersV3.d.ts.map +1 -1
- package/esm/oas/header/toHeadersV3.js +9 -12
- package/esm/oas/info/Info.d.ts +2 -12
- package/esm/oas/info/Info.d.ts.map +1 -1
- package/esm/oas/info/Info.js +2 -4
- package/esm/oas/info/toInfoV3.d.ts +3 -5
- package/esm/oas/info/toInfoV3.d.ts.map +1 -1
- package/esm/oas/info/toInfoV3.js +3 -2
- package/esm/oas/integer/Integer.d.ts +2 -12
- package/esm/oas/integer/Integer.d.ts.map +1 -1
- package/esm/oas/integer/Integer.js +2 -4
- package/esm/oas/integer/toInteger.d.ts +3 -5
- package/esm/oas/integer/toInteger.d.ts.map +1 -1
- package/esm/oas/integer/toInteger.js +3 -2
- package/esm/oas/intersection/Intersection.d.ts +2 -12
- package/esm/oas/intersection/Intersection.d.ts.map +1 -1
- package/esm/oas/intersection/Intersection.js +2 -4
- package/esm/oas/intersection/toIntersection.d.ts +3 -5
- package/esm/oas/intersection/toIntersection.d.ts.map +1 -1
- package/esm/oas/intersection/toIntersection.js +6 -12
- package/esm/oas/mediaType/MediaType.d.ts +2 -12
- package/esm/oas/mediaType/MediaType.d.ts.map +1 -1
- package/esm/oas/mediaType/MediaType.js +2 -4
- package/esm/oas/mediaType/toMediaTypeItemV3.d.ts +7 -11
- package/esm/oas/mediaType/toMediaTypeItemV3.d.ts.map +1 -1
- package/esm/oas/mediaType/toMediaTypeItemV3.js +17 -19
- package/esm/oas/number/Number.d.ts +2 -12
- package/esm/oas/number/Number.d.ts.map +1 -1
- package/esm/oas/number/Number.js +2 -4
- package/esm/oas/number/toNumber.d.ts +3 -5
- package/esm/oas/number/toNumber.d.ts.map +1 -1
- package/esm/oas/number/toNumber.js +3 -2
- package/esm/oas/object/Object.d.ts +5 -15
- package/esm/oas/object/Object.d.ts.map +1 -1
- package/esm/oas/object/Object.js +16 -34
- package/esm/oas/object/toAdditionalPropertiesV3.d.ts +3 -5
- package/esm/oas/object/toAdditionalPropertiesV3.d.ts.map +1 -1
- package/esm/oas/object/toAdditionalPropertiesV3.js +2 -6
- package/esm/oas/object/toObject.d.ts +3 -5
- package/esm/oas/object/toObject.d.ts.map +1 -1
- package/esm/oas/object/toObject.js +7 -10
- package/esm/oas/operation/Operation.d.ts +2 -12
- package/esm/oas/operation/Operation.d.ts.map +1 -1
- package/esm/oas/operation/Operation.js +3 -5
- package/esm/oas/operation/toOperationsV3.d.ts +5 -8
- package/esm/oas/operation/toOperationsV3.d.ts.map +1 -1
- package/esm/oas/operation/toOperationsV3.js +42 -53
- package/esm/oas/parameter/Parameter.d.ts +2 -12
- package/esm/oas/parameter/Parameter.d.ts.map +1 -1
- package/esm/oas/parameter/Parameter.js +3 -5
- package/esm/oas/parameter/toParameterV3.d.ts +7 -11
- package/esm/oas/parameter/toParameterV3.d.ts.map +1 -1
- package/esm/oas/parameter/toParameterV3.js +18 -24
- package/esm/oas/pathItem/PathItem.d.ts +2 -12
- package/esm/oas/pathItem/PathItem.d.ts.map +1 -1
- package/esm/oas/pathItem/PathItem.js +2 -4
- package/esm/oas/pathItem/toPathItemV3.d.ts +3 -5
- package/esm/oas/pathItem/toPathItemV3.d.ts.map +1 -1
- package/esm/oas/pathItem/toPathItemV3.js +5 -7
- package/esm/oas/ref/Ref.d.ts +4 -12
- package/esm/oas/ref/Ref.d.ts.map +1 -1
- package/esm/oas/ref/Ref.js +10 -17
- package/esm/oas/ref/toRefV31.d.ts +3 -5
- package/esm/oas/ref/toRefV31.d.ts.map +1 -1
- package/esm/oas/ref/toRefV31.js +3 -2
- package/esm/oas/requestBody/RequestBody.d.ts +2 -12
- package/esm/oas/requestBody/RequestBody.d.ts.map +1 -1
- package/esm/oas/requestBody/RequestBody.js +2 -4
- package/esm/oas/requestBody/toRequestBodiesV3.d.ts +5 -8
- package/esm/oas/requestBody/toRequestBodiesV3.d.ts.map +1 -1
- package/esm/oas/requestBody/toRequestBodiesV3.js +9 -18
- package/esm/oas/response/Response.d.ts +2 -12
- package/esm/oas/response/Response.d.ts.map +1 -1
- package/esm/oas/response/Response.js +2 -4
- package/esm/oas/response/toResponseV3.d.ts +7 -11
- package/esm/oas/response/toResponseV3.d.ts.map +1 -1
- package/esm/oas/response/toResponseV3.js +11 -13
- package/esm/oas/schema/toSchemasV3.d.ts +9 -14
- package/esm/oas/schema/toSchemasV3.d.ts.map +1 -1
- package/esm/oas/schema/toSchemasV3.js +22 -24
- package/esm/oas/string/String.d.ts +2 -12
- package/esm/oas/string/String.d.ts.map +1 -1
- package/esm/oas/string/String.js +2 -4
- package/esm/oas/string/toString.d.ts +3 -5
- package/esm/oas/string/toString.d.ts.map +1 -1
- package/esm/oas/string/toString.js +3 -2
- package/esm/oas/tag/Tag.d.ts +2 -12
- package/esm/oas/tag/Tag.d.ts.map +1 -1
- package/esm/oas/tag/Tag.js +2 -4
- package/esm/oas/tag/toTagsV3.d.ts +8 -5
- package/esm/oas/tag/toTagsV3.d.ts.map +1 -1
- package/esm/oas/tag/toTagsV3.js +11 -9
- package/esm/oas/union/Union.d.ts +2 -12
- package/esm/oas/union/Union.d.ts.map +1 -1
- package/esm/oas/union/Union.js +2 -4
- package/esm/oas/union/toUnion.d.ts +3 -5
- package/esm/oas/union/toUnion.d.ts.map +1 -1
- package/esm/oas/union/toUnion.js +6 -12
- package/esm/oas/unknown/Unknown.d.ts +2 -12
- package/esm/oas/unknown/Unknown.d.ts.map +1 -1
- package/esm/oas/unknown/Unknown.js +2 -4
- package/esm/oas/unknown/toUnknown.d.ts +3 -5
- package/esm/oas/unknown/toUnknown.d.ts.map +1 -1
- package/esm/oas/unknown/toUnknown.js +3 -2
- package/esm/oas/void/Void.d.ts +3 -13
- package/esm/oas/void/Void.d.ts.map +1 -1
- package/esm/oas/void/Void.js +4 -12
- package/package.json +1 -1
- package/script/context/CoreContext.d.ts +2 -2
- package/script/context/CoreContext.d.ts.map +1 -1
- package/script/context/CoreContext.js +3 -3
- package/script/context/GenerateContext.d.ts +2 -2
- package/script/context/GenerateContext.d.ts.map +1 -1
- package/script/context/ParseContext.d.ts +14 -6
- package/script/context/ParseContext.d.ts.map +1 -1
- package/script/context/ParseContext.js +28 -12
- package/script/context/StackTrail.d.ts +3 -3
- package/script/context/StackTrail.d.ts.map +1 -1
- package/script/context/StackTrail.js +9 -1
- package/script/helpers/tracer.d.ts +7 -0
- package/script/helpers/tracer.d.ts.map +1 -0
- package/script/helpers/tracer.js +10 -0
- package/script/oas/array/Array.d.ts +2 -12
- package/script/oas/array/Array.d.ts.map +1 -1
- package/script/oas/array/Array.js +2 -4
- package/script/oas/array/toArray.d.ts +3 -5
- package/script/oas/array/toArray.d.ts.map +1 -1
- package/script/oas/array/toArray.js +5 -7
- package/script/oas/boolean/Boolean.d.ts +2 -12
- package/script/oas/boolean/Boolean.d.ts.map +1 -1
- package/script/oas/boolean/Boolean.js +2 -4
- package/script/oas/boolean/toBoolean.d.ts +3 -5
- package/script/oas/boolean/toBoolean.d.ts.map +1 -1
- package/script/oas/boolean/toBoolean.js +3 -2
- package/script/oas/components/Components.d.ts +2 -12
- package/script/oas/components/Components.d.ts.map +1 -1
- package/script/oas/components/Components.js +2 -4
- package/script/oas/components/toComponentsV3.d.ts +3 -5
- package/script/oas/components/toComponentsV3.d.ts.map +1 -1
- package/script/oas/components/toComponentsV3.js +10 -22
- package/script/oas/discriminator/Discriminator.d.ts +2 -12
- package/script/oas/discriminator/Discriminator.d.ts.map +1 -1
- package/script/oas/discriminator/Discriminator.js +2 -4
- package/script/oas/discriminator/toDiscriminatorV3.d.ts +3 -5
- package/script/oas/discriminator/toDiscriminatorV3.d.ts.map +1 -1
- package/script/oas/discriminator/toDiscriminatorV3.js +3 -2
- package/script/oas/document/Document.d.ts +3 -12
- package/script/oas/document/Document.d.ts.map +1 -1
- package/script/oas/document/Document.js +20 -4
- package/script/oas/document/toDocumentFieldsV3.d.ts +10 -0
- package/script/oas/document/toDocumentFieldsV3.d.ts.map +1 -0
- package/script/oas/document/toDocumentFieldsV3.js +21 -0
- package/script/oas/example/Example.d.ts +2 -12
- package/script/oas/example/Example.d.ts.map +1 -1
- package/script/oas/example/Example.js +2 -4
- package/script/oas/example/toExamplesV3.d.ts +6 -11
- package/script/oas/example/toExamplesV3.d.ts.map +1 -1
- package/script/oas/example/toExamplesV3.js +18 -17
- package/script/oas/header/Header.d.ts +2 -12
- package/script/oas/header/Header.d.ts.map +1 -1
- package/script/oas/header/Header.js +2 -4
- package/script/oas/header/toHeadersV3.d.ts +3 -5
- package/script/oas/header/toHeadersV3.d.ts.map +1 -1
- package/script/oas/header/toHeadersV3.js +9 -12
- package/script/oas/info/Info.d.ts +2 -12
- package/script/oas/info/Info.d.ts.map +1 -1
- package/script/oas/info/Info.js +2 -4
- package/script/oas/info/toInfoV3.d.ts +3 -5
- package/script/oas/info/toInfoV3.d.ts.map +1 -1
- package/script/oas/info/toInfoV3.js +3 -2
- package/script/oas/integer/Integer.d.ts +2 -12
- package/script/oas/integer/Integer.d.ts.map +1 -1
- package/script/oas/integer/Integer.js +2 -4
- package/script/oas/integer/toInteger.d.ts +3 -5
- package/script/oas/integer/toInteger.d.ts.map +1 -1
- package/script/oas/integer/toInteger.js +3 -2
- package/script/oas/intersection/Intersection.d.ts +2 -12
- package/script/oas/intersection/Intersection.d.ts.map +1 -1
- package/script/oas/intersection/Intersection.js +2 -4
- package/script/oas/intersection/toIntersection.d.ts +3 -5
- package/script/oas/intersection/toIntersection.d.ts.map +1 -1
- package/script/oas/intersection/toIntersection.js +6 -12
- package/script/oas/mediaType/MediaType.d.ts +2 -12
- package/script/oas/mediaType/MediaType.d.ts.map +1 -1
- package/script/oas/mediaType/MediaType.js +2 -4
- package/script/oas/mediaType/toMediaTypeItemV3.d.ts +7 -11
- package/script/oas/mediaType/toMediaTypeItemV3.d.ts.map +1 -1
- package/script/oas/mediaType/toMediaTypeItemV3.js +17 -19
- package/script/oas/number/Number.d.ts +2 -12
- package/script/oas/number/Number.d.ts.map +1 -1
- package/script/oas/number/Number.js +2 -4
- package/script/oas/number/toNumber.d.ts +3 -5
- package/script/oas/number/toNumber.d.ts.map +1 -1
- package/script/oas/number/toNumber.js +3 -2
- package/script/oas/object/Object.d.ts +5 -15
- package/script/oas/object/Object.d.ts.map +1 -1
- package/script/oas/object/Object.js +16 -34
- package/script/oas/object/toAdditionalPropertiesV3.d.ts +3 -5
- package/script/oas/object/toAdditionalPropertiesV3.d.ts.map +1 -1
- package/script/oas/object/toAdditionalPropertiesV3.js +2 -6
- package/script/oas/object/toObject.d.ts +3 -5
- package/script/oas/object/toObject.d.ts.map +1 -1
- package/script/oas/object/toObject.js +7 -10
- package/script/oas/operation/Operation.d.ts +2 -12
- package/script/oas/operation/Operation.d.ts.map +1 -1
- package/script/oas/operation/Operation.js +3 -5
- package/script/oas/operation/toOperationsV3.d.ts +5 -8
- package/script/oas/operation/toOperationsV3.d.ts.map +1 -1
- package/script/oas/operation/toOperationsV3.js +42 -53
- package/script/oas/parameter/Parameter.d.ts +2 -12
- package/script/oas/parameter/Parameter.d.ts.map +1 -1
- package/script/oas/parameter/Parameter.js +3 -5
- package/script/oas/parameter/toParameterV3.d.ts +7 -11
- package/script/oas/parameter/toParameterV3.d.ts.map +1 -1
- package/script/oas/parameter/toParameterV3.js +18 -24
- package/script/oas/pathItem/PathItem.d.ts +2 -12
- package/script/oas/pathItem/PathItem.d.ts.map +1 -1
- package/script/oas/pathItem/PathItem.js +2 -4
- package/script/oas/pathItem/toPathItemV3.d.ts +3 -5
- package/script/oas/pathItem/toPathItemV3.d.ts.map +1 -1
- package/script/oas/pathItem/toPathItemV3.js +5 -7
- package/script/oas/ref/Ref.d.ts +4 -12
- package/script/oas/ref/Ref.d.ts.map +1 -1
- package/script/oas/ref/Ref.js +10 -17
- package/script/oas/ref/toRefV31.d.ts +3 -5
- package/script/oas/ref/toRefV31.d.ts.map +1 -1
- package/script/oas/ref/toRefV31.js +3 -2
- package/script/oas/requestBody/RequestBody.d.ts +2 -12
- package/script/oas/requestBody/RequestBody.d.ts.map +1 -1
- package/script/oas/requestBody/RequestBody.js +2 -4
- package/script/oas/requestBody/toRequestBodiesV3.d.ts +5 -8
- package/script/oas/requestBody/toRequestBodiesV3.d.ts.map +1 -1
- package/script/oas/requestBody/toRequestBodiesV3.js +9 -18
- package/script/oas/response/Response.d.ts +2 -12
- package/script/oas/response/Response.d.ts.map +1 -1
- package/script/oas/response/Response.js +2 -4
- package/script/oas/response/toResponseV3.d.ts +7 -11
- package/script/oas/response/toResponseV3.d.ts.map +1 -1
- package/script/oas/response/toResponseV3.js +11 -13
- package/script/oas/schema/toSchemasV3.d.ts +9 -14
- package/script/oas/schema/toSchemasV3.d.ts.map +1 -1
- package/script/oas/schema/toSchemasV3.js +22 -24
- package/script/oas/string/String.d.ts +2 -12
- package/script/oas/string/String.d.ts.map +1 -1
- package/script/oas/string/String.js +2 -4
- package/script/oas/string/toString.d.ts +3 -5
- package/script/oas/string/toString.d.ts.map +1 -1
- package/script/oas/string/toString.js +3 -2
- package/script/oas/tag/Tag.d.ts +2 -12
- package/script/oas/tag/Tag.d.ts.map +1 -1
- package/script/oas/tag/Tag.js +2 -4
- package/script/oas/tag/toTagsV3.d.ts +8 -5
- package/script/oas/tag/toTagsV3.d.ts.map +1 -1
- package/script/oas/tag/toTagsV3.js +13 -10
- package/script/oas/union/Union.d.ts +2 -12
- package/script/oas/union/Union.d.ts.map +1 -1
- package/script/oas/union/Union.js +2 -4
- package/script/oas/union/toUnion.d.ts +3 -5
- package/script/oas/union/toUnion.d.ts.map +1 -1
- package/script/oas/union/toUnion.js +6 -12
- package/script/oas/unknown/Unknown.d.ts +2 -12
- package/script/oas/unknown/Unknown.d.ts.map +1 -1
- package/script/oas/unknown/Unknown.js +2 -4
- package/script/oas/unknown/toUnknown.d.ts +3 -5
- package/script/oas/unknown/toUnknown.d.ts.map +1 -1
- package/script/oas/unknown/toUnknown.js +3 -2
- package/script/oas/void/Void.d.ts +3 -13
- package/script/oas/void/Void.d.ts.map +1 -1
- package/script/oas/void/Void.js +4 -12
- package/esm/dsl/OasBase.d.ts +0 -15
- package/esm/dsl/OasBase.d.ts.map +0 -1
- package/esm/dsl/OasBase.js +0 -28
- package/esm/oas/document/toDocumentV3.d.ts +0 -12
- package/esm/oas/document/toDocumentV3.d.ts.map +0 -1
- package/esm/oas/document/toDocumentV3.js +0 -24
- package/script/dsl/OasBase.d.ts +0 -15
- package/script/dsl/OasBase.d.ts.map +0 -1
- package/script/dsl/OasBase.js +0 -32
- package/script/oas/document/toDocumentV3.d.ts +0 -12
- package/script/oas/document/toDocumentV3.d.ts.map +0 -1
- package/script/oas/document/toDocumentV3.js +0 -28
|
@@ -6,9 +6,11 @@ const toResponseV3_js_1 = require("../response/toResponseV3.js");
|
|
|
6
6
|
const toParameterV3_js_1 = require("../parameter/toParameterV3.js");
|
|
7
7
|
const Operation_js_1 = require("./Operation.js");
|
|
8
8
|
const toPathItemV3_js_1 = require("../pathItem/toPathItemV3.js");
|
|
9
|
-
const
|
|
9
|
+
const tracer_js_1 = require("../../helpers/tracer.js");
|
|
10
|
+
const toOperationV3 = ({ operation, operationInfo, context }) => {
|
|
10
11
|
const { method, path, pathItem } = operationInfo;
|
|
11
12
|
const { operationId, tags, summary, description, parameters, requestBody, responses, deprecated, ...skipped } = operation;
|
|
13
|
+
context.logSkippedFields(skipped);
|
|
12
14
|
const fields = {
|
|
13
15
|
pathItem,
|
|
14
16
|
path,
|
|
@@ -17,64 +19,51 @@ const toOperationV3 = ({ operation, operationInfo, trail, context }) => {
|
|
|
17
19
|
summary,
|
|
18
20
|
tags,
|
|
19
21
|
description,
|
|
20
|
-
parameters: (0, toParameterV3_js_1.toParameterListV3)({
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
context
|
|
24
|
-
}),
|
|
25
|
-
requestBody: (0, toRequestBodiesV3_js_1.toRequestBodyV3)({
|
|
26
|
-
requestBody,
|
|
27
|
-
trail: trail.add('requestBody'),
|
|
28
|
-
context
|
|
29
|
-
}),
|
|
30
|
-
responses: (0, toResponseV3_js_1.toResponsesV3)({
|
|
31
|
-
responses,
|
|
32
|
-
trail: trail.add('responses'),
|
|
33
|
-
context
|
|
34
|
-
}),
|
|
22
|
+
parameters: (0, tracer_js_1.tracer)(context, 'parameters', () => (0, toParameterV3_js_1.toParameterListV3)({ parameters, context })),
|
|
23
|
+
requestBody: (0, tracer_js_1.tracer)(context, 'requestBody', () => (0, toRequestBodiesV3_js_1.toRequestBodyV3)({ requestBody, context })),
|
|
24
|
+
responses: (0, tracer_js_1.tracer)(context, 'responses', () => (0, toResponseV3_js_1.toResponsesV3)({ responses, context })),
|
|
35
25
|
deprecated
|
|
36
26
|
};
|
|
37
|
-
return new Operation_js_1.OasOperation(
|
|
27
|
+
return new Operation_js_1.OasOperation(fields);
|
|
38
28
|
};
|
|
39
29
|
exports.toOperationV3 = toOperationV3;
|
|
40
|
-
const toOperationsV3 = ({ paths,
|
|
30
|
+
const toOperationsV3 = ({ paths, context }) => {
|
|
41
31
|
return Object.entries(paths).flatMap(([path, pathItem]) => {
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
const { get, post, put, delete: deleteMethod, options, head, patch, trace, ...rest } = pathItem;
|
|
46
|
-
const pathItemObject = (0, toPathItemV3_js_1.toPathItemV3)({
|
|
47
|
-
pathItem: rest,
|
|
48
|
-
trail: trail.addApiPath(path),
|
|
49
|
-
context
|
|
50
|
-
});
|
|
51
|
-
const methodObjects = {
|
|
52
|
-
get,
|
|
53
|
-
post,
|
|
54
|
-
put,
|
|
55
|
-
delete: deleteMethod,
|
|
56
|
-
options,
|
|
57
|
-
head,
|
|
58
|
-
patch,
|
|
59
|
-
trace
|
|
60
|
-
};
|
|
61
|
-
return Object.entries(methodObjects)
|
|
62
|
-
.map(([method, operation]) => {
|
|
63
|
-
if (!operation) {
|
|
64
|
-
return;
|
|
32
|
+
return (0, tracer_js_1.tracer)(context, path, () => {
|
|
33
|
+
if (!pathItem) {
|
|
34
|
+
return [];
|
|
65
35
|
}
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
36
|
+
const { get, post, put, delete: deleteMethod, options, head, patch, trace, ...rest } = pathItem;
|
|
37
|
+
const pathItemObject = (0, toPathItemV3_js_1.toPathItemV3)({ pathItem: rest, context });
|
|
38
|
+
const methodObjects = {
|
|
39
|
+
get,
|
|
40
|
+
post,
|
|
41
|
+
put,
|
|
42
|
+
delete: deleteMethod,
|
|
43
|
+
options,
|
|
44
|
+
head,
|
|
45
|
+
patch,
|
|
46
|
+
trace
|
|
47
|
+
};
|
|
48
|
+
return Object.entries(methodObjects)
|
|
49
|
+
.map(([method, operation]) => {
|
|
50
|
+
return (0, tracer_js_1.tracer)(context, method, () => {
|
|
51
|
+
if (!operation) {
|
|
52
|
+
return;
|
|
53
|
+
}
|
|
54
|
+
return (0, exports.toOperationV3)({
|
|
55
|
+
operation,
|
|
56
|
+
operationInfo: {
|
|
57
|
+
method: method,
|
|
58
|
+
path,
|
|
59
|
+
pathItem: pathItemObject
|
|
60
|
+
},
|
|
61
|
+
context
|
|
62
|
+
});
|
|
63
|
+
});
|
|
64
|
+
})
|
|
65
|
+
.filter((item) => Boolean(item));
|
|
66
|
+
});
|
|
78
67
|
});
|
|
79
68
|
};
|
|
80
69
|
exports.toOperationsV3 = toOperationsV3;
|
|
@@ -1,7 +1,4 @@
|
|
|
1
|
-
import { OasBase } from '../../dsl/OasBase.js';
|
|
2
1
|
import type { OasParameterLocation, OasParameterStyle } from './parameter-types.js';
|
|
3
|
-
import type { Trail } from '../../context/Trail.js';
|
|
4
|
-
import type { CoreContext } from '../../context/CoreContext.js';
|
|
5
2
|
import type { OasMediaType } from '../mediaType/MediaType.js';
|
|
6
3
|
import type { OasRef } from '../ref/Ref.js';
|
|
7
4
|
import type { OasExample } from '../example/Example.js';
|
|
@@ -20,16 +17,10 @@ export type ParameterFields = {
|
|
|
20
17
|
style: OasParameterStyle;
|
|
21
18
|
explode: boolean;
|
|
22
19
|
};
|
|
23
|
-
|
|
24
|
-
fields: ParameterFields;
|
|
25
|
-
trail: Trail;
|
|
26
|
-
skipped: Record<string, unknown>;
|
|
27
|
-
context: CoreContext;
|
|
28
|
-
};
|
|
29
|
-
export declare class OasParameter extends OasBase {
|
|
20
|
+
export declare class OasParameter {
|
|
30
21
|
#private;
|
|
31
22
|
oasType: 'parameter';
|
|
32
|
-
constructor(
|
|
23
|
+
constructor(fields: ParameterFields);
|
|
33
24
|
get name(): string;
|
|
34
25
|
get location(): OasParameterLocation;
|
|
35
26
|
get description(): string | undefined;
|
|
@@ -47,5 +38,4 @@ export declare class OasParameter extends OasBase {
|
|
|
47
38
|
resolveOnce(): OasParameter;
|
|
48
39
|
toSchema(mediaType?: string): OasSchema | OasRef<'schema'> | undefined;
|
|
49
40
|
}
|
|
50
|
-
export {};
|
|
51
41
|
//# sourceMappingURL=Parameter.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Parameter.d.ts","sourceRoot":"","sources":["../../../src/oas/parameter/Parameter.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"Parameter.d.ts","sourceRoot":"","sources":["../../../src/oas/parameter/Parameter.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,oBAAoB,EACpB,iBAAiB,EAClB,MAAM,sBAAsB,CAAA;AAC7B,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAA;AAC7D,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,eAAe,CAAA;AAC3C,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAA;AACvD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAA;AAKpD,MAAM,MAAM,eAAe,GAAG;IAC5B,IAAI,EAAE,MAAM,CAAA;IACZ,QAAQ,EAAE,oBAAoB,CAAA;IAC9B,WAAW,EAAE,MAAM,GAAG,SAAS,CAAA;IAC/B,QAAQ,EAAE,OAAO,GAAG,SAAS,CAAA;IAC7B,UAAU,EAAE,OAAO,GAAG,SAAS,CAAA;IAC/B,eAAe,EAAE,OAAO,GAAG,SAAS,CAAA;IACpC,aAAa,EAAE,OAAO,GAAG,SAAS,CAAA;IAClC,MAAM,EAAE,SAAS,GAAG,MAAM,CAAC,QAAQ,CAAC,GAAG,SAAS,CAAA;IAChD,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,UAAU,GAAG,MAAM,CAAC,SAAS,CAAC,CAAC,GAAG,SAAS,CAAA;IACpE,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,YAAY,CAAC,GAAG,SAAS,CAAA;IACjD,KAAK,EAAE,iBAAiB,CAAA;IACxB,OAAO,EAAE,OAAO,CAAA;CACjB,CAAA;AAED,qBAAa,YAAY;;IACvB,OAAO,EAAE,WAAW,CAAc;gBAGtB,MAAM,EAAE,eAAe;IAInC,IAAI,IAAI,IAAI,MAAM,CAEjB;IAED,IAAI,QAAQ,IAAI,oBAAoB,CAEnC;IAED,IAAI,WAAW,IAAI,MAAM,GAAG,SAAS,CAEpC;IAED,IAAI,QAAQ,IAAI,OAAO,GAAG,SAAS,CAElC;IAED,IAAI,UAAU,IAAI,OAAO,GAAG,SAAS,CAEpC;IAED,IAAI,eAAe,IAAI,OAAO,GAAG,SAAS,CAEzC;IAED,IAAI,MAAM,IAAI,SAAS,GAAG,MAAM,CAAC,QAAQ,CAAC,GAAG,SAAS,CAErD;IAED,IAAI,QAAQ,IAAI,MAAM,CAAC,MAAM,EAAE,UAAU,GAAG,MAAM,CAAC,SAAS,CAAC,CAAC,GAAG,SAAS,CAEzE;IAED,IAAI,OAAO,IAAI,MAAM,CAAC,MAAM,EAAE,YAAY,CAAC,GAAG,SAAS,CAEtD;IAED,IAAI,KAAK,IAAI,iBAAiB,CAE7B;IAED,IAAI,OAAO,IAAI,OAAO,CAErB;IAED,IAAI,aAAa,IAAI,OAAO,GAAG,SAAS,CAEvC;IAED,KAAK,IAAI,IAAI,IAAI,MAAM,CAAC,WAAW,CAAC;IAIpC,OAAO,IAAI,YAAY;IAIvB,WAAW,IAAI,YAAY;IAI3B,QAAQ,CACN,SAAS,GAAE,MAA2B,GACrC,SAAS,GAAG,MAAM,CAAC,QAAQ,CAAC,GAAG,SAAS;CAa5C"}
|
|
@@ -13,10 +13,8 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
|
|
|
13
13
|
var _OasParameter_fields;
|
|
14
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
15
|
exports.OasParameter = void 0;
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
constructor({ fields, trail, skipped, context }) {
|
|
19
|
-
super({ trail, skipped, context });
|
|
16
|
+
class OasParameter {
|
|
17
|
+
constructor(fields) {
|
|
20
18
|
Object.defineProperty(this, "oasType", {
|
|
21
19
|
enumerable: true,
|
|
22
20
|
configurable: true,
|
|
@@ -77,7 +75,7 @@ class OasParameter extends OasBase_js_1.OasBase {
|
|
|
77
75
|
}
|
|
78
76
|
const schema = __classPrivateFieldGet(this, _OasParameter_fields, "f").content?.[mediaType]?.schema;
|
|
79
77
|
if (!schema) {
|
|
80
|
-
throw new Error(`Schema not found for media type ${mediaType}
|
|
78
|
+
throw new Error(`Schema not found for media type ${mediaType}`);
|
|
81
79
|
}
|
|
82
80
|
return schema;
|
|
83
81
|
}
|
|
@@ -1,25 +1,21 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { ParseContext } from '../../context/ParseContext.js';
|
|
2
2
|
import type { OpenAPIV3 } from 'openapi-types';
|
|
3
|
-
import type { Trail } from '../../context/Trail.js';
|
|
4
3
|
import { OasParameter } from './Parameter.js';
|
|
5
4
|
import type { OasRef } from '../ref/Ref.js';
|
|
6
5
|
type ToParameterListV3Args = {
|
|
7
6
|
parameters: (OpenAPIV3.ParameterObject | OpenAPIV3.ReferenceObject)[] | undefined;
|
|
8
|
-
|
|
9
|
-
context: CoreContext;
|
|
7
|
+
context: ParseContext;
|
|
10
8
|
};
|
|
11
|
-
export declare const toParameterListV3: ({ parameters,
|
|
9
|
+
export declare const toParameterListV3: ({ parameters, context }: ToParameterListV3Args) => (OasParameter | OasRef<"parameter">)[] | undefined;
|
|
12
10
|
type ToParametersV3Args = {
|
|
13
11
|
parameters: Record<string, OpenAPIV3.ParameterObject | OpenAPIV3.ReferenceObject>;
|
|
14
|
-
|
|
15
|
-
context: CoreContext;
|
|
12
|
+
context: ParseContext;
|
|
16
13
|
};
|
|
17
|
-
export declare const toParametersV3: ({ parameters,
|
|
14
|
+
export declare const toParametersV3: ({ parameters, context }: ToParametersV3Args) => Record<string, OasParameter | OasRef<"parameter">>;
|
|
18
15
|
type ToOptionalParametersV3Args = {
|
|
19
16
|
parameters: Record<string, OpenAPIV3.ParameterObject | OpenAPIV3.ReferenceObject> | undefined;
|
|
20
|
-
|
|
21
|
-
context: CoreContext;
|
|
17
|
+
context: ParseContext;
|
|
22
18
|
};
|
|
23
|
-
export declare const toOptionalParametersV3: ({ parameters,
|
|
19
|
+
export declare const toOptionalParametersV3: ({ parameters, context }: ToOptionalParametersV3Args) => Record<string, OasParameter | OasRef<"parameter">> | undefined;
|
|
24
20
|
export {};
|
|
25
21
|
//# sourceMappingURL=toParameterV3.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"toParameterV3.d.ts","sourceRoot":"","sources":["../../../src/oas/parameter/toParameterV3.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"toParameterV3.d.ts","sourceRoot":"","sources":["../../../src/oas/parameter/toParameterV3.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAA;AAQjE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,eAAe,CAAA;AAK9C,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAA;AAE7C,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,eAAe,CAAA;AAI3C,KAAK,qBAAqB,GAAG;IAC3B,UAAU,EACN,CAAC,SAAS,CAAC,eAAe,GAAG,SAAS,CAAC,eAAe,CAAC,EAAE,GACzD,SAAS,CAAA;IACb,OAAO,EAAE,YAAY,CAAA;CACtB,CAAA;AAED,eAAO,MAAM,iBAAiB,4BAG3B,qBAAqB,KACpB,CAAC,YAAY,GAAG,MAAM,CAAC,WAAW,CAAC,CAAC,EAAE,GACtC,SAQH,CAAA;AAED,KAAK,kBAAkB,GAAG;IACxB,UAAU,EAAE,MAAM,CAChB,MAAM,EACN,SAAS,CAAC,eAAe,GAAG,SAAS,CAAC,eAAe,CACtD,CAAA;IACD,OAAO,EAAE,YAAY,CAAA;CACtB,CAAA;AAED,eAAO,MAAM,cAAc,4BAGxB,kBAAkB,KAAG,MAAM,CAAC,MAAM,EAAE,YAAY,GAAG,MAAM,CAAC,WAAW,CAAC,CASxE,CAAA;AAED,KAAK,0BAA0B,GAAG;IAChC,UAAU,EACN,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,eAAe,GAAG,SAAS,CAAC,eAAe,CAAC,GACrE,SAAS,CAAA;IACb,OAAO,EAAE,YAAY,CAAA;CACtB,CAAA;AAED,eAAO,MAAM,sBAAsB,4BAGhC,0BAA0B,KACzB,MAAM,CAAC,MAAM,EAAE,YAAY,GAAG,MAAM,CAAC,WAAW,CAAC,CAAC,GAClD,SAMH,CAAA"}
|
|
@@ -9,40 +9,39 @@ const toSchemasV3_js_1 = require("../schema/toSchemasV3.js");
|
|
|
9
9
|
const toMediaTypeItemV3_js_1 = require("../mediaType/toMediaTypeItemV3.js");
|
|
10
10
|
const Parameter_js_1 = require("./Parameter.js");
|
|
11
11
|
const ts_pattern_1 = require("ts-pattern");
|
|
12
|
-
const
|
|
12
|
+
const tracer_js_1 = require("../../helpers/tracer.js");
|
|
13
|
+
const toParameterListV3 = ({ parameters, context }) => {
|
|
13
14
|
if (!parameters) {
|
|
14
15
|
return undefined;
|
|
15
16
|
}
|
|
16
|
-
return parameters.map((parameter, index) =>
|
|
17
|
+
return parameters.map((parameter, index) => (0, tracer_js_1.tracer)(context, index, () => toParameterV3({ parameter, context })));
|
|
17
18
|
};
|
|
18
19
|
exports.toParameterListV3 = toParameterListV3;
|
|
19
|
-
const toParametersV3 = ({ parameters,
|
|
20
|
+
const toParametersV3 = ({ parameters, context }) => {
|
|
20
21
|
return Object.fromEntries(Object.entries(parameters).map(([key, value]) => {
|
|
21
22
|
return [
|
|
22
23
|
key,
|
|
23
|
-
toParameterV3({ parameter: value,
|
|
24
|
+
(0, tracer_js_1.tracer)(context, key, () => toParameterV3({ parameter: value, context }))
|
|
24
25
|
];
|
|
25
26
|
}));
|
|
26
27
|
};
|
|
27
28
|
exports.toParametersV3 = toParametersV3;
|
|
28
|
-
const toOptionalParametersV3 = ({ parameters,
|
|
29
|
+
const toOptionalParametersV3 = ({ parameters, context }) => {
|
|
29
30
|
if (!parameters) {
|
|
30
31
|
return undefined;
|
|
31
32
|
}
|
|
32
|
-
return (0, exports.toParametersV3)({ parameters,
|
|
33
|
+
return (0, exports.toParametersV3)({ parameters, context });
|
|
33
34
|
};
|
|
34
35
|
exports.toOptionalParametersV3 = toOptionalParametersV3;
|
|
35
|
-
const toParameterV3 = ({ parameter,
|
|
36
|
+
const toParameterV3 = ({ parameter, context }) => {
|
|
36
37
|
if ((0, refFns_js_1.isRef)(parameter)) {
|
|
37
|
-
return (0, toRefV31_js_1.toRefV31)({ ref: parameter, refType: 'parameter',
|
|
38
|
+
return (0, toRefV31_js_1.toRefV31)({ ref: parameter, refType: 'parameter', context });
|
|
38
39
|
}
|
|
39
40
|
const { name, in: location, description, required, deprecated, allowEmptyValue, allowReserved, schema, example, examples, content, style, explode, ...skipped } = parameter;
|
|
41
|
+
context.logSkippedFields(skipped);
|
|
40
42
|
const parsedLocation = parameter_types_js_1.oasParameterLocation.parse(location);
|
|
41
43
|
if (parsedLocation === 'path' && !required) {
|
|
42
|
-
console.warn(
|
|
43
|
-
message: `Path parameters must be required`,
|
|
44
|
-
trail: trail.toString()
|
|
45
|
-
}));
|
|
44
|
+
console.warn(`Path parameters must be required`);
|
|
46
45
|
}
|
|
47
46
|
// Set missing 'required' to true for path parameters and false for others
|
|
48
47
|
const defaultRequired = typeof required === 'undefined'
|
|
@@ -56,25 +55,20 @@ const toParameterV3 = ({ parameter, trail, context }) => {
|
|
|
56
55
|
description,
|
|
57
56
|
required: defaultRequired,
|
|
58
57
|
deprecated,
|
|
59
|
-
style: toStyle({ style, location: parsedLocation }),
|
|
60
|
-
explode: toExplode({ explode, style }),
|
|
58
|
+
style: (0, tracer_js_1.tracer)(context, 'style', () => toStyle({ style, location: parsedLocation })),
|
|
59
|
+
explode: (0, tracer_js_1.tracer)(context, 'explode', () => toExplode({ explode, style })),
|
|
61
60
|
allowEmptyValue,
|
|
62
61
|
allowReserved,
|
|
63
|
-
schema: (0,
|
|
64
|
-
examples: (0, toExamplesV3_js_1.toExamplesV3)({
|
|
62
|
+
schema: (0, tracer_js_1.tracer)(context, 'schema', () => (0, toSchemasV3_js_1.toOptionalSchemaV3)({ schema, context })),
|
|
63
|
+
examples: (0, tracer_js_1.tracer)(context, 'examples', () => (0, toExamplesV3_js_1.toExamplesV3)({
|
|
65
64
|
examples,
|
|
66
65
|
example,
|
|
67
66
|
exampleKey: `${name}-${parsedLocation}`,
|
|
68
|
-
trail: trail.add('examples'),
|
|
69
67
|
context
|
|
70
|
-
}),
|
|
71
|
-
content: (0, toMediaTypeItemV3_js_1.toOptionalMediaTypeItemsV3)({
|
|
72
|
-
content,
|
|
73
|
-
trail: trail.add('content'),
|
|
74
|
-
context
|
|
75
|
-
})
|
|
68
|
+
})),
|
|
69
|
+
content: (0, tracer_js_1.tracer)(context, 'content', () => (0, toMediaTypeItemV3_js_1.toOptionalMediaTypeItemsV3)({ content, context }))
|
|
76
70
|
};
|
|
77
|
-
return new Parameter_js_1.OasParameter(
|
|
71
|
+
return new Parameter_js_1.OasParameter(fields);
|
|
78
72
|
};
|
|
79
73
|
const toStyle = ({ style, location }) => {
|
|
80
74
|
const parsed = parameter_types_js_1.oasParameterStyle.optional().parse(style);
|
|
@@ -1,6 +1,3 @@
|
|
|
1
|
-
import { OasBase } from '../../dsl/OasBase.js';
|
|
2
|
-
import type { Trail } from '../../context/Trail.js';
|
|
3
|
-
import type { CoreContext } from '../../context/CoreContext.js';
|
|
4
1
|
import type { OasParameter } from '../parameter/Parameter.js';
|
|
5
2
|
import type { OasRef } from '../ref/Ref.js';
|
|
6
3
|
export type PathItemFields = {
|
|
@@ -8,19 +5,12 @@ export type PathItemFields = {
|
|
|
8
5
|
description: string | undefined;
|
|
9
6
|
parameters: (OasParameter | OasRef<'parameter'>)[] | undefined;
|
|
10
7
|
};
|
|
11
|
-
|
|
12
|
-
fields: PathItemFields;
|
|
13
|
-
trail: Trail;
|
|
14
|
-
skipped: Record<string, unknown>;
|
|
15
|
-
context: CoreContext;
|
|
16
|
-
};
|
|
17
|
-
export declare class OasPathItem extends OasBase {
|
|
8
|
+
export declare class OasPathItem {
|
|
18
9
|
#private;
|
|
19
10
|
oasType: 'pathItem';
|
|
20
|
-
constructor(
|
|
11
|
+
constructor(fields: PathItemFields);
|
|
21
12
|
get summary(): string | undefined;
|
|
22
13
|
get description(): string | undefined;
|
|
23
14
|
get parameters(): (OasParameter | OasRef<'parameter'>)[] | undefined;
|
|
24
15
|
}
|
|
25
|
-
export {};
|
|
26
16
|
//# sourceMappingURL=PathItem.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PathItem.d.ts","sourceRoot":"","sources":["../../../src/oas/pathItem/PathItem.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"PathItem.d.ts","sourceRoot":"","sources":["../../../src/oas/pathItem/PathItem.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAA;AAC7D,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,eAAe,CAAA;AAE3C,MAAM,MAAM,cAAc,GAAG;IAC3B,OAAO,EAAE,MAAM,GAAG,SAAS,CAAA;IAC3B,WAAW,EAAE,MAAM,GAAG,SAAS,CAAA;IAC/B,UAAU,EAAE,CAAC,YAAY,GAAG,MAAM,CAAC,WAAW,CAAC,CAAC,EAAE,GAAG,SAAS,CAAA;CAC/D,CAAA;AAED,qBAAa,WAAW;;IACtB,OAAO,EAAE,UAAU,CAAa;gBAGpB,MAAM,EAAE,cAAc;IAIlC,IAAI,OAAO,IAAI,MAAM,GAAG,SAAS,CAEhC;IAED,IAAI,WAAW,IAAI,MAAM,GAAG,SAAS,CAEpC;IAED,IAAI,UAAU,IAAI,CAAC,YAAY,GAAG,MAAM,CAAC,WAAW,CAAC,CAAC,EAAE,GAAG,SAAS,CAEnE;CACF"}
|
|
@@ -13,10 +13,8 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
|
|
|
13
13
|
var _OasPathItem_fields;
|
|
14
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
15
|
exports.OasPathItem = void 0;
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
constructor({ fields, trail, skipped, context }) {
|
|
19
|
-
super({ trail, skipped, context });
|
|
16
|
+
class OasPathItem {
|
|
17
|
+
constructor(fields) {
|
|
20
18
|
Object.defineProperty(this, "oasType", {
|
|
21
19
|
enumerable: true,
|
|
22
20
|
configurable: true,
|
|
@@ -1,12 +1,10 @@
|
|
|
1
1
|
import type { OpenAPIV3 } from 'openapi-types';
|
|
2
|
-
import type {
|
|
3
|
-
import type { Trail } from '../../context/Trail.js';
|
|
2
|
+
import type { ParseContext } from '../../context/ParseContext.js';
|
|
4
3
|
import { OasPathItem } from './PathItem.js';
|
|
5
4
|
type ToPathItemV3Args = {
|
|
6
5
|
pathItem: OpenAPIV3.PathItemObject;
|
|
7
|
-
|
|
8
|
-
context: CoreContext;
|
|
6
|
+
context: ParseContext;
|
|
9
7
|
};
|
|
10
|
-
export declare const toPathItemV3: ({ pathItem,
|
|
8
|
+
export declare const toPathItemV3: ({ pathItem, context }: ToPathItemV3Args) => OasPathItem;
|
|
11
9
|
export {};
|
|
12
10
|
//# sourceMappingURL=toPathItemV3.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"toPathItemV3.d.ts","sourceRoot":"","sources":["../../../src/oas/pathItem/toPathItemV3.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,eAAe,CAAA;AAC9C,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"toPathItemV3.d.ts","sourceRoot":"","sources":["../../../src/oas/pathItem/toPathItemV3.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,eAAe,CAAA;AAC9C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAA;AAEjE,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAA;AAI3C,KAAK,gBAAgB,GAAG;IACtB,QAAQ,EAAE,SAAS,CAAC,cAAc,CAAA;IAClC,OAAO,EAAE,YAAY,CAAA;CACtB,CAAA;AAED,eAAO,MAAM,YAAY,0BAGtB,gBAAgB,KAAG,WAcrB,CAAA"}
|
|
@@ -3,17 +3,15 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.toPathItemV3 = void 0;
|
|
4
4
|
const toParameterV3_js_1 = require("../parameter/toParameterV3.js");
|
|
5
5
|
const PathItem_js_1 = require("./PathItem.js");
|
|
6
|
-
const
|
|
6
|
+
const tracer_js_1 = require("../../helpers/tracer.js");
|
|
7
|
+
const toPathItemV3 = ({ pathItem, context }) => {
|
|
7
8
|
const { summary, description, parameters, ...skipped } = pathItem;
|
|
9
|
+
context.logSkippedFields(skipped);
|
|
8
10
|
const fields = {
|
|
9
11
|
summary,
|
|
10
12
|
description,
|
|
11
|
-
parameters: (0, toParameterV3_js_1.toParameterListV3)({
|
|
12
|
-
parameters,
|
|
13
|
-
trail: trail.add('parameters'),
|
|
14
|
-
context
|
|
15
|
-
})
|
|
13
|
+
parameters: (0, tracer_js_1.tracer)(context, 'parameters', () => (0, toParameterV3_js_1.toParameterListV3)({ parameters, context }))
|
|
16
14
|
};
|
|
17
|
-
return new PathItem_js_1.OasPathItem(
|
|
15
|
+
return new PathItem_js_1.OasPathItem(fields);
|
|
18
16
|
};
|
|
19
17
|
exports.toPathItemV3 = toPathItemV3;
|
package/script/oas/ref/Ref.d.ts
CHANGED
|
@@ -1,30 +1,23 @@
|
|
|
1
|
-
import { OasBase } from '../../dsl/OasBase.js';
|
|
2
1
|
import type { OasRefData } from './ref-types.js';
|
|
3
|
-
import type { CoreContext } from '../../context/CoreContext.js';
|
|
4
|
-
import type { Trail } from '../../context/Trail.js';
|
|
5
2
|
import type { OasSchema } from '../schema/Schema.js';
|
|
6
3
|
import type { OasResponse } from '../response/Response.js';
|
|
7
4
|
import type { OasParameter } from '../parameter/Parameter.js';
|
|
8
5
|
import type { OasExample } from '../example/Example.js';
|
|
9
6
|
import type { OasRequestBody } from '../requestBody/RequestBody.js';
|
|
10
7
|
import type { OasHeader } from '../header/Header.js';
|
|
8
|
+
import type { OasDocument } from '../document/Document.js';
|
|
11
9
|
export type RefFields<T extends OasRefData['refType']> = {
|
|
12
10
|
refType: T;
|
|
13
11
|
$ref: string;
|
|
14
12
|
summary?: string;
|
|
15
13
|
description?: string;
|
|
16
14
|
};
|
|
17
|
-
|
|
18
|
-
fields: RefFields<T>;
|
|
19
|
-
trail: Trail;
|
|
20
|
-
context: CoreContext;
|
|
21
|
-
skipped: Record<string, unknown>;
|
|
22
|
-
};
|
|
23
|
-
export declare class OasRef<T extends OasRefData['refType']> extends OasBase {
|
|
15
|
+
export declare class OasRef<T extends OasRefData['refType']> {
|
|
24
16
|
#private;
|
|
25
17
|
oasType: 'ref';
|
|
26
18
|
type: 'ref';
|
|
27
|
-
|
|
19
|
+
documentRoot: OasDocument;
|
|
20
|
+
constructor(fields: RefFields<T>, documentRoot: OasDocument);
|
|
28
21
|
resolve(lookupsPerformed?: number): ResolvedRef<T>;
|
|
29
22
|
isRef(): this is OasRef<T>;
|
|
30
23
|
resolveOnce(): OasRef<T> | ResolvedRef<T>;
|
|
@@ -37,5 +30,4 @@ export type OasComponentType = OasSchema | OasResponse | OasParameter | OasExamp
|
|
|
37
30
|
export type ResolvedRef<T extends OasRefData['refType']> = Extract<OasComponentType, {
|
|
38
31
|
oasType: T;
|
|
39
32
|
}>;
|
|
40
|
-
export {};
|
|
41
33
|
//# sourceMappingURL=Ref.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Ref.d.ts","sourceRoot":"","sources":["../../../src/oas/ref/Ref.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"Ref.d.ts","sourceRoot":"","sources":["../../../src/oas/ref/Ref.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAA;AAGhD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAA;AACpD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAA;AAC1D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAA;AAC7D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAA;AACvD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAA;AACnE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAA;AACpD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAA;AAI1D,MAAM,MAAM,SAAS,CAAC,CAAC,SAAS,UAAU,CAAC,SAAS,CAAC,IAAI;IACvD,OAAO,EAAE,CAAC,CAAA;IACV,IAAI,EAAE,MAAM,CAAA;IACZ,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,WAAW,CAAC,EAAE,MAAM,CAAA;CACrB,CAAA;AAED,qBAAa,MAAM,CAAC,CAAC,SAAS,UAAU,CAAC,SAAS,CAAC;;IACjD,OAAO,EAAE,KAAK,CAAQ;IACtB,IAAI,EAAE,KAAK,CAAQ;IAEnB,YAAY,EAAE,WAAW,CAAA;gBAEb,MAAM,EAAE,SAAS,CAAC,CAAC,CAAC,EAAE,YAAY,EAAE,WAAW;IAK3D,OAAO,CAAC,gBAAgB,GAAE,MAAU,GAAG,WAAW,CAAC,CAAC,CAAC;IAUrD,KAAK,IAAI,IAAI,IAAI,MAAM,CAAC,CAAC,CAAC;IAI1B,WAAW,IAAI,MAAM,CAAC,CAAC,CAAC,GAAG,WAAW,CAAC,CAAC,CAAC;IAqCzC,IAAI,IAAI,IAAI,MAAM,CAEjB;IAED,IAAI,OAAO,IAAI,UAAU,CAAC,SAAS,CAAC,CAEnC;IAED,IAAI,OAAO,IAAI,MAAM,GAAG,SAAS,CAEhC;IAED,IAAI,WAAW,IAAI,MAAM,GAAG,SAAS,CAEpC;CACF;AAED,MAAM,MAAM,gBAAgB,GACxB,SAAS,GACT,WAAW,GACX,YAAY,GACZ,UAAU,GACV,cAAc,GACd,SAAS,CAAA;AAEb,MAAM,MAAM,WAAW,CAAC,CAAC,SAAS,UAAU,CAAC,SAAS,CAAC,IAAI,OAAO,CAChE,gBAAgB,EAChB;IAAE,OAAO,EAAE,CAAC,CAAA;CAAE,CACf,CAAA"}
|
package/script/oas/ref/Ref.js
CHANGED
|
@@ -13,13 +13,11 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
|
|
|
13
13
|
var _OasRef_fields;
|
|
14
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
15
|
exports.OasRef = void 0;
|
|
16
|
-
const OasBase_js_1 = require("../../dsl/OasBase.js");
|
|
17
16
|
const refFns_js_1 = require("../../helpers/refFns.js");
|
|
18
17
|
const ts_pattern_1 = require("ts-pattern");
|
|
19
18
|
const MAX_LOOKUPS = 10;
|
|
20
|
-
class OasRef
|
|
21
|
-
constructor(
|
|
22
|
-
super({ trail, skipped, context });
|
|
19
|
+
class OasRef {
|
|
20
|
+
constructor(fields, documentRoot) {
|
|
23
21
|
Object.defineProperty(this, "oasType", {
|
|
24
22
|
enumerable: true,
|
|
25
23
|
configurable: true,
|
|
@@ -33,7 +31,14 @@ class OasRef extends OasBase_js_1.OasBase {
|
|
|
33
31
|
value: 'ref'
|
|
34
32
|
});
|
|
35
33
|
_OasRef_fields.set(this, void 0);
|
|
34
|
+
Object.defineProperty(this, "documentRoot", {
|
|
35
|
+
enumerable: true,
|
|
36
|
+
configurable: true,
|
|
37
|
+
writable: true,
|
|
38
|
+
value: void 0
|
|
39
|
+
});
|
|
36
40
|
__classPrivateFieldSet(this, _OasRef_fields, fields, "f");
|
|
41
|
+
this.documentRoot = documentRoot;
|
|
37
42
|
}
|
|
38
43
|
resolve(lookupsPerformed = 0) {
|
|
39
44
|
if (lookupsPerformed >= MAX_LOOKUPS) {
|
|
@@ -46,7 +51,7 @@ class OasRef extends OasBase_js_1.OasBase {
|
|
|
46
51
|
return true;
|
|
47
52
|
}
|
|
48
53
|
resolveOnce() {
|
|
49
|
-
const c = this.
|
|
54
|
+
const c = this.documentRoot.components;
|
|
50
55
|
const refName = (0, refFns_js_1.toRefName)(this.$ref);
|
|
51
56
|
const refType = this.refType;
|
|
52
57
|
const resolved = (0, ts_pattern_1.match)(refType)
|
|
@@ -58,27 +63,15 @@ class OasRef extends OasBase_js_1.OasBase {
|
|
|
58
63
|
.with('header', () => c?.headers?.[refName])
|
|
59
64
|
.exhaustive();
|
|
60
65
|
if (!resolved) {
|
|
61
|
-
console.error(JSON.stringify({
|
|
62
|
-
trail: this.trail.toString(),
|
|
63
|
-
message: `Ref "${__classPrivateFieldGet(this, _OasRef_fields, "f").$ref}" not found`
|
|
64
|
-
}));
|
|
65
66
|
throw new Error(`Ref "${__classPrivateFieldGet(this, _OasRef_fields, "f").$ref}" not found`);
|
|
66
67
|
}
|
|
67
68
|
if (resolved.isRef()) {
|
|
68
69
|
if (resolved.refType !== this.refType) {
|
|
69
|
-
console.error(JSON.stringify({
|
|
70
|
-
trail: this.trail.toString(),
|
|
71
|
-
message: `Ref type mismatch for "${this.$ref}". Expected "${this.refType}" but got "${resolved.refType}"`
|
|
72
|
-
}));
|
|
73
70
|
throw new Error(`Ref type mismatch for "${this.$ref}". Expected "${this.refType}" but got "${resolved.refType}"`);
|
|
74
71
|
}
|
|
75
72
|
}
|
|
76
73
|
else {
|
|
77
74
|
if (resolved.oasType !== this.refType) {
|
|
78
|
-
console.error(JSON.stringify({
|
|
79
|
-
trail: this.trail.toString(),
|
|
80
|
-
message: `Type mismatch for "${this.$ref}". Expected "${this.refType}" but got "${resolved.oasType}"`
|
|
81
|
-
}));
|
|
82
75
|
throw new Error(`Type mismatch for "${this.$ref}". Expected "${this.refType}" but got "${resolved.oasType}"`);
|
|
83
76
|
}
|
|
84
77
|
}
|
|
@@ -1,14 +1,12 @@
|
|
|
1
1
|
import type { OpenAPIV3_1 } from 'openapi-types';
|
|
2
2
|
import type { OasRefData } from './ref-types.js';
|
|
3
|
-
import type {
|
|
4
|
-
import type { Trail } from '../../context/Trail.js';
|
|
3
|
+
import type { ParseContext } from '../../context/ParseContext.js';
|
|
5
4
|
import { OasRef } from './Ref.js';
|
|
6
5
|
type ToRefV31Args<T extends OasRefData['refType']> = {
|
|
7
6
|
ref: OpenAPIV3_1.ReferenceObject;
|
|
8
7
|
refType: T;
|
|
9
|
-
|
|
10
|
-
context: CoreContext;
|
|
8
|
+
context: ParseContext;
|
|
11
9
|
};
|
|
12
|
-
export declare const toRefV31: <T extends OasRefData["refType"]>({ ref, refType,
|
|
10
|
+
export declare const toRefV31: <T extends OasRefData["refType"]>({ ref, refType, context }: ToRefV31Args<T>) => OasRef<T>;
|
|
13
11
|
export {};
|
|
14
12
|
//# sourceMappingURL=toRefV31.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"toRefV31.d.ts","sourceRoot":"","sources":["../../../src/oas/ref/toRefV31.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,eAAe,CAAA;AAChD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAA;AAChD,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"toRefV31.d.ts","sourceRoot":"","sources":["../../../src/oas/ref/toRefV31.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,eAAe,CAAA;AAChD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAA;AAChD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAA;AACjE,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAA;AAGjC,KAAK,YAAY,CAAC,CAAC,SAAS,UAAU,CAAC,SAAS,CAAC,IAAI;IACnD,GAAG,EAAE,WAAW,CAAC,eAAe,CAAA;IAChC,OAAO,EAAE,CAAC,CAAA;IACV,OAAO,EAAE,YAAY,CAAA;CACtB,CAAA;AAED,eAAO,MAAM,QAAQ,GAAI,CAAC,SAAS,UAAU,CAAC,SAAS,CAAC,6BAIrD,YAAY,CAAC,CAAC,CAAC,KAAG,MAAM,CAAC,CAAC,CAa5B,CAAA"}
|
|
@@ -2,14 +2,15 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.toRefV31 = void 0;
|
|
4
4
|
const Ref_js_1 = require("./Ref.js");
|
|
5
|
-
const toRefV31 = ({ ref, refType,
|
|
5
|
+
const toRefV31 = ({ ref, refType, context }) => {
|
|
6
6
|
const { $ref, summary, description, ...skipped } = ref;
|
|
7
|
+
context.logSkippedFields(skipped);
|
|
7
8
|
const fields = {
|
|
8
9
|
refType,
|
|
9
10
|
$ref,
|
|
10
11
|
summary,
|
|
11
12
|
description
|
|
12
13
|
};
|
|
13
|
-
return new Ref_js_1.OasRef(
|
|
14
|
+
return new Ref_js_1.OasRef(fields, context.documentRoot);
|
|
14
15
|
};
|
|
15
16
|
exports.toRefV31 = toRefV31;
|
|
@@ -1,6 +1,3 @@
|
|
|
1
|
-
import { OasBase } from '../../dsl/OasBase.js';
|
|
2
|
-
import type { CoreContext } from '../../context/CoreContext.js';
|
|
3
|
-
import type { Trail } from '../../context/Trail.js';
|
|
4
1
|
import type { OasMediaType } from '../mediaType/MediaType.js';
|
|
5
2
|
import type { OasRef } from '../ref/Ref.js';
|
|
6
3
|
import type { OasSchema } from '../schema/Schema.js';
|
|
@@ -9,16 +6,10 @@ export type RequestBodyFields = {
|
|
|
9
6
|
content: Record<string, OasMediaType>;
|
|
10
7
|
required: boolean | undefined;
|
|
11
8
|
};
|
|
12
|
-
|
|
13
|
-
fields: RequestBodyFields;
|
|
14
|
-
trail: Trail;
|
|
15
|
-
skipped: Record<string, unknown>;
|
|
16
|
-
context: CoreContext;
|
|
17
|
-
};
|
|
18
|
-
export declare class OasRequestBody extends OasBase {
|
|
9
|
+
export declare class OasRequestBody {
|
|
19
10
|
#private;
|
|
20
11
|
oasType: 'requestBody';
|
|
21
|
-
constructor(
|
|
12
|
+
constructor(fields: RequestBodyFields);
|
|
22
13
|
get description(): string | undefined;
|
|
23
14
|
get content(): Record<string, OasMediaType>;
|
|
24
15
|
get required(): boolean | undefined;
|
|
@@ -27,5 +18,4 @@ export declare class OasRequestBody extends OasBase {
|
|
|
27
18
|
resolveOnce(): OasRequestBody;
|
|
28
19
|
toSchema(mediaType?: string): OasSchema | OasRef<'schema'> | undefined;
|
|
29
20
|
}
|
|
30
|
-
export {};
|
|
31
21
|
//# sourceMappingURL=RequestBody.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RequestBody.d.ts","sourceRoot":"","sources":["../../../src/oas/requestBody/RequestBody.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"RequestBody.d.ts","sourceRoot":"","sources":["../../../src/oas/requestBody/RequestBody.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAA;AAC7D,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,eAAe,CAAA;AAC3C,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAA;AAEpD,MAAM,MAAM,iBAAiB,GAAG;IAC9B,WAAW,EAAE,MAAM,GAAG,SAAS,CAAA;IAC/B,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,YAAY,CAAC,CAAA;IACrC,QAAQ,EAAE,OAAO,GAAG,SAAS,CAAA;CAC9B,CAAA;AAED,qBAAa,cAAc;;IACzB,OAAO,EAAE,aAAa,CAAgB;gBAG1B,MAAM,EAAE,iBAAiB;IAIrC,IAAI,WAAW,IAAI,MAAM,GAAG,SAAS,CAEpC;IAED,IAAI,OAAO,IAAI,MAAM,CAAC,MAAM,EAAE,YAAY,CAAC,CAE1C;IAED,IAAI,QAAQ,IAAI,OAAO,GAAG,SAAS,CAElC;IAED,KAAK,IAAI,IAAI,IAAI,MAAM,CAAC,aAAa,CAAC;IAItC,OAAO,IAAI,cAAc;IAIzB,WAAW,IAAI,cAAc;IAI7B,QAAQ,CACN,SAAS,GAAE,MAA2B,GACrC,SAAS,GAAG,MAAM,CAAC,QAAQ,CAAC,GAAG,SAAS;CAG5C"}
|
|
@@ -13,10 +13,8 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
|
|
|
13
13
|
var _OasRequestBody_fields;
|
|
14
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
15
|
exports.OasRequestBody = void 0;
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
constructor({ fields, trail, skipped, context }) {
|
|
19
|
-
super({ trail, skipped, context });
|
|
16
|
+
class OasRequestBody {
|
|
17
|
+
constructor(fields) {
|
|
20
18
|
Object.defineProperty(this, "oasType", {
|
|
21
19
|
enumerable: true,
|
|
22
20
|
configurable: true,
|