@skmtc/core 0.0.299 → 0.0.301
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 +7 -4
- package/esm/context/GenerateContext.d.ts +2 -2
- package/esm/context/GenerateContext.d.ts.map +1 -1
- package/esm/context/GenerateContext.js +1 -1
- package/esm/context/ParseContext.d.ts +12 -5
- package/esm/context/ParseContext.d.ts.map +1 -1
- package/esm/context/ParseContext.js +17 -10
- 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 -8
- 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 -8
- 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 -8
- 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 -8
- 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 +2 -8
- package/esm/oas/document/Document.d.ts.map +1 -1
- package/esm/oas/document/Document.js +2 -4
- package/esm/oas/document/toDocumentV3.d.ts +3 -5
- package/esm/oas/document/toDocumentV3.d.ts.map +1 -1
- package/esm/oas/document/toDocumentV3.js +8 -14
- package/esm/oas/example/Example.d.ts +2 -8
- 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 -8
- 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 -8
- 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 -8
- 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 -8
- 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 -8
- 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 -8
- 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 -11
- package/esm/oas/object/Object.d.ts.map +1 -1
- package/esm/oas/object/Object.js +9 -21
- 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 +6 -11
- package/esm/oas/operation/Operation.d.ts.map +1 -1
- package/esm/oas/operation/Operation.js +9 -11
- 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 -8
- 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 -8
- 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 +5 -10
- package/esm/oas/ref/Ref.d.ts.map +1 -1
- package/esm/oas/ref/Ref.js +9 -21
- 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 -8
- 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 -8
- 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 -8
- 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 -8
- 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 -8
- 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 -8
- 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 -9
- package/esm/oas/void/Void.d.ts.map +1 -1
- package/esm/oas/void/Void.js +4 -10
- package/esm/typescript/ReactRouterPathParams.d.ts.map +1 -1
- package/esm/typescript/ReactRouterPathParams.js +3 -1
- 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 +7 -4
- package/script/context/GenerateContext.d.ts +2 -2
- package/script/context/GenerateContext.d.ts.map +1 -1
- package/script/context/GenerateContext.js +1 -1
- package/script/context/ParseContext.d.ts +12 -5
- package/script/context/ParseContext.d.ts.map +1 -1
- package/script/context/ParseContext.js +17 -10
- 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 -8
- 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 -8
- 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 -8
- 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 -8
- 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 +2 -8
- package/script/oas/document/Document.d.ts.map +1 -1
- package/script/oas/document/Document.js +2 -4
- package/script/oas/document/toDocumentV3.d.ts +3 -5
- package/script/oas/document/toDocumentV3.d.ts.map +1 -1
- package/script/oas/document/toDocumentV3.js +8 -14
- package/script/oas/example/Example.d.ts +2 -8
- 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 -8
- 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 -8
- 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 -8
- 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 -8
- 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 -8
- 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 -8
- 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 -11
- package/script/oas/object/Object.d.ts.map +1 -1
- package/script/oas/object/Object.js +9 -21
- 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 +6 -11
- package/script/oas/operation/Operation.d.ts.map +1 -1
- package/script/oas/operation/Operation.js +9 -11
- 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 -8
- 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 -8
- 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 +5 -10
- package/script/oas/ref/Ref.d.ts.map +1 -1
- package/script/oas/ref/Ref.js +9 -21
- 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 -8
- 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 -8
- 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 -8
- 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 -8
- 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 -8
- 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 -8
- 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 -9
- package/script/oas/void/Void.d.ts.map +1 -1
- package/script/oas/void/Void.js +4 -10
- package/script/typescript/ReactRouterPathParams.d.ts.map +1 -1
- package/script/typescript/ReactRouterPathParams.js +3 -1
- 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/script/dsl/OasBase.d.ts +0 -15
- package/script/dsl/OasBase.d.ts.map +0 -1
- package/script/dsl/OasBase.js +0 -32
|
@@ -10,12 +10,10 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
|
|
|
10
10
|
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
11
11
|
};
|
|
12
12
|
var _OasOperation_fields;
|
|
13
|
-
import { OasBase } from '../../dsl/OasBase.js';
|
|
14
13
|
import { OasObject } from '../object/Object.js';
|
|
15
14
|
/** Operation represents a resource path and a method that can be enacted against it */
|
|
16
|
-
export class OasOperation
|
|
17
|
-
constructor({ fields
|
|
18
|
-
super({ trail, skipped, context });
|
|
15
|
+
export class OasOperation {
|
|
16
|
+
constructor({ fields }) {
|
|
19
17
|
Object.defineProperty(this, "oasType", {
|
|
20
18
|
enumerable: true,
|
|
21
19
|
configurable: true,
|
|
@@ -33,8 +31,8 @@ export class OasOperation extends OasBase {
|
|
|
33
31
|
.find(httpCode => httpCode >= 200 && httpCode < 300);
|
|
34
32
|
return successCode ? httpCodeResponses[successCode] : defaultResponse;
|
|
35
33
|
}
|
|
36
|
-
toRequestBody(mediaType = 'application/json') {
|
|
37
|
-
return this.requestBody?.resolve().content[mediaType]?.schema;
|
|
34
|
+
toRequestBody(schemaModel, mediaType = 'application/json') {
|
|
35
|
+
return this.requestBody?.resolve(schemaModel).content[mediaType]?.schema;
|
|
38
36
|
}
|
|
39
37
|
/**
|
|
40
38
|
* Resolve all parameters and optionally filter by location
|
|
@@ -42,20 +40,20 @@ export class OasOperation extends OasBase {
|
|
|
42
40
|
* @param filter - only include parameters from specified locations
|
|
43
41
|
* @returns
|
|
44
42
|
*/
|
|
45
|
-
toParams(filter) {
|
|
43
|
+
toParams(schemaModel, filter) {
|
|
46
44
|
return (this.parameters
|
|
47
|
-
?.map(param => param.resolve())
|
|
45
|
+
?.map(param => param.resolve(schemaModel))
|
|
48
46
|
.filter(param => filter?.length ? filter.includes(param.location) : true) ?? []);
|
|
49
47
|
}
|
|
50
|
-
toParametersObject(filter) {
|
|
51
|
-
const parameters = this.toParams(filter);
|
|
48
|
+
toParametersObject(schemaModel, filter) {
|
|
49
|
+
const parameters = this.toParams(schemaModel, filter);
|
|
52
50
|
return parameters.reduce((acc, parameter) => {
|
|
53
51
|
return acc.addProperty({
|
|
54
52
|
name: parameter.name,
|
|
55
53
|
schema: parameter.toSchema(),
|
|
56
54
|
required: parameter.required
|
|
57
55
|
});
|
|
58
|
-
}, OasObject.empty(
|
|
56
|
+
}, OasObject.empty());
|
|
59
57
|
}
|
|
60
58
|
get path() {
|
|
61
59
|
return __classPrivateFieldGet(this, _OasOperation_fields, "f").path;
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import type { OpenAPIV3 } from 'openapi-types';
|
|
2
2
|
import type { Method } from '../../types/Method.js';
|
|
3
|
-
import type {
|
|
4
|
-
import type { Trail } from '../../context/Trail.js';
|
|
3
|
+
import type { ParseContext } from '../../context/ParseContext.js';
|
|
5
4
|
import { OasOperation } from './Operation.js';
|
|
6
5
|
import type { OasPathItem } from '../pathItem/PathItem.js';
|
|
7
6
|
type OperationInfo = {
|
|
@@ -12,15 +11,13 @@ type OperationInfo = {
|
|
|
12
11
|
type ToOperationV3Args = {
|
|
13
12
|
operation: OpenAPIV3.OperationObject;
|
|
14
13
|
operationInfo: OperationInfo;
|
|
15
|
-
|
|
16
|
-
context: CoreContext;
|
|
14
|
+
context: ParseContext;
|
|
17
15
|
};
|
|
18
|
-
export declare const toOperationV3: ({ operation, operationInfo,
|
|
16
|
+
export declare const toOperationV3: ({ operation, operationInfo, context }: ToOperationV3Args) => OasOperation;
|
|
19
17
|
type ToOperationsV3Args = {
|
|
20
18
|
paths: OpenAPIV3.PathsObject;
|
|
21
|
-
|
|
22
|
-
context: CoreContext;
|
|
19
|
+
context: ParseContext;
|
|
23
20
|
};
|
|
24
|
-
export declare const toOperationsV3: ({ paths,
|
|
21
|
+
export declare const toOperationsV3: ({ paths, context }: ToOperationsV3Args) => OasOperation[];
|
|
25
22
|
export {};
|
|
26
23
|
//# sourceMappingURL=toOperationsV3.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"toOperationsV3.d.ts","sourceRoot":"","sources":["../../../src/oas/operation/toOperationsV3.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,eAAe,CAAA;AAC9C,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAA;AACnD,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"toOperationsV3.d.ts","sourceRoot":"","sources":["../../../src/oas/operation/toOperationsV3.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,eAAe,CAAA;AAC9C,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAA;AACnD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAA;AAIjE,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAA;AAG7C,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAA;AAG1D,KAAK,aAAa,GAAG;IACnB,MAAM,EAAE,MAAM,CAAA;IACd,IAAI,EAAE,MAAM,CAAA;IACZ,QAAQ,EAAE,WAAW,CAAA;CACtB,CAAA;AAED,KAAK,iBAAiB,GAAG;IACvB,SAAS,EAAE,SAAS,CAAC,eAAe,CAAA;IACpC,aAAa,EAAE,aAAa,CAAA;IAC5B,OAAO,EAAE,YAAY,CAAA;CACtB,CAAA;AAED,eAAO,MAAM,aAAa,0CAIvB,iBAAiB,KAAG,YAqCtB,CAAA;AAED,KAAK,kBAAkB,GAAG;IACxB,KAAK,EAAE,SAAS,CAAC,WAAW,CAAA;IAC5B,OAAO,EAAE,YAAY,CAAA;CACtB,CAAA;AAED,eAAO,MAAM,cAAc,uBAGxB,kBAAkB,KAAG,YAAY,EAqDnC,CAAA"}
|
|
@@ -3,9 +3,11 @@ import { toResponsesV3 } from '../response/toResponseV3.js';
|
|
|
3
3
|
import { toParameterListV3 } from '../parameter/toParameterV3.js';
|
|
4
4
|
import { OasOperation } from './Operation.js';
|
|
5
5
|
import { toPathItemV3 } from '../pathItem/toPathItemV3.js';
|
|
6
|
-
|
|
6
|
+
import { tracer } from '../../helpers/tracer.js';
|
|
7
|
+
export const toOperationV3 = ({ operation, operationInfo, context }) => {
|
|
7
8
|
const { method, path, pathItem } = operationInfo;
|
|
8
9
|
const { operationId, tags, summary, description, parameters, requestBody, responses, deprecated, ...skipped } = operation;
|
|
10
|
+
context.logSkippedFields(skipped);
|
|
9
11
|
const fields = {
|
|
10
12
|
pathItem,
|
|
11
13
|
path,
|
|
@@ -14,62 +16,49 @@ export const toOperationV3 = ({ operation, operationInfo, trail, context }) => {
|
|
|
14
16
|
summary,
|
|
15
17
|
tags,
|
|
16
18
|
description,
|
|
17
|
-
parameters: toParameterListV3({
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
context
|
|
21
|
-
}),
|
|
22
|
-
requestBody: toRequestBodyV3({
|
|
23
|
-
requestBody,
|
|
24
|
-
trail: trail.add('requestBody'),
|
|
25
|
-
context
|
|
26
|
-
}),
|
|
27
|
-
responses: toResponsesV3({
|
|
28
|
-
responses,
|
|
29
|
-
trail: trail.add('responses'),
|
|
30
|
-
context
|
|
31
|
-
}),
|
|
19
|
+
parameters: tracer(context, 'parameters', () => toParameterListV3({ parameters, context })),
|
|
20
|
+
requestBody: tracer(context, 'requestBody', () => toRequestBodyV3({ requestBody, context })),
|
|
21
|
+
responses: tracer(context, 'responses', () => toResponsesV3({ responses, context })),
|
|
32
22
|
deprecated
|
|
33
23
|
};
|
|
34
|
-
return new OasOperation({ fields
|
|
24
|
+
return new OasOperation({ fields });
|
|
35
25
|
};
|
|
36
|
-
export const toOperationsV3 = ({ paths,
|
|
26
|
+
export const toOperationsV3 = ({ paths, context }) => {
|
|
37
27
|
return Object.entries(paths).flatMap(([path, pathItem]) => {
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
const { get, post, put, delete: deleteMethod, options, head, patch, trace, ...rest } = pathItem;
|
|
42
|
-
const pathItemObject = toPathItemV3({
|
|
43
|
-
pathItem: rest,
|
|
44
|
-
trail: trail.addApiPath(path),
|
|
45
|
-
context
|
|
46
|
-
});
|
|
47
|
-
const methodObjects = {
|
|
48
|
-
get,
|
|
49
|
-
post,
|
|
50
|
-
put,
|
|
51
|
-
delete: deleteMethod,
|
|
52
|
-
options,
|
|
53
|
-
head,
|
|
54
|
-
patch,
|
|
55
|
-
trace
|
|
56
|
-
};
|
|
57
|
-
return Object.entries(methodObjects)
|
|
58
|
-
.map(([method, operation]) => {
|
|
59
|
-
if (!operation) {
|
|
60
|
-
return;
|
|
28
|
+
return tracer(context, path, () => {
|
|
29
|
+
if (!pathItem) {
|
|
30
|
+
return [];
|
|
61
31
|
}
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
32
|
+
const { get, post, put, delete: deleteMethod, options, head, patch, trace, ...rest } = pathItem;
|
|
33
|
+
const pathItemObject = toPathItemV3({ pathItem: rest, context });
|
|
34
|
+
const methodObjects = {
|
|
35
|
+
get,
|
|
36
|
+
post,
|
|
37
|
+
put,
|
|
38
|
+
delete: deleteMethod,
|
|
39
|
+
options,
|
|
40
|
+
head,
|
|
41
|
+
patch,
|
|
42
|
+
trace
|
|
43
|
+
};
|
|
44
|
+
return Object.entries(methodObjects)
|
|
45
|
+
.map(([method, operation]) => {
|
|
46
|
+
return tracer(context, method, () => {
|
|
47
|
+
if (!operation) {
|
|
48
|
+
return;
|
|
49
|
+
}
|
|
50
|
+
return toOperationV3({
|
|
51
|
+
operation,
|
|
52
|
+
operationInfo: {
|
|
53
|
+
method: method,
|
|
54
|
+
path,
|
|
55
|
+
pathItem: pathItemObject
|
|
56
|
+
},
|
|
57
|
+
context
|
|
58
|
+
});
|
|
59
|
+
});
|
|
60
|
+
})
|
|
61
|
+
.filter((item) => Boolean(item));
|
|
62
|
+
});
|
|
74
63
|
});
|
|
75
64
|
};
|
|
@@ -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';
|
|
@@ -22,14 +19,11 @@ export type ParameterFields = {
|
|
|
22
19
|
};
|
|
23
20
|
type ToParameterV3Args = {
|
|
24
21
|
fields: ParameterFields;
|
|
25
|
-
trail: Trail;
|
|
26
|
-
skipped: Record<string, unknown>;
|
|
27
|
-
context: CoreContext;
|
|
28
22
|
};
|
|
29
|
-
export declare class OasParameter
|
|
23
|
+
export declare class OasParameter {
|
|
30
24
|
#private;
|
|
31
25
|
oasType: 'parameter';
|
|
32
|
-
constructor({ fields
|
|
26
|
+
constructor({ fields }: ToParameterV3Args);
|
|
33
27
|
get name(): string;
|
|
34
28
|
get location(): OasParameterLocation;
|
|
35
29
|
get description(): string | undefined;
|
|
@@ -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,KAAK,iBAAiB,GAAG;IACvB,MAAM,EAAE,eAAe,CAAA;CACxB,CAAA;AAED,qBAAa,YAAY;;IACvB,OAAO,EAAE,WAAW,CAAc;gBAGtB,EAAE,MAAM,EAAE,EAAE,iBAAiB;IAIzC,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"}
|
|
@@ -10,10 +10,8 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
|
|
|
10
10
|
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
11
11
|
};
|
|
12
12
|
var _OasParameter_fields;
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
constructor({ fields, trail, skipped, context }) {
|
|
16
|
-
super({ trail, skipped, context });
|
|
13
|
+
export class OasParameter {
|
|
14
|
+
constructor({ fields }) {
|
|
17
15
|
Object.defineProperty(this, "oasType", {
|
|
18
16
|
enumerable: true,
|
|
19
17
|
configurable: true,
|
|
@@ -74,7 +72,7 @@ export class OasParameter extends OasBase {
|
|
|
74
72
|
}
|
|
75
73
|
const schema = __classPrivateFieldGet(this, _OasParameter_fields, "f").content?.[mediaType]?.schema;
|
|
76
74
|
if (!schema) {
|
|
77
|
-
throw new Error(`Schema not found for media type ${mediaType}
|
|
75
|
+
throw new Error(`Schema not found for media type ${mediaType}`);
|
|
78
76
|
}
|
|
79
77
|
return schema;
|
|
80
78
|
}
|
|
@@ -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"}
|
|
@@ -6,37 +6,36 @@ import { toOptionalSchemaV3 } from '../schema/toSchemasV3.js';
|
|
|
6
6
|
import { toOptionalMediaTypeItemsV3 } from '../mediaType/toMediaTypeItemV3.js';
|
|
7
7
|
import { OasParameter } from './Parameter.js';
|
|
8
8
|
import { match } from 'ts-pattern';
|
|
9
|
-
|
|
9
|
+
import { tracer } from '../../helpers/tracer.js';
|
|
10
|
+
export const toParameterListV3 = ({ parameters, context }) => {
|
|
10
11
|
if (!parameters) {
|
|
11
12
|
return undefined;
|
|
12
13
|
}
|
|
13
|
-
return parameters.map((parameter, index) =>
|
|
14
|
+
return parameters.map((parameter, index) => tracer(context, index, () => toParameterV3({ parameter, context })));
|
|
14
15
|
};
|
|
15
|
-
export const toParametersV3 = ({ parameters,
|
|
16
|
+
export const toParametersV3 = ({ parameters, context }) => {
|
|
16
17
|
return Object.fromEntries(Object.entries(parameters).map(([key, value]) => {
|
|
17
18
|
return [
|
|
18
19
|
key,
|
|
19
|
-
toParameterV3({ parameter: value,
|
|
20
|
+
tracer(context, key, () => toParameterV3({ parameter: value, context }))
|
|
20
21
|
];
|
|
21
22
|
}));
|
|
22
23
|
};
|
|
23
|
-
export const toOptionalParametersV3 = ({ parameters,
|
|
24
|
+
export const toOptionalParametersV3 = ({ parameters, context }) => {
|
|
24
25
|
if (!parameters) {
|
|
25
26
|
return undefined;
|
|
26
27
|
}
|
|
27
|
-
return toParametersV3({ parameters,
|
|
28
|
+
return toParametersV3({ parameters, context });
|
|
28
29
|
};
|
|
29
|
-
const toParameterV3 = ({ parameter,
|
|
30
|
+
const toParameterV3 = ({ parameter, context }) => {
|
|
30
31
|
if (isRef(parameter)) {
|
|
31
|
-
return toRefV31({ ref: parameter, refType: 'parameter',
|
|
32
|
+
return toRefV31({ ref: parameter, refType: 'parameter', context });
|
|
32
33
|
}
|
|
33
34
|
const { name, in: location, description, required, deprecated, allowEmptyValue, allowReserved, schema, example, examples, content, style, explode, ...skipped } = parameter;
|
|
35
|
+
context.logSkippedFields(skipped);
|
|
34
36
|
const parsedLocation = oasParameterLocation.parse(location);
|
|
35
37
|
if (parsedLocation === 'path' && !required) {
|
|
36
|
-
console.warn(
|
|
37
|
-
message: `Path parameters must be required`,
|
|
38
|
-
trail: trail.toString()
|
|
39
|
-
}));
|
|
38
|
+
console.warn(`Path parameters must be required`);
|
|
40
39
|
}
|
|
41
40
|
// Set missing 'required' to true for path parameters and false for others
|
|
42
41
|
const defaultRequired = typeof required === 'undefined'
|
|
@@ -50,25 +49,20 @@ const toParameterV3 = ({ parameter, trail, context }) => {
|
|
|
50
49
|
description,
|
|
51
50
|
required: defaultRequired,
|
|
52
51
|
deprecated,
|
|
53
|
-
style: toStyle({ style, location: parsedLocation }),
|
|
54
|
-
explode: toExplode({ explode, style }),
|
|
52
|
+
style: tracer(context, 'style', () => toStyle({ style, location: parsedLocation })),
|
|
53
|
+
explode: tracer(context, 'explode', () => toExplode({ explode, style })),
|
|
55
54
|
allowEmptyValue,
|
|
56
55
|
allowReserved,
|
|
57
|
-
schema:
|
|
58
|
-
examples: toExamplesV3({
|
|
56
|
+
schema: tracer(context, 'schema', () => toOptionalSchemaV3({ schema, context })),
|
|
57
|
+
examples: tracer(context, 'examples', () => toExamplesV3({
|
|
59
58
|
examples,
|
|
60
59
|
example,
|
|
61
60
|
exampleKey: `${name}-${parsedLocation}`,
|
|
62
|
-
trail: trail.add('examples'),
|
|
63
61
|
context
|
|
64
|
-
}),
|
|
65
|
-
content: toOptionalMediaTypeItemsV3({
|
|
66
|
-
content,
|
|
67
|
-
trail: trail.add('content'),
|
|
68
|
-
context
|
|
69
|
-
})
|
|
62
|
+
})),
|
|
63
|
+
content: tracer(context, 'content', () => toOptionalMediaTypeItemsV3({ content, context }))
|
|
70
64
|
};
|
|
71
|
-
return new OasParameter({ fields
|
|
65
|
+
return new OasParameter({ fields });
|
|
72
66
|
};
|
|
73
67
|
const toStyle = ({ style, location }) => {
|
|
74
68
|
const parsed = 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 = {
|
|
@@ -10,14 +7,11 @@ export type PathItemFields = {
|
|
|
10
7
|
};
|
|
11
8
|
type ToPathItemV3Args = {
|
|
12
9
|
fields: PathItemFields;
|
|
13
|
-
trail: Trail;
|
|
14
|
-
skipped: Record<string, unknown>;
|
|
15
|
-
context: CoreContext;
|
|
16
10
|
};
|
|
17
|
-
export declare class OasPathItem
|
|
11
|
+
export declare class OasPathItem {
|
|
18
12
|
#private;
|
|
19
13
|
oasType: 'pathItem';
|
|
20
|
-
constructor({ fields
|
|
14
|
+
constructor({ fields }: ToPathItemV3Args);
|
|
21
15
|
get summary(): string | undefined;
|
|
22
16
|
get description(): string | undefined;
|
|
23
17
|
get parameters(): (OasParameter | OasRef<'parameter'>)[] | undefined;
|
|
@@ -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,KAAK,gBAAgB,GAAG;IACtB,MAAM,EAAE,cAAc,CAAA;CACvB,CAAA;AAED,qBAAa,WAAW;;IACtB,OAAO,EAAE,UAAU,CAAa;gBAGpB,EAAE,MAAM,EAAE,EAAE,gBAAgB;IAIxC,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"}
|
|
@@ -10,10 +10,8 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
|
|
|
10
10
|
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
11
11
|
};
|
|
12
12
|
var _OasPathItem_fields;
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
constructor({ fields, trail, skipped, context }) {
|
|
16
|
-
super({ trail, skipped, context });
|
|
13
|
+
export class OasPathItem {
|
|
14
|
+
constructor({ fields }) {
|
|
17
15
|
Object.defineProperty(this, "oasType", {
|
|
18
16
|
enumerable: true,
|
|
19
17
|
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"}
|
|
@@ -1,15 +1,13 @@
|
|
|
1
1
|
import { toParameterListV3 } from '../parameter/toParameterV3.js';
|
|
2
2
|
import { OasPathItem } from './PathItem.js';
|
|
3
|
-
|
|
3
|
+
import { tracer } from '../../helpers/tracer.js';
|
|
4
|
+
export const toPathItemV3 = ({ pathItem, context }) => {
|
|
4
5
|
const { summary, description, parameters, ...skipped } = pathItem;
|
|
6
|
+
context.logSkippedFields(skipped);
|
|
5
7
|
const fields = {
|
|
6
8
|
summary,
|
|
7
9
|
description,
|
|
8
|
-
parameters: toParameterListV3({
|
|
9
|
-
parameters,
|
|
10
|
-
trail: trail.add('parameters'),
|
|
11
|
-
context
|
|
12
|
-
})
|
|
10
|
+
parameters: tracer(context, 'parameters', () => toParameterListV3({ parameters, context }))
|
|
13
11
|
};
|
|
14
|
-
return new OasPathItem({ fields
|
|
12
|
+
return new OasPathItem({ fields });
|
|
15
13
|
};
|
package/esm/oas/ref/Ref.d.ts
CHANGED
|
@@ -1,13 +1,11 @@
|
|
|
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;
|
|
@@ -16,18 +14,15 @@ export type RefFields<T extends OasRefData['refType']> = {
|
|
|
16
14
|
};
|
|
17
15
|
type ToRefV3Args<T extends OasRefData['refType']> = {
|
|
18
16
|
fields: RefFields<T>;
|
|
19
|
-
trail: Trail;
|
|
20
|
-
context: CoreContext;
|
|
21
|
-
skipped: Record<string, unknown>;
|
|
22
17
|
};
|
|
23
|
-
export declare class OasRef<T extends OasRefData['refType']>
|
|
18
|
+
export declare class OasRef<T extends OasRefData['refType']> {
|
|
24
19
|
#private;
|
|
25
20
|
oasType: 'ref';
|
|
26
21
|
type: 'ref';
|
|
27
|
-
constructor({ fields
|
|
28
|
-
resolve(lookupsPerformed?: number): ResolvedRef<T>;
|
|
22
|
+
constructor({ fields }: ToRefV3Args<T>);
|
|
23
|
+
resolve(schemaModel: OasDocument, lookupsPerformed?: number): ResolvedRef<T>;
|
|
29
24
|
isRef(): this is OasRef<T>;
|
|
30
|
-
resolveOnce(): OasRef<T> | ResolvedRef<T>;
|
|
25
|
+
resolveOnce(schemaModel: OasDocument): OasRef<T> | ResolvedRef<T>;
|
|
31
26
|
get $ref(): string;
|
|
32
27
|
get refType(): OasRefData['refType'];
|
|
33
28
|
get summary(): string | undefined;
|
package/esm/oas/ref/Ref.d.ts.map
CHANGED
|
@@ -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,KAAK,WAAW,CAAC,CAAC,SAAS,UAAU,CAAC,SAAS,CAAC,IAAI;IAClD,MAAM,EAAE,SAAS,CAAC,CAAC,CAAC,CAAA;CACrB,CAAA;AAED,qBAAa,MAAM,CAAC,CAAC,SAAS,UAAU,CAAC,SAAS,CAAC;;IACjD,OAAO,EAAE,KAAK,CAAQ;IACtB,IAAI,EAAE,KAAK,CAAQ;gBAGP,EAAE,MAAM,EAAE,EAAE,WAAW,CAAC,CAAC,CAAC;IAItC,OAAO,CACL,WAAW,EAAE,WAAW,EACxB,gBAAgB,GAAE,MAAU,GAC3B,WAAW,CAAC,CAAC,CAAC;IAYjB,KAAK,IAAI,IAAI,IAAI,MAAM,CAAC,CAAC,CAAC;IAI1B,WAAW,CAAC,WAAW,EAAE,WAAW,GAAG,MAAM,CAAC,CAAC,CAAC,GAAG,WAAW,CAAC,CAAC,CAAC;IAqCjE,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/esm/oas/ref/Ref.js
CHANGED
|
@@ -10,13 +10,11 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
|
|
|
10
10
|
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
11
11
|
};
|
|
12
12
|
var _OasRef_fields;
|
|
13
|
-
import { OasBase } from '../../dsl/OasBase.js';
|
|
14
13
|
import { toRefName } from '../../helpers/refFns.js';
|
|
15
14
|
import { match } from 'ts-pattern';
|
|
16
15
|
const MAX_LOOKUPS = 10;
|
|
17
|
-
export class OasRef
|
|
18
|
-
constructor({ fields
|
|
19
|
-
super({ trail, skipped, context });
|
|
16
|
+
export class OasRef {
|
|
17
|
+
constructor({ fields }) {
|
|
20
18
|
Object.defineProperty(this, "oasType", {
|
|
21
19
|
enumerable: true,
|
|
22
20
|
configurable: true,
|
|
@@ -32,18 +30,20 @@ export class OasRef extends OasBase {
|
|
|
32
30
|
_OasRef_fields.set(this, void 0);
|
|
33
31
|
__classPrivateFieldSet(this, _OasRef_fields, fields, "f");
|
|
34
32
|
}
|
|
35
|
-
resolve(lookupsPerformed = 0) {
|
|
33
|
+
resolve(schemaModel, lookupsPerformed = 0) {
|
|
36
34
|
if (lookupsPerformed >= MAX_LOOKUPS) {
|
|
37
35
|
throw new Error('Max lookups reached');
|
|
38
36
|
}
|
|
39
|
-
const resolved = this.resolveOnce();
|
|
40
|
-
return resolved.isRef()
|
|
37
|
+
const resolved = this.resolveOnce(schemaModel);
|
|
38
|
+
return resolved.isRef()
|
|
39
|
+
? resolved.resolve(schemaModel, lookupsPerformed + 1)
|
|
40
|
+
: resolved;
|
|
41
41
|
}
|
|
42
42
|
isRef() {
|
|
43
43
|
return true;
|
|
44
44
|
}
|
|
45
|
-
resolveOnce() {
|
|
46
|
-
const c =
|
|
45
|
+
resolveOnce(schemaModel) {
|
|
46
|
+
const c = schemaModel.components;
|
|
47
47
|
const refName = toRefName(this.$ref);
|
|
48
48
|
const refType = this.refType;
|
|
49
49
|
const resolved = match(refType)
|
|
@@ -55,27 +55,15 @@ export class OasRef extends OasBase {
|
|
|
55
55
|
.with('header', () => c?.headers?.[refName])
|
|
56
56
|
.exhaustive();
|
|
57
57
|
if (!resolved) {
|
|
58
|
-
console.error(JSON.stringify({
|
|
59
|
-
trail: this.trail.toString(),
|
|
60
|
-
message: `Ref "${__classPrivateFieldGet(this, _OasRef_fields, "f").$ref}" not found`
|
|
61
|
-
}));
|
|
62
58
|
throw new Error(`Ref "${__classPrivateFieldGet(this, _OasRef_fields, "f").$ref}" not found`);
|
|
63
59
|
}
|
|
64
60
|
if (resolved.isRef()) {
|
|
65
61
|
if (resolved.refType !== this.refType) {
|
|
66
|
-
console.error(JSON.stringify({
|
|
67
|
-
trail: this.trail.toString(),
|
|
68
|
-
message: `Ref type mismatch for "${this.$ref}". Expected "${this.refType}" but got "${resolved.refType}"`
|
|
69
|
-
}));
|
|
70
62
|
throw new Error(`Ref type mismatch for "${this.$ref}". Expected "${this.refType}" but got "${resolved.refType}"`);
|
|
71
63
|
}
|
|
72
64
|
}
|
|
73
65
|
else {
|
|
74
66
|
if (resolved.oasType !== this.refType) {
|
|
75
|
-
console.error(JSON.stringify({
|
|
76
|
-
trail: this.trail.toString(),
|
|
77
|
-
message: `Type mismatch for "${this.$ref}". Expected "${this.refType}" but got "${resolved.oasType}"`
|
|
78
|
-
}));
|
|
79
67
|
throw new Error(`Type mismatch for "${this.$ref}". Expected "${this.refType}" but got "${resolved.oasType}"`);
|
|
80
68
|
}
|
|
81
69
|
}
|
|
@@ -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"}
|