@skmtc/core 0.0.799 → 0.0.802
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 +0 -3
- package/esm/context/CoreContext.d.ts.map +1 -1
- package/esm/context/CoreContext.js +12 -17
- package/esm/context/GenerateContext.d.ts +35 -3
- package/esm/context/GenerateContext.d.ts.map +1 -1
- package/esm/context/GenerateContext.js +21 -1
- package/esm/context/ParseContext.d.ts +64 -3
- package/esm/context/ParseContext.d.ts.map +1 -1
- package/esm/context/ParseContext.js +61 -0
- package/esm/context/RenderContext.d.ts +151 -2
- package/esm/context/RenderContext.d.ts.map +1 -1
- package/esm/context/RenderContext.js +185 -11
- package/esm/context/ResultsHandler.d.ts +10 -3
- package/esm/context/ResultsHandler.d.ts.map +1 -1
- package/esm/context/types.d.ts +30 -0
- package/esm/context/types.d.ts.map +1 -1
- package/esm/dsl/model/ModelBase.d.ts +1 -1
- package/esm/dsl/model/ModelBase.d.ts.map +1 -1
- package/esm/dsl/model/ModelDriver.d.ts +62 -0
- package/esm/dsl/model/ModelDriver.d.ts.map +1 -1
- package/esm/dsl/model/ModelDriver.js +63 -1
- package/esm/dsl/model/toModelBase.d.ts +66 -0
- package/esm/dsl/model/toModelBase.d.ts.map +1 -1
- package/esm/dsl/model/toModelBase.js +46 -0
- package/esm/dsl/model/toModelEntry.d.ts +63 -0
- package/esm/dsl/model/toModelEntry.d.ts.map +1 -1
- package/esm/dsl/model/toModelEntry.js +63 -0
- package/esm/dsl/model/types.d.ts +51 -4
- package/esm/dsl/model/types.d.ts.map +1 -1
- package/esm/dsl/operation/OperationBase.d.ts +3 -3
- package/esm/dsl/operation/OperationBase.d.ts.map +1 -1
- package/esm/dsl/operation/OperationDriver.d.ts +48 -0
- package/esm/dsl/operation/OperationDriver.d.ts.map +1 -1
- package/esm/dsl/operation/OperationDriver.js +49 -1
- package/esm/dsl/operation/types.d.ts +61 -3
- package/esm/dsl/operation/types.d.ts.map +1 -1
- package/esm/helpers/isEmpty.d.ts +1 -1
- package/esm/helpers/isEmpty.d.ts.map +1 -1
- package/esm/helpers/tracer.d.ts +1 -1
- package/esm/helpers/tracer.d.ts.map +1 -1
- package/esm/helpers/tracer.js +1 -1
- package/esm/mod.d.ts +51 -0
- package/esm/mod.d.ts.map +1 -1
- package/esm/mod.js +51 -0
- package/esm/oas/array/array-types.d.ts +20 -11
- package/esm/oas/array/array-types.d.ts.map +1 -1
- package/esm/oas/array/array-types.js +10 -0
- package/esm/oas/array/toArray.d.ts +111 -0
- package/esm/oas/array/toArray.d.ts.map +1 -1
- package/esm/oas/array/toArray.js +115 -3
- package/esm/oas/boolean/boolean-types.d.ts +1 -7
- package/esm/oas/boolean/boolean-types.d.ts.map +1 -1
- package/esm/oas/components/components-types.d.ts +19 -0
- package/esm/oas/components/components-types.d.ts.map +1 -0
- package/esm/oas/components/components-types.js +21 -0
- package/esm/oas/contact/contact-types.d.ts +9 -0
- package/esm/oas/contact/contact-types.d.ts.map +1 -0
- package/esm/oas/contact/contact-types.js +7 -0
- package/esm/oas/discriminator/discriminator-types.d.ts +1 -5
- package/esm/oas/discriminator/discriminator-types.d.ts.map +1 -1
- package/esm/oas/document/document-types.d.ts +16 -0
- package/esm/oas/document/document-types.d.ts.map +1 -0
- package/esm/oas/document/document-types.js +18 -0
- package/esm/oas/example/example-types.d.ts +1 -6
- package/esm/oas/example/example-types.d.ts.map +1 -1
- package/esm/oas/header/header-types.d.ts +50 -0
- package/esm/oas/header/header-types.d.ts.map +1 -0
- package/esm/oas/header/header-types.js +30 -0
- package/esm/oas/info/info-types.d.ts +14 -0
- package/esm/oas/info/info-types.d.ts.map +1 -0
- package/esm/oas/info/info-types.js +13 -0
- package/esm/oas/integer/integer-types.d.ts +3 -17
- package/esm/oas/integer/integer-types.d.ts.map +1 -1
- package/esm/oas/license/license-types.d.ts +9 -0
- package/esm/oas/license/license-types.d.ts.map +1 -0
- package/esm/oas/license/license-types.js +7 -0
- package/esm/oas/mediaType/mediaType-types.d.ts +1 -11
- package/esm/oas/mediaType/mediaType-types.d.ts.map +1 -1
- package/esm/oas/number/number-types.d.ts +2 -16
- package/esm/oas/number/number-types.d.ts.map +1 -1
- package/esm/oas/operation/Operation.d.ts +47 -2
- package/esm/oas/operation/Operation.d.ts.map +1 -1
- package/esm/oas/operation/Operation.js +43 -0
- package/esm/oas/operation/operation-types.d.ts +22 -0
- package/esm/oas/operation/operation-types.d.ts.map +1 -0
- package/esm/oas/operation/operation-types.js +35 -0
- package/esm/oas/parameter/parameter-types.d.ts +3 -58
- package/esm/oas/parameter/parameter-types.d.ts.map +1 -1
- package/esm/oas/pathItem/pathItem-types.d.ts +12 -0
- package/esm/oas/pathItem/pathItem-types.d.ts.map +1 -0
- package/esm/oas/pathItem/pathItem-types.js +12 -0
- package/esm/oas/ref/Ref.d.ts +49 -2
- package/esm/oas/ref/Ref.d.ts.map +1 -1
- package/esm/oas/ref/Ref.js +28 -0
- package/esm/oas/requestBody/requestBody-types.d.ts +10 -0
- package/esm/oas/requestBody/requestBody-types.d.ts.map +1 -0
- package/esm/oas/requestBody/requestBody-types.js +9 -0
- package/esm/oas/response/response-types.d.ts +12 -0
- package/esm/oas/response/response-types.d.ts.map +1 -0
- package/esm/oas/response/response-types.js +11 -0
- package/esm/oas/schema/toSchemasV3.js +2 -2
- package/esm/oas/server/toServerV3.d.ts.map +1 -1
- package/esm/oas/string/string-types.d.ts +2 -29
- package/esm/oas/string/string-types.d.ts.map +1 -1
- package/esm/oas/string/toString.d.ts +125 -1
- package/esm/oas/string/toString.d.ts.map +1 -1
- package/esm/oas/string/toString.js +119 -0
- package/esm/oas/tag/tag-types.d.ts +8 -0
- package/esm/oas/tag/tag-types.d.ts.map +1 -0
- package/esm/oas/tag/tag-types.js +8 -0
- package/esm/oas/union/union-types.d.ts +1 -12
- package/esm/oas/union/union-types.d.ts.map +1 -1
- package/esm/oas/unknown/unknown-types.d.ts +1 -7
- package/esm/oas/unknown/unknown-types.d.ts.map +1 -1
- package/esm/types/Preview.d.ts +37 -0
- package/esm/types/Preview.d.ts.map +1 -1
- package/esm/types/Preview.js +37 -0
- package/esm/types/Settings.d.ts +35 -0
- package/esm/types/Settings.d.ts.map +1 -1
- package/esm/types/Settings.js +27 -0
- package/esm/typescript/FunctionParameter.d.ts +4 -4
- package/esm/typescript/FunctionParameter.d.ts.map +1 -1
- package/esm/typescript/List.d.ts +104 -5
- package/esm/typescript/List.d.ts.map +1 -1
- package/esm/typescript/List.js +75 -0
- package/package.json +1 -1
- package/script/context/CoreContext.d.ts +0 -3
- package/script/context/CoreContext.d.ts.map +1 -1
- package/script/context/CoreContext.js +12 -17
- package/script/context/GenerateContext.d.ts +35 -3
- package/script/context/GenerateContext.d.ts.map +1 -1
- package/script/context/GenerateContext.js +21 -1
- package/script/context/ParseContext.d.ts +64 -3
- package/script/context/ParseContext.d.ts.map +1 -1
- package/script/context/ParseContext.js +61 -0
- package/script/context/RenderContext.d.ts +151 -2
- package/script/context/RenderContext.d.ts.map +1 -1
- package/script/context/RenderContext.js +185 -11
- package/script/context/ResultsHandler.d.ts +10 -3
- package/script/context/ResultsHandler.d.ts.map +1 -1
- package/script/context/types.d.ts +30 -0
- package/script/context/types.d.ts.map +1 -1
- package/script/dsl/model/ModelBase.d.ts +1 -1
- package/script/dsl/model/ModelBase.d.ts.map +1 -1
- package/script/dsl/model/ModelDriver.d.ts +62 -0
- package/script/dsl/model/ModelDriver.d.ts.map +1 -1
- package/script/dsl/model/ModelDriver.js +63 -1
- package/script/dsl/model/toModelBase.d.ts +66 -0
- package/script/dsl/model/toModelBase.d.ts.map +1 -1
- package/script/dsl/model/toModelBase.js +46 -0
- package/script/dsl/model/toModelEntry.d.ts +63 -0
- package/script/dsl/model/toModelEntry.d.ts.map +1 -1
- package/script/dsl/model/toModelEntry.js +63 -0
- package/script/dsl/model/types.d.ts +51 -4
- package/script/dsl/model/types.d.ts.map +1 -1
- package/script/dsl/operation/OperationBase.d.ts +3 -3
- package/script/dsl/operation/OperationBase.d.ts.map +1 -1
- package/script/dsl/operation/OperationDriver.d.ts +48 -0
- package/script/dsl/operation/OperationDriver.d.ts.map +1 -1
- package/script/dsl/operation/OperationDriver.js +49 -1
- package/script/dsl/operation/types.d.ts +61 -3
- package/script/dsl/operation/types.d.ts.map +1 -1
- package/script/helpers/isEmpty.d.ts +1 -1
- package/script/helpers/isEmpty.d.ts.map +1 -1
- package/script/helpers/tracer.d.ts +1 -1
- package/script/helpers/tracer.d.ts.map +1 -1
- package/script/helpers/tracer.js +1 -1
- package/script/mod.d.ts +51 -0
- package/script/mod.d.ts.map +1 -1
- package/script/mod.js +51 -0
- package/script/oas/array/array-types.d.ts +20 -11
- package/script/oas/array/array-types.d.ts.map +1 -1
- package/script/oas/array/array-types.js +11 -1
- package/script/oas/array/toArray.d.ts +111 -0
- package/script/oas/array/toArray.d.ts.map +1 -1
- package/script/oas/array/toArray.js +114 -2
- package/script/oas/boolean/boolean-types.d.ts +1 -7
- package/script/oas/boolean/boolean-types.d.ts.map +1 -1
- package/script/oas/components/components-types.d.ts +19 -0
- package/script/oas/components/components-types.d.ts.map +1 -0
- package/script/oas/components/components-types.js +57 -0
- package/script/oas/contact/contact-types.d.ts +9 -0
- package/script/oas/contact/contact-types.d.ts.map +1 -0
- package/script/oas/contact/contact-types.js +43 -0
- package/script/oas/discriminator/discriminator-types.d.ts +1 -5
- package/script/oas/discriminator/discriminator-types.d.ts.map +1 -1
- package/script/oas/document/document-types.d.ts +16 -0
- package/script/oas/document/document-types.d.ts.map +1 -0
- package/script/oas/document/document-types.js +54 -0
- package/script/oas/example/example-types.d.ts +1 -6
- package/script/oas/example/example-types.d.ts.map +1 -1
- package/script/oas/header/header-types.d.ts +50 -0
- package/script/oas/header/header-types.d.ts.map +1 -0
- package/script/oas/header/header-types.js +66 -0
- package/script/oas/info/info-types.d.ts +14 -0
- package/script/oas/info/info-types.d.ts.map +1 -0
- package/script/oas/info/info-types.js +49 -0
- package/script/oas/integer/integer-types.d.ts +3 -17
- package/script/oas/integer/integer-types.d.ts.map +1 -1
- package/script/oas/license/license-types.d.ts +9 -0
- package/script/oas/license/license-types.d.ts.map +1 -0
- package/script/oas/license/license-types.js +43 -0
- package/script/oas/mediaType/mediaType-types.d.ts +1 -11
- package/script/oas/mediaType/mediaType-types.d.ts.map +1 -1
- package/script/oas/number/number-types.d.ts +2 -16
- package/script/oas/number/number-types.d.ts.map +1 -1
- package/script/oas/operation/Operation.d.ts +47 -2
- package/script/oas/operation/Operation.d.ts.map +1 -1
- package/script/oas/operation/Operation.js +43 -0
- package/script/oas/operation/operation-types.d.ts +22 -0
- package/script/oas/operation/operation-types.d.ts.map +1 -0
- package/script/oas/operation/operation-types.js +71 -0
- package/script/oas/parameter/parameter-types.d.ts +3 -58
- package/script/oas/parameter/parameter-types.d.ts.map +1 -1
- package/script/oas/pathItem/pathItem-types.d.ts +12 -0
- package/script/oas/pathItem/pathItem-types.d.ts.map +1 -0
- package/script/oas/pathItem/pathItem-types.js +48 -0
- package/script/oas/ref/Ref.d.ts +49 -2
- package/script/oas/ref/Ref.d.ts.map +1 -1
- package/script/oas/ref/Ref.js +28 -0
- package/script/oas/requestBody/requestBody-types.d.ts +10 -0
- package/script/oas/requestBody/requestBody-types.d.ts.map +1 -0
- package/script/oas/requestBody/requestBody-types.js +45 -0
- package/script/oas/response/response-types.d.ts +12 -0
- package/script/oas/response/response-types.d.ts.map +1 -0
- package/script/oas/response/response-types.js +47 -0
- package/script/oas/schema/toSchemasV3.js +2 -2
- package/script/oas/server/toServerV3.d.ts.map +1 -1
- package/script/oas/string/string-types.d.ts +2 -29
- package/script/oas/string/string-types.d.ts.map +1 -1
- package/script/oas/string/toString.d.ts +125 -1
- package/script/oas/string/toString.d.ts.map +1 -1
- package/script/oas/string/toString.js +119 -0
- package/script/oas/tag/tag-types.d.ts +8 -0
- package/script/oas/tag/tag-types.d.ts.map +1 -0
- package/script/oas/tag/tag-types.js +44 -0
- package/script/oas/union/union-types.d.ts +1 -12
- package/script/oas/union/union-types.d.ts.map +1 -1
- package/script/oas/unknown/unknown-types.d.ts +1 -7
- package/script/oas/unknown/unknown-types.d.ts.map +1 -1
- package/script/types/Preview.d.ts +37 -0
- package/script/types/Preview.d.ts.map +1 -1
- package/script/types/Preview.js +37 -0
- package/script/types/Settings.d.ts +35 -0
- package/script/types/Settings.d.ts.map +1 -1
- package/script/types/Settings.js +27 -0
- package/script/typescript/FunctionParameter.d.ts +4 -4
- package/script/typescript/FunctionParameter.d.ts.map +1 -1
- package/script/typescript/List.d.ts +104 -5
- package/script/typescript/List.d.ts.map +1 -1
- package/script/typescript/List.js +75 -0
|
@@ -25,15 +25,5 @@ export type OasMediaTypeData = {
|
|
|
25
25
|
* Validates the structure of media type objects including content type
|
|
26
26
|
* identifiers, schema definitions, and example collections.
|
|
27
27
|
*/
|
|
28
|
-
export declare const oasMediaTypeData: v.
|
|
29
|
-
readonly oasType: v.LiteralSchema<"mediaType", undefined>;
|
|
30
|
-
readonly mediaType: v.StringSchema<undefined>;
|
|
31
|
-
readonly schema: v.OptionalSchema<v.UnionSchema<[v.GenericSchema<OasSchemaData>, v.GenericSchema<OasSchemaRefData>], undefined>, undefined>;
|
|
32
|
-
readonly examples: v.OptionalSchema<v.RecordSchema<v.StringSchema<undefined>, v.UnionSchema<[v.ObjectSchema<{
|
|
33
|
-
readonly oasType: v.LiteralSchema<"example", undefined>;
|
|
34
|
-
readonly summary: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
|
|
35
|
-
readonly description: v.OptionalSchema<v.GenericSchema<string>, undefined>;
|
|
36
|
-
readonly value: v.OptionalSchema<v.UnknownSchema, undefined>;
|
|
37
|
-
}, undefined>, v.GenericSchema<OasExampleRefData>], undefined>, undefined>, undefined>;
|
|
38
|
-
}, undefined>;
|
|
28
|
+
export declare const oasMediaTypeData: v.GenericSchema<OasMediaTypeData>;
|
|
39
29
|
//# sourceMappingURL=mediaType-types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mediaType-types.d.ts","sourceRoot":"","sources":["../../../src/oas/mediaType/mediaType-types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,cAAc,EAAkB,MAAM,6BAA6B,CAAA;AACjF,OAAO,EACL,KAAK,iBAAiB,EACtB,KAAK,gBAAgB,EAGtB,MAAM,qBAAqB,CAAA;AAC5B,OAAO,EAAE,KAAK,aAAa,EAAiB,MAAM,2BAA2B,CAAA;AAC7E,OAAO,KAAK,CAAC,MAAM,SAAS,CAAA;AAE5B;;;;;;GAMG;AACH,MAAM,MAAM,gBAAgB,GAAG;IAC7B,iDAAiD;IACjD,OAAO,EAAE,WAAW,CAAA;IACpB,yEAAyE;IACzE,SAAS,EAAE,MAAM,CAAA;IACjB,mDAAmD;IACnD,MAAM,CAAC,EAAE,aAAa,GAAG,gBAAgB,CAAA;IAEzC,gDAAgD;IAChD,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,cAAc,GAAG,iBAAiB,CAAC,CAAA;CAE9D,CAAA;AAED;;;;;GAKG;AACH,eAAO,MAAM,gBAAgB
|
|
1
|
+
{"version":3,"file":"mediaType-types.d.ts","sourceRoot":"","sources":["../../../src/oas/mediaType/mediaType-types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,cAAc,EAAkB,MAAM,6BAA6B,CAAA;AACjF,OAAO,EACL,KAAK,iBAAiB,EACtB,KAAK,gBAAgB,EAGtB,MAAM,qBAAqB,CAAA;AAC5B,OAAO,EAAE,KAAK,aAAa,EAAiB,MAAM,2BAA2B,CAAA;AAC7E,OAAO,KAAK,CAAC,MAAM,SAAS,CAAA;AAE5B;;;;;;GAMG;AACH,MAAM,MAAM,gBAAgB,GAAG;IAC7B,iDAAiD;IACjD,OAAO,EAAE,WAAW,CAAA;IACpB,yEAAyE;IACzE,SAAS,EAAE,MAAM,CAAA;IACjB,mDAAmD;IACnD,MAAM,CAAC,EAAE,aAAa,GAAG,gBAAgB,CAAA;IAEzC,gDAAgD;IAChD,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,cAAc,GAAG,iBAAiB,CAAC,CAAA;CAE9D,CAAA;AAED;;;;;GAKG;AACH,eAAO,MAAM,gBAAgB,EAAE,CAAC,CAAC,aAAa,CAAC,gBAAgB,CAO7D,CAAA"}
|
|
@@ -5,28 +5,14 @@ import * as v from 'valibot';
|
|
|
5
5
|
* Defines the precision formats for number types: float for single-precision
|
|
6
6
|
* and double for double-precision floating-point numbers.
|
|
7
7
|
*/
|
|
8
|
-
export declare const numberFormat: v.
|
|
8
|
+
export declare const numberFormat: v.GenericSchema<'float' | 'double'>;
|
|
9
9
|
/**
|
|
10
10
|
* Valibot schema for validating OpenAPI number data objects.
|
|
11
11
|
*
|
|
12
12
|
* Validates number schemas including precision formats, range constraints,
|
|
13
13
|
* multiple validation, and enumeration values.
|
|
14
14
|
*/
|
|
15
|
-
export declare const oasNumberData: v.
|
|
16
|
-
readonly type: v.LiteralSchema<"number", undefined>;
|
|
17
|
-
readonly title: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
|
|
18
|
-
readonly description: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
|
|
19
|
-
readonly default: v.OptionalSchema<v.NumberSchema<undefined>, undefined>;
|
|
20
|
-
readonly format: v.OptionalSchema<v.UnionSchema<[v.LiteralSchema<"float", undefined>, v.LiteralSchema<"double", undefined>], undefined>, undefined>;
|
|
21
|
-
readonly enum: v.OptionalSchema<v.ArraySchema<v.NumberSchema<undefined>, undefined>, undefined>;
|
|
22
|
-
readonly nullable: v.OptionalSchema<v.BooleanSchema<undefined>, undefined>;
|
|
23
|
-
readonly example: v.OptionalSchema<v.NumberSchema<undefined>, undefined>;
|
|
24
|
-
readonly multipleOf: v.OptionalSchema<v.NumberSchema<undefined>, undefined>;
|
|
25
|
-
readonly maximum: v.OptionalSchema<v.NumberSchema<undefined>, undefined>;
|
|
26
|
-
readonly exclusiveMaximum: v.OptionalSchema<v.BooleanSchema<undefined>, undefined>;
|
|
27
|
-
readonly minimum: v.OptionalSchema<v.NumberSchema<undefined>, undefined>;
|
|
28
|
-
readonly exclusiveMinimum: v.OptionalSchema<v.BooleanSchema<undefined>, undefined>;
|
|
29
|
-
}, undefined>;
|
|
15
|
+
export declare const oasNumberData: v.GenericSchema<OasNumberData>;
|
|
30
16
|
export type OasNumberData = {
|
|
31
17
|
type: 'number';
|
|
32
18
|
title?: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"number-types.d.ts","sourceRoot":"","sources":["../../../src/oas/number/number-types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,SAAS,CAAA;AAE5B;;;;;GAKG;AACH,eAAO,MAAM,YAAY,
|
|
1
|
+
{"version":3,"file":"number-types.d.ts","sourceRoot":"","sources":["../../../src/oas/number/number-types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,SAAS,CAAA;AAE5B;;;;;GAKG;AACH,eAAO,MAAM,YAAY,EAAE,CAAC,CAAC,aAAa,CAAC,OAAO,GAAG,QAAQ,CAAsD,CAAA;AAEnH;;;;;GAKG;AACH,eAAO,MAAM,aAAa,EAAE,CAAC,CAAC,aAAa,CAAC,aAAa,CAcvD,CAAA;AAEF,MAAM,MAAM,aAAa,GAAG;IAC1B,IAAI,EAAE,QAAQ,CAAA;IACd,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,MAAM,CAAC,EAAE,OAAO,GAAG,QAAQ,CAAA;IAC3B,IAAI,CAAC,EAAE,MAAM,EAAE,CAAA;IACf,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,gBAAgB,CAAC,EAAE,OAAO,CAAA;IAC1B,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,gBAAgB,CAAC,EAAE,OAAO,CAAA;CAC3B,CAAA"}
|
|
@@ -46,7 +46,10 @@ export type OperationFields = {
|
|
|
46
46
|
/** OpenAPI specification extensions */
|
|
47
47
|
extensionFields?: Record<string, unknown>;
|
|
48
48
|
};
|
|
49
|
-
|
|
49
|
+
/**
|
|
50
|
+
* Arguments passed to request body mapping functions.
|
|
51
|
+
*/
|
|
52
|
+
export type ToRequestBodyMapArgs = {
|
|
50
53
|
schema: OasSchema | OasRef<'schema'>;
|
|
51
54
|
requestBody: OasRequestBody;
|
|
52
55
|
};
|
|
@@ -186,9 +189,35 @@ export declare class OasOperation {
|
|
|
186
189
|
deprecated: boolean | undefined;
|
|
187
190
|
/** OpenAPI specification extensions */
|
|
188
191
|
extensionFields: Record<string, unknown> | undefined;
|
|
192
|
+
/**
|
|
193
|
+
* Creates a new OasOperation instance from operation field data.
|
|
194
|
+
*
|
|
195
|
+
* @param fields - Operation field data from OpenAPI specification
|
|
196
|
+
*/
|
|
189
197
|
constructor(fields: OperationFields);
|
|
198
|
+
/**
|
|
199
|
+
* Returns the successful response definition for this operation.
|
|
200
|
+
*
|
|
201
|
+
* Looks for the lowest numbered 2xx response code and returns its response definition.
|
|
202
|
+
*
|
|
203
|
+
* @returns Success response object or undefined if none found
|
|
204
|
+
*/
|
|
190
205
|
toSuccessResponse(): OasResponse | OasRef<'response'> | undefined;
|
|
206
|
+
/**
|
|
207
|
+
* Returns the HTTP status code for the primary success response.
|
|
208
|
+
*
|
|
209
|
+
* Finds the lowest numbered 2xx status code in the responses.
|
|
210
|
+
*
|
|
211
|
+
* @returns Success status code as string or undefined if none found
|
|
212
|
+
*/
|
|
191
213
|
toSuccessResponseCode(): string | undefined;
|
|
214
|
+
/**
|
|
215
|
+
* Maps the request body schema to a custom value using the provided mapping function.
|
|
216
|
+
*
|
|
217
|
+
* @param map - Function to transform the request body schema and metadata
|
|
218
|
+
* @param mediaType - Media type to extract schema from (default: 'application/json')
|
|
219
|
+
* @returns Mapped value or undefined if no request body schema found
|
|
220
|
+
*/
|
|
192
221
|
toRequestBody<V>(map: ({ schema, requestBody }: ToRequestBodyMapArgs) => V, mediaType?: string): V | undefined;
|
|
193
222
|
/**
|
|
194
223
|
* Resolve all parameters and optionally filter by location
|
|
@@ -197,9 +226,25 @@ export declare class OasOperation {
|
|
|
197
226
|
* @returns
|
|
198
227
|
*/
|
|
199
228
|
toParams(filter?: OasParameterLocation[]): OasParameter[];
|
|
229
|
+
/**
|
|
230
|
+
* Creates an OAS object representation of operation parameters.
|
|
231
|
+
*
|
|
232
|
+
* @param filter - Optional array of parameter locations to include
|
|
233
|
+
* @returns OAS object with parameter properties
|
|
234
|
+
*/
|
|
200
235
|
toParametersObject(filter?: OasParameterLocation[]): OasObject;
|
|
236
|
+
/**
|
|
237
|
+
* Converts the operation to OpenAPI v3 JSON schema format.
|
|
238
|
+
*
|
|
239
|
+
* @param options - Conversion options for nested components
|
|
240
|
+
* @returns OpenAPI v3 operation object
|
|
241
|
+
*/
|
|
201
242
|
toJsonSchema(options: ToJsonSchemaOptions): OpenAPIV3.OperationObject;
|
|
243
|
+
/**
|
|
244
|
+
* Serializes the operation to a plain JavaScript object.
|
|
245
|
+
*
|
|
246
|
+
* @returns Plain object representation of the operation
|
|
247
|
+
*/
|
|
202
248
|
toJSON(): object;
|
|
203
249
|
}
|
|
204
|
-
export {};
|
|
205
250
|
//# sourceMappingURL=Operation.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Operation.d.ts","sourceRoot":"","sources":["../../../src/oas/operation/Operation.ts"],"names":[],"mappings":"AAAA,OAAO,yBAAyB,CAAC;AACjC,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAA;AACnD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAA;AAC1D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAA;AAC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AKG;IACH,QAAQ,CAAC,MAAM,CAAC,EAAE,oBAAoB,EAAE,GAAG,YAAY,EAAE;IAQzD;;;;;OAKG;IACH,kBAAkB,CAAC,MAAM,CAAC,EAAE,oBAAoB,EAAE,GAAG,SAAS;IAY9D;;;;;OAKG;IACH,YAAY,CAAC,OAAO,EAAE,mBAAmB,GAAG,SAAS,CAAC,eAAe;IAiBrE;;;;OAIG;IACH,MAAM,IAAI,MAAM;CAcjB"}
|
|
@@ -108,6 +108,11 @@ import { OasObject } from '../object/Object.js';
|
|
|
108
108
|
* ```
|
|
109
109
|
*/
|
|
110
110
|
export class OasOperation {
|
|
111
|
+
/**
|
|
112
|
+
* Creates a new OasOperation instance from operation field data.
|
|
113
|
+
*
|
|
114
|
+
* @param fields - Operation field data from OpenAPI specification
|
|
115
|
+
*/
|
|
111
116
|
constructor(fields) {
|
|
112
117
|
/** Type identifier for OAS operation objects */
|
|
113
118
|
Object.defineProperty(this, "oasType", {
|
|
@@ -221,10 +226,24 @@ export class OasOperation {
|
|
|
221
226
|
this.deprecated = fields.deprecated;
|
|
222
227
|
this.extensionFields = fields.extensionFields;
|
|
223
228
|
}
|
|
229
|
+
/**
|
|
230
|
+
* Returns the successful response definition for this operation.
|
|
231
|
+
*
|
|
232
|
+
* Looks for the lowest numbered 2xx response code and returns its response definition.
|
|
233
|
+
*
|
|
234
|
+
* @returns Success response object or undefined if none found
|
|
235
|
+
*/
|
|
224
236
|
toSuccessResponse() {
|
|
225
237
|
const successCode = this.toSuccessResponseCode();
|
|
226
238
|
return successCode ? this.responses[successCode] : undefined;
|
|
227
239
|
}
|
|
240
|
+
/**
|
|
241
|
+
* Returns the HTTP status code for the primary success response.
|
|
242
|
+
*
|
|
243
|
+
* Finds the lowest numbered 2xx status code in the responses.
|
|
244
|
+
*
|
|
245
|
+
* @returns Success status code as string or undefined if none found
|
|
246
|
+
*/
|
|
228
247
|
toSuccessResponseCode() {
|
|
229
248
|
const successCode = Object.keys(this.responses)
|
|
230
249
|
.map(httpCode => parseInt(httpCode))
|
|
@@ -238,6 +257,13 @@ export class OasOperation {
|
|
|
238
257
|
}
|
|
239
258
|
return undefined;
|
|
240
259
|
}
|
|
260
|
+
/**
|
|
261
|
+
* Maps the request body schema to a custom value using the provided mapping function.
|
|
262
|
+
*
|
|
263
|
+
* @param map - Function to transform the request body schema and metadata
|
|
264
|
+
* @param mediaType - Media type to extract schema from (default: 'application/json')
|
|
265
|
+
* @returns Mapped value or undefined if no request body schema found
|
|
266
|
+
*/
|
|
241
267
|
toRequestBody(map, mediaType = 'application/json') {
|
|
242
268
|
const requestBody = this.requestBody?.resolve();
|
|
243
269
|
const schema = requestBody?.content[mediaType]?.schema;
|
|
@@ -254,6 +280,12 @@ export class OasOperation {
|
|
|
254
280
|
?.map(param => param.resolve())
|
|
255
281
|
.filter(param => (filter?.length ? filter.includes(param.location) : true)) ?? []);
|
|
256
282
|
}
|
|
283
|
+
/**
|
|
284
|
+
* Creates an OAS object representation of operation parameters.
|
|
285
|
+
*
|
|
286
|
+
* @param filter - Optional array of parameter locations to include
|
|
287
|
+
* @returns OAS object with parameter properties
|
|
288
|
+
*/
|
|
257
289
|
toParametersObject(filter) {
|
|
258
290
|
const parameters = this.toParams(filter);
|
|
259
291
|
return parameters.reduce((acc, parameter) => {
|
|
@@ -264,6 +296,12 @@ export class OasOperation {
|
|
|
264
296
|
});
|
|
265
297
|
}, OasObject.empty());
|
|
266
298
|
}
|
|
299
|
+
/**
|
|
300
|
+
* Converts the operation to OpenAPI v3 JSON schema format.
|
|
301
|
+
*
|
|
302
|
+
* @param options - Conversion options for nested components
|
|
303
|
+
* @returns OpenAPI v3 operation object
|
|
304
|
+
*/
|
|
267
305
|
toJsonSchema(options) {
|
|
268
306
|
return {
|
|
269
307
|
tags: this.tags,
|
|
@@ -278,6 +316,11 @@ export class OasOperation {
|
|
|
278
316
|
...this.extensionFields
|
|
279
317
|
};
|
|
280
318
|
}
|
|
319
|
+
/**
|
|
320
|
+
* Serializes the operation to a plain JavaScript object.
|
|
321
|
+
*
|
|
322
|
+
* @returns Plain object representation of the operation
|
|
323
|
+
*/
|
|
281
324
|
toJSON() {
|
|
282
325
|
return {
|
|
283
326
|
tags: this.tags,
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { type OasParameterData } from '../parameter/parameter-types.js';
|
|
2
|
+
import { type OasPathItemData } from '../pathItem/pathItem-types.js';
|
|
3
|
+
import { type OasParameterRefData, type OasRequestBodyRefData, type OasResponseRefData } from '../ref/ref-types.js';
|
|
4
|
+
import { type OasRequestBodyData } from '../requestBody/requestBody-types.js';
|
|
5
|
+
import { type OasResponseData } from '../response/response-types.js';
|
|
6
|
+
import * as v from 'valibot';
|
|
7
|
+
export type OasOperationData = {
|
|
8
|
+
oasType: 'operation';
|
|
9
|
+
pathItem: OasPathItemData;
|
|
10
|
+
path: string;
|
|
11
|
+
method: 'get' | 'put' | 'post' | 'delete' | 'options' | 'head' | 'patch' | 'trace';
|
|
12
|
+
operationId?: string;
|
|
13
|
+
tags?: string[];
|
|
14
|
+
summary?: string;
|
|
15
|
+
description?: string;
|
|
16
|
+
parameters?: (OasParameterData | OasParameterRefData)[];
|
|
17
|
+
requestBody?: OasRequestBodyData | OasRequestBodyRefData;
|
|
18
|
+
responses: Record<string, OasResponseData | OasResponseRefData>;
|
|
19
|
+
deprecated?: boolean;
|
|
20
|
+
};
|
|
21
|
+
export declare const oasOperationData: v.GenericSchema<OasOperationData>;
|
|
22
|
+
//# sourceMappingURL=operation-types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"operation-types.d.ts","sourceRoot":"","sources":["../../../src/oas/operation/operation-types.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,gBAAgB,EAAoB,MAAM,iCAAiC,CAAA;AACzF,OAAO,EAAE,KAAK,eAAe,EAAmB,MAAM,+BAA+B,CAAA;AACrF,OAAO,EACL,KAAK,mBAAmB,EACxB,KAAK,qBAAqB,EAC1B,KAAK,kBAAkB,EAIxB,MAAM,qBAAqB,CAAA;AAC5B,OAAO,EAAE,KAAK,kBAAkB,EAAsB,MAAM,qCAAqC,CAAA;AACjG,OAAO,EAAE,KAAK,eAAe,EAAmB,MAAM,+BAA+B,CAAA;AACrF,OAAO,KAAK,CAAC,MAAM,SAAS,CAAA;AAE5B,MAAM,MAAM,gBAAgB,GAAG;IAC7B,OAAO,EAAE,WAAW,CAAA;IACpB,QAAQ,EAAE,eAAe,CAAA;IACzB,IAAI,EAAE,MAAM,CAAA;IACZ,MAAM,EAAE,KAAK,GAAG,KAAK,GAAG,MAAM,GAAG,QAAQ,GAAG,SAAS,GAAG,MAAM,GAAG,OAAO,GAAG,OAAO,CAAA;IAClF,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,IAAI,CAAC,EAAE,MAAM,EAAE,CAAA;IACf,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,WAAW,CAAC,EAAE,MAAM,CAAA;IAGpB,UAAU,CAAC,EAAE,CAAC,gBAAgB,GAAG,mBAAmB,CAAC,EAAE,CAAA;IACvD,WAAW,CAAC,EAAE,kBAAkB,GAAG,qBAAqB,CAAA;IACxD,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,eAAe,GAAG,kBAAkB,CAAC,CAAA;IAE/D,UAAU,CAAC,EAAE,OAAO,CAAA;CAGrB,CAAA;AAED,eAAO,MAAM,gBAAgB,EAAE,CAAC,CAAC,aAAa,CAAC,gBAAgB,CA2B7D,CAAA"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { markdown } from '../markdown/markdown-types.js';
|
|
2
|
+
import { oasParameterData } from '../parameter/parameter-types.js';
|
|
3
|
+
import { oasPathItemData } from '../pathItem/pathItem-types.js';
|
|
4
|
+
import { oasParameterRefData, oasRequestBodyRefData, oasResponseRefData } from '../ref/ref-types.js';
|
|
5
|
+
import { oasRequestBodyData } from '../requestBody/requestBody-types.js';
|
|
6
|
+
import { oasResponseData } from '../response/response-types.js';
|
|
7
|
+
import * as v from 'valibot';
|
|
8
|
+
export const oasOperationData = v.object({
|
|
9
|
+
oasType: v.literal('operation'),
|
|
10
|
+
pathItem: oasPathItemData,
|
|
11
|
+
path: v.string(),
|
|
12
|
+
method: v.enum({
|
|
13
|
+
get: 'get',
|
|
14
|
+
put: 'put',
|
|
15
|
+
post: 'post',
|
|
16
|
+
delete: 'delete',
|
|
17
|
+
options: 'options',
|
|
18
|
+
head: 'head',
|
|
19
|
+
patch: 'patch',
|
|
20
|
+
trace: 'trace'
|
|
21
|
+
}),
|
|
22
|
+
operationId: v.optional(v.string()),
|
|
23
|
+
tags: v.optional(v.array(v.string())),
|
|
24
|
+
summary: v.optional(v.string()),
|
|
25
|
+
description: v.optional(markdown),
|
|
26
|
+
// externalDocs: externalDocs.optional(),
|
|
27
|
+
// operationId: z.string().optional(),
|
|
28
|
+
parameters: v.optional(v.array(v.union([oasParameterData, oasParameterRefData]))),
|
|
29
|
+
requestBody: v.optional(v.union([oasRequestBodyData, oasRequestBodyRefData])),
|
|
30
|
+
responses: v.record(v.string(), v.union([oasResponseData, oasResponseRefData])),
|
|
31
|
+
// callbacks: z.never(),
|
|
32
|
+
deprecated: v.optional(v.boolean())
|
|
33
|
+
// security: z.never(),
|
|
34
|
+
// servers: z.array(server).optional()
|
|
35
|
+
});
|
|
@@ -4,22 +4,9 @@ import { type OasExampleRefData, type OasSchemaRefData } from '../ref/ref-types.
|
|
|
4
4
|
import { type OasSchemaData } from '../schema/schema-types.js';
|
|
5
5
|
import * as v from 'valibot';
|
|
6
6
|
export type OasParameterLocation = 'query' | 'header' | 'path' | 'cookie';
|
|
7
|
-
export declare const oasParameterLocation: v.
|
|
8
|
-
readonly query: "query";
|
|
9
|
-
readonly header: "header";
|
|
10
|
-
readonly path: "path";
|
|
11
|
-
readonly cookie: "cookie";
|
|
12
|
-
}, undefined>;
|
|
7
|
+
export declare const oasParameterLocation: v.GenericSchema<OasParameterLocation>;
|
|
13
8
|
export type OasParameterStyle = 'matrix' | 'label' | 'form' | 'simple' | 'spaceDelimited' | 'pipeDelimited' | 'deepObject';
|
|
14
|
-
export declare const oasParameterStyle: v.
|
|
15
|
-
readonly matrix: "matrix";
|
|
16
|
-
readonly label: "label";
|
|
17
|
-
readonly form: "form";
|
|
18
|
-
readonly simple: "simple";
|
|
19
|
-
readonly spaceDelimited: "spaceDelimited";
|
|
20
|
-
readonly pipeDelimited: "pipeDelimited";
|
|
21
|
-
readonly deepObject: "deepObject";
|
|
22
|
-
}, undefined>;
|
|
9
|
+
export declare const oasParameterStyle: v.GenericSchema<OasParameterStyle>;
|
|
23
10
|
export type OasParameterData = {
|
|
24
11
|
oasType: 'parameter';
|
|
25
12
|
allowEmptyValue?: boolean;
|
|
@@ -35,47 +22,5 @@ export type OasParameterData = {
|
|
|
35
22
|
schema?: OasSchemaData | OasSchemaRefData;
|
|
36
23
|
style: OasParameterStyle;
|
|
37
24
|
};
|
|
38
|
-
export declare const oasParameterData: v.
|
|
39
|
-
readonly oasType: v.LiteralSchema<"parameter", undefined>;
|
|
40
|
-
readonly allowEmptyValue: v.OptionalSchema<v.BooleanSchema<undefined>, undefined>;
|
|
41
|
-
readonly allowReserved: v.OptionalSchema<v.BooleanSchema<undefined>, undefined>;
|
|
42
|
-
readonly content: v.OptionalSchema<v.RecordSchema<v.StringSchema<undefined>, v.ObjectSchema<{
|
|
43
|
-
readonly oasType: v.LiteralSchema<"mediaType", undefined>;
|
|
44
|
-
readonly mediaType: v.StringSchema<undefined>;
|
|
45
|
-
readonly schema: v.OptionalSchema<v.UnionSchema<[v.GenericSchema<OasSchemaData>, v.GenericSchema<OasSchemaRefData>], undefined>, undefined>;
|
|
46
|
-
readonly examples: v.OptionalSchema<v.RecordSchema<v.StringSchema<undefined>, v.UnionSchema<[v.ObjectSchema<{
|
|
47
|
-
readonly oasType: v.LiteralSchema<"example", undefined>;
|
|
48
|
-
readonly summary: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
|
|
49
|
-
readonly description: v.OptionalSchema<v.GenericSchema<string>, undefined>;
|
|
50
|
-
readonly value: v.OptionalSchema<v.UnknownSchema, undefined>;
|
|
51
|
-
}, undefined>, v.GenericSchema<OasExampleRefData>], undefined>, undefined>, undefined>;
|
|
52
|
-
}, undefined>, undefined>, undefined>;
|
|
53
|
-
readonly deprecated: v.OptionalSchema<v.BooleanSchema<undefined>, undefined>;
|
|
54
|
-
readonly description: v.OptionalSchema<v.GenericSchema<string>, undefined>;
|
|
55
|
-
readonly examples: v.OptionalSchema<v.RecordSchema<v.StringSchema<undefined>, v.UnionSchema<[v.ObjectSchema<{
|
|
56
|
-
readonly oasType: v.LiteralSchema<"example", undefined>;
|
|
57
|
-
readonly summary: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
|
|
58
|
-
readonly description: v.OptionalSchema<v.GenericSchema<string>, undefined>;
|
|
59
|
-
readonly value: v.OptionalSchema<v.UnknownSchema, undefined>;
|
|
60
|
-
}, undefined>, v.GenericSchema<OasExampleRefData>], undefined>, undefined>, undefined>;
|
|
61
|
-
readonly explode: v.BooleanSchema<undefined>;
|
|
62
|
-
readonly location: v.EnumSchema<{
|
|
63
|
-
readonly query: "query";
|
|
64
|
-
readonly header: "header";
|
|
65
|
-
readonly path: "path";
|
|
66
|
-
readonly cookie: "cookie";
|
|
67
|
-
}, undefined>;
|
|
68
|
-
readonly name: v.StringSchema<undefined>;
|
|
69
|
-
readonly required: v.OptionalSchema<v.BooleanSchema<undefined>, undefined>;
|
|
70
|
-
readonly schema: v.OptionalSchema<v.UnionSchema<[v.GenericSchema<OasSchemaData>, v.GenericSchema<OasSchemaRefData>], undefined>, undefined>;
|
|
71
|
-
readonly style: v.EnumSchema<{
|
|
72
|
-
readonly matrix: "matrix";
|
|
73
|
-
readonly label: "label";
|
|
74
|
-
readonly form: "form";
|
|
75
|
-
readonly simple: "simple";
|
|
76
|
-
readonly spaceDelimited: "spaceDelimited";
|
|
77
|
-
readonly pipeDelimited: "pipeDelimited";
|
|
78
|
-
readonly deepObject: "deepObject";
|
|
79
|
-
}, undefined>;
|
|
80
|
-
}, undefined>;
|
|
25
|
+
export declare const oasParameterData: v.GenericSchema<OasParameterData>;
|
|
81
26
|
//# sourceMappingURL=parameter-types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"parameter-types.d.ts","sourceRoot":"","sources":["../../../src/oas/parameter/parameter-types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,cAAc,EAAkB,MAAM,6BAA6B,CAAA;AAEjF,OAAO,EAAE,KAAK,gBAAgB,EAAoB,MAAM,iCAAiC,CAAA;AACzF,OAAO,EACL,KAAK,iBAAiB,EACtB,KAAK,gBAAgB,EAGtB,MAAM,qBAAqB,CAAA;AAC5B,OAAO,EAAE,KAAK,aAAa,EAAiB,MAAM,2BAA2B,CAAA;AAC7E,OAAO,KAAK,CAAC,MAAM,SAAS,CAAA;AAE5B,MAAM,MAAM,oBAAoB,GAAG,OAAO,GAAG,QAAQ,GAAG,MAAM,GAAG,QAAQ,CAAA;AAEzE,eAAO,MAAM,oBAAoB
|
|
1
|
+
{"version":3,"file":"parameter-types.d.ts","sourceRoot":"","sources":["../../../src/oas/parameter/parameter-types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,cAAc,EAAkB,MAAM,6BAA6B,CAAA;AAEjF,OAAO,EAAE,KAAK,gBAAgB,EAAoB,MAAM,iCAAiC,CAAA;AACzF,OAAO,EACL,KAAK,iBAAiB,EACtB,KAAK,gBAAgB,EAGtB,MAAM,qBAAqB,CAAA;AAC5B,OAAO,EAAE,KAAK,aAAa,EAAiB,MAAM,2BAA2B,CAAA;AAC7E,OAAO,KAAK,CAAC,MAAM,SAAS,CAAA;AAE5B,MAAM,MAAM,oBAAoB,GAAG,OAAO,GAAG,QAAQ,GAAG,MAAM,GAAG,QAAQ,CAAA;AAEzE,eAAO,MAAM,oBAAoB,EAAE,CAAC,CAAC,aAAa,CAAC,oBAAoB,CAKrE,CAAA;AAEF,MAAM,MAAM,iBAAiB,GACzB,QAAQ,GACR,OAAO,GACP,MAAM,GACN,QAAQ,GACR,gBAAgB,GAChB,eAAe,GACf,YAAY,CAAA;AAEhB,eAAO,MAAM,iBAAiB,EAAE,CAAC,CAAC,aAAa,CAAC,iBAAiB,CAQ/D,CAAA;AAEF,MAAM,MAAM,gBAAgB,GAAG;IAC7B,OAAO,EAAE,WAAW,CAAA;IACpB,eAAe,CAAC,EAAE,OAAO,CAAA;IACzB,aAAa,CAAC,EAAE,OAAO,CAAA;IACvB,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,gBAAgB,CAAC,CAAA;IAC1C,UAAU,CAAC,EAAE,OAAO,CAAA;IACpB,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,cAAc,GAAG,iBAAiB,CAAC,CAAA;IAC7D,OAAO,EAAE,OAAO,CAAA;IAChB,QAAQ,EAAE,oBAAoB,CAAA;IAC9B,IAAI,EAAE,MAAM,CAAA;IACZ,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,MAAM,CAAC,EAAE,aAAa,GAAG,gBAAgB,CAAA;IACzC,KAAK,EAAE,iBAAiB,CAAA;CACzB,CAAA;AAED,eAAO,MAAM,gBAAgB,EAAE,CAAC,CAAC,aAAa,CAAC,gBAAgB,CAc7D,CAAA"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { type OasParameterData } from '../parameter/parameter-types.js';
|
|
2
|
+
import { type OasParameterRefData } from '../ref/ref-types.js';
|
|
3
|
+
import * as v from 'valibot';
|
|
4
|
+
export type OasPathItemData = {
|
|
5
|
+
oasType: 'pathItem';
|
|
6
|
+
$ref?: string;
|
|
7
|
+
summary?: string;
|
|
8
|
+
description?: string;
|
|
9
|
+
parameters?: (OasParameterData | OasParameterRefData)[];
|
|
10
|
+
};
|
|
11
|
+
export declare const oasPathItemData: v.GenericSchema<OasPathItemData>;
|
|
12
|
+
//# sourceMappingURL=pathItem-types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pathItem-types.d.ts","sourceRoot":"","sources":["../../../src/oas/pathItem/pathItem-types.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,gBAAgB,EAAoB,MAAM,iCAAiC,CAAA;AACzF,OAAO,EAAE,KAAK,mBAAmB,EAAuB,MAAM,qBAAqB,CAAA;AACnF,OAAO,KAAK,CAAC,MAAM,SAAS,CAAA;AAE5B,MAAM,MAAM,eAAe,GAAG;IAC5B,OAAO,EAAE,UAAU,CAAA;IACnB,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,WAAW,CAAC,EAAE,MAAM,CAAA;IAEpB,UAAU,CAAC,EAAE,CAAC,gBAAgB,GAAG,mBAAmB,CAAC,EAAE,CAAA;CACxD,CAAA;AAED,eAAO,MAAM,eAAe,EAAE,CAAC,CAAC,aAAa,CAAC,eAAe,CAO3D,CAAA"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { markdown } from '../markdown/markdown-types.js';
|
|
2
|
+
import { oasParameterData } from '../parameter/parameter-types.js';
|
|
3
|
+
import { oasParameterRefData } from '../ref/ref-types.js';
|
|
4
|
+
import * as v from 'valibot';
|
|
5
|
+
export const oasPathItemData = v.object({
|
|
6
|
+
oasType: v.literal('pathItem'),
|
|
7
|
+
$ref: v.optional(v.string()),
|
|
8
|
+
summary: v.optional(v.string()),
|
|
9
|
+
description: v.optional(markdown),
|
|
10
|
+
// servers: z.array(server).optional(),
|
|
11
|
+
parameters: v.optional(v.array(v.union([oasParameterData, oasParameterRefData])))
|
|
12
|
+
});
|
package/esm/oas/ref/Ref.d.ts
CHANGED
|
@@ -10,6 +10,11 @@ import type { OasDocument } from '../document/Document.js';
|
|
|
10
10
|
import type { RefName } from '../../types/RefName.js';
|
|
11
11
|
import type { OpenAPIV3 } from 'openapi-types';
|
|
12
12
|
import type { OasSecurityScheme } from '../securitySchemes/SecurityScheme.js';
|
|
13
|
+
/**
|
|
14
|
+
* Field data for creating OAS reference objects.
|
|
15
|
+
*
|
|
16
|
+
* @template T - The type of component being referenced (e.g., 'schema', 'response')
|
|
17
|
+
*/
|
|
13
18
|
export type RefFields<T extends OasRefData['refType']> = {
|
|
14
19
|
refType: T;
|
|
15
20
|
$ref: string;
|
|
@@ -102,11 +107,39 @@ export type RefFields<T extends OasRefData['refType']> = {
|
|
|
102
107
|
*/
|
|
103
108
|
export declare class OasRef<T extends OasRefData['refType']> {
|
|
104
109
|
#private;
|
|
110
|
+
/** OAS type identifier */
|
|
105
111
|
oasType: 'ref';
|
|
112
|
+
/** Type identifier */
|
|
106
113
|
type: 'ref';
|
|
114
|
+
/**
|
|
115
|
+
* Creates a new OAS reference instance.
|
|
116
|
+
*
|
|
117
|
+
* @param fields - Reference field data including refType and $ref
|
|
118
|
+
* @param oasDocument - Document containing the referenced component
|
|
119
|
+
*/
|
|
107
120
|
constructor(fields: RefFields<T>, oasDocument: OasDocument);
|
|
121
|
+
/**
|
|
122
|
+
* Type guard to check if this instance is a reference.
|
|
123
|
+
*
|
|
124
|
+
* @returns Always true for OasRef instances
|
|
125
|
+
*/
|
|
108
126
|
isRef(): this is OasRef<T>;
|
|
127
|
+
/**
|
|
128
|
+
* Recursively resolves this reference to its final target component.
|
|
129
|
+
*
|
|
130
|
+
* Follows reference chains until reaching a non-reference component,
|
|
131
|
+
* with protection against infinite loops.
|
|
132
|
+
*
|
|
133
|
+
* @param lookupsPerformed - Internal counter to prevent infinite recursion
|
|
134
|
+
* @returns The resolved component
|
|
135
|
+
* @throws Error if maximum lookup depth is exceeded
|
|
136
|
+
*/
|
|
109
137
|
resolve(lookupsPerformed?: number): ResolvedRef<T>;
|
|
138
|
+
/**
|
|
139
|
+
* Resolves this reference one level, potentially returning another reference.
|
|
140
|
+
*
|
|
141
|
+
* @returns Either the resolved component or another reference in the chain
|
|
142
|
+
*/
|
|
110
143
|
resolveOnce(): OasRef<T> | ResolvedRef<T>;
|
|
111
144
|
toRefName(): RefName;
|
|
112
145
|
get $ref(): string;
|
|
@@ -115,10 +148,24 @@ export declare class OasRef<T extends OasRefData['refType']> {
|
|
|
115
148
|
toJsonSchema({ resolve }: ToJsonSchemaOptions): OpenAPIV3.ReferenceObject | ResolvedRefJsonType<T>;
|
|
116
149
|
toJSON(): object;
|
|
117
150
|
}
|
|
118
|
-
|
|
151
|
+
/**
|
|
152
|
+
* Type representing the JSON schema result from resolving a reference.
|
|
153
|
+
*
|
|
154
|
+
* @template T - The type of component being referenced
|
|
155
|
+
*/
|
|
156
|
+
export type ResolvedRefJsonType<T extends OasRefData['refType']> = ReturnType<ResolvedRef<T>['toJsonSchema']>;
|
|
157
|
+
/**
|
|
158
|
+
* Union type of all OAS component types that can be referenced.
|
|
159
|
+
*
|
|
160
|
+
* Includes all OpenAPI component types that support $ref resolution.
|
|
161
|
+
*/
|
|
119
162
|
export type OasComponentType = OasSchema | OasResponse | OasParameter | OasExample | OasRequestBody | OasHeader | OasSecurityScheme;
|
|
163
|
+
/**
|
|
164
|
+
* Type representing a resolved reference to a specific component type.
|
|
165
|
+
*
|
|
166
|
+
* @template T - The type of component being referenced (e.g., 'schema', 'response')
|
|
167
|
+
*/
|
|
120
168
|
export type ResolvedRef<T extends OasRefData['refType']> = Extract<OasComponentType, {
|
|
121
169
|
oasType: T;
|
|
122
170
|
}>;
|
|
123
|
-
export {};
|
|
124
171
|
//# sourceMappingURL=Ref.d.ts.map
|
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,yBAAyB,CAAC;AACjC,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAA;AAGhD,OAAO,KAAK,EAAE,SAAS,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAA;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AEjB;IAED,IAAI,OAAO,IAAI,UAAU,CAAC,SAAS,CAAC,CAEnC;IAED,IAAI,WAAW,IAAI,WAAW,CAE7B;IAED,YAAY,CAAC,EACX,OAAO,EACR,EAAE,mBAAmB,GAAG,SAAS,CAAC,eAAe,GAAG,mBAAmB,CAAC,CAAC,CAAC;IAsB3E,MAAM,IAAI,MAAM;CAajB;AAED;;;;GAIG;AACH,MAAM,MAAM,mBAAmB,CAAC,CAAC,SAAS,UAAU,CAAC,SAAS,CAAC,IAAI,UAAU,CAC3E,WAAW,CAAC,CAAC,CAAC,CAAC,cAAc,CAAC,CAC/B,CAAA;AAED;;;;GAIG;AACH,MAAM,MAAM,gBAAgB,GACxB,SAAS,GACT,WAAW,GACX,YAAY,GACZ,UAAU,GACV,cAAc,GACd,SAAS,GACT,iBAAiB,CAAA;AAErB;;;;GAIG;AACH,MAAM,MAAM,WAAW,CAAC,CAAC,SAAS,UAAU,CAAC,SAAS,CAAC,IAAI,OAAO,CAAC,gBAAgB,EAAE;IAAE,OAAO,EAAE,CAAC,CAAA;CAAE,CAAC,CAAA"}
|
package/esm/oas/ref/Ref.js
CHANGED
|
@@ -101,13 +101,21 @@ const MAX_LOOKUPS = 10;
|
|
|
101
101
|
* ```
|
|
102
102
|
*/
|
|
103
103
|
export class OasRef {
|
|
104
|
+
/**
|
|
105
|
+
* Creates a new OAS reference instance.
|
|
106
|
+
*
|
|
107
|
+
* @param fields - Reference field data including refType and $ref
|
|
108
|
+
* @param oasDocument - Document containing the referenced component
|
|
109
|
+
*/
|
|
104
110
|
constructor(fields, oasDocument) {
|
|
111
|
+
/** OAS type identifier */
|
|
105
112
|
Object.defineProperty(this, "oasType", {
|
|
106
113
|
enumerable: true,
|
|
107
114
|
configurable: true,
|
|
108
115
|
writable: true,
|
|
109
116
|
value: 'ref'
|
|
110
117
|
});
|
|
118
|
+
/** Type identifier */
|
|
111
119
|
Object.defineProperty(this, "type", {
|
|
112
120
|
enumerable: true,
|
|
113
121
|
configurable: true,
|
|
@@ -119,9 +127,24 @@ export class OasRef {
|
|
|
119
127
|
__classPrivateFieldSet(this, _OasRef_fields, fields, "f");
|
|
120
128
|
__classPrivateFieldSet(this, _OasRef_oasDocument, oasDocument, "f");
|
|
121
129
|
}
|
|
130
|
+
/**
|
|
131
|
+
* Type guard to check if this instance is a reference.
|
|
132
|
+
*
|
|
133
|
+
* @returns Always true for OasRef instances
|
|
134
|
+
*/
|
|
122
135
|
isRef() {
|
|
123
136
|
return true;
|
|
124
137
|
}
|
|
138
|
+
/**
|
|
139
|
+
* Recursively resolves this reference to its final target component.
|
|
140
|
+
*
|
|
141
|
+
* Follows reference chains until reaching a non-reference component,
|
|
142
|
+
* with protection against infinite loops.
|
|
143
|
+
*
|
|
144
|
+
* @param lookupsPerformed - Internal counter to prevent infinite recursion
|
|
145
|
+
* @returns The resolved component
|
|
146
|
+
* @throws Error if maximum lookup depth is exceeded
|
|
147
|
+
*/
|
|
125
148
|
resolve(lookupsPerformed = 0) {
|
|
126
149
|
if (lookupsPerformed >= MAX_LOOKUPS) {
|
|
127
150
|
throw new Error('Max lookups reached');
|
|
@@ -129,6 +152,11 @@ export class OasRef {
|
|
|
129
152
|
const resolved = this.resolveOnce();
|
|
130
153
|
return resolved.isRef() ? resolved.resolve(lookupsPerformed + 1) : resolved;
|
|
131
154
|
}
|
|
155
|
+
/**
|
|
156
|
+
* Resolves this reference one level, potentially returning another reference.
|
|
157
|
+
*
|
|
158
|
+
* @returns Either the resolved component or another reference in the chain
|
|
159
|
+
*/
|
|
132
160
|
resolveOnce() {
|
|
133
161
|
const c = this.oasDocument.components;
|
|
134
162
|
const refName = toRefName(this.$ref);
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { type OasMediaTypeData } from '../mediaType/mediaType-types.js';
|
|
2
|
+
import * as v from 'valibot';
|
|
3
|
+
export type OasRequestBodyData = {
|
|
4
|
+
oasType: 'requestBody';
|
|
5
|
+
description?: string;
|
|
6
|
+
content: Record<string, OasMediaTypeData>;
|
|
7
|
+
required?: boolean;
|
|
8
|
+
};
|
|
9
|
+
export declare const oasRequestBodyData: v.GenericSchema<OasRequestBodyData>;
|
|
10
|
+
//# sourceMappingURL=requestBody-types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"requestBody-types.d.ts","sourceRoot":"","sources":["../../../src/oas/requestBody/requestBody-types.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,gBAAgB,EAAoB,MAAM,iCAAiC,CAAA;AACzF,OAAO,KAAK,CAAC,MAAM,SAAS,CAAA;AAE5B,MAAM,MAAM,kBAAkB,GAAG;IAC/B,OAAO,EAAE,aAAa,CAAA;IACtB,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,gBAAgB,CAAC,CAAA;IACzC,QAAQ,CAAC,EAAE,OAAO,CAAA;CACnB,CAAA;AAED,eAAO,MAAM,kBAAkB,EAAE,CAAC,CAAC,aAAa,CAAC,kBAAkB,CAKjE,CAAA"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { markdown } from '../markdown/markdown-types.js';
|
|
2
|
+
import { oasMediaTypeData } from '../mediaType/mediaType-types.js';
|
|
3
|
+
import * as v from 'valibot';
|
|
4
|
+
export const oasRequestBodyData = v.object({
|
|
5
|
+
oasType: v.literal('requestBody'),
|
|
6
|
+
description: v.optional(markdown),
|
|
7
|
+
content: v.record(v.string(), oasMediaTypeData),
|
|
8
|
+
required: v.optional(v.boolean())
|
|
9
|
+
});
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { type OasHeaderData } from '../header/header-types.js';
|
|
2
|
+
import { type OasMediaTypeData } from '../mediaType/mediaType-types.js';
|
|
3
|
+
import { type OasHeaderRefData } from '../ref/ref-types.js';
|
|
4
|
+
import * as v from 'valibot';
|
|
5
|
+
export type OasResponseData = {
|
|
6
|
+
oasType: 'response';
|
|
7
|
+
description: string;
|
|
8
|
+
headers?: Record<string, OasHeaderData | OasHeaderRefData>;
|
|
9
|
+
content?: Record<string, OasMediaTypeData>;
|
|
10
|
+
};
|
|
11
|
+
export declare const oasResponseData: v.GenericSchema<OasResponseData>;
|
|
12
|
+
//# sourceMappingURL=response-types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"response-types.d.ts","sourceRoot":"","sources":["../../../src/oas/response/response-types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,aAAa,EAAiB,MAAM,2BAA2B,CAAA;AAC7E,OAAO,EAAE,KAAK,gBAAgB,EAAoB,MAAM,iCAAiC,CAAA;AACzF,OAAO,EAAE,KAAK,gBAAgB,EAAoB,MAAM,qBAAqB,CAAA;AAC7E,OAAO,KAAK,CAAC,MAAM,SAAS,CAAA;AAE5B,MAAM,MAAM,eAAe,GAAG;IAC5B,OAAO,EAAE,UAAU,CAAA;IACnB,WAAW,EAAE,MAAM,CAAA;IACnB,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,aAAa,GAAG,gBAAgB,CAAC,CAAA;IAC1D,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,gBAAgB,CAAC,CAAA;CAE3C,CAAA;AAED,eAAO,MAAM,eAAe,EAAE,CAAC,CAAC,aAAa,CAAC,eAAe,CAM3D,CAAA"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { oasHeaderData } from '../header/header-types.js';
|
|
2
|
+
import { oasMediaTypeData } from '../mediaType/mediaType-types.js';
|
|
3
|
+
import { oasHeaderRefData } from '../ref/ref-types.js';
|
|
4
|
+
import * as v from 'valibot';
|
|
5
|
+
export const oasResponseData = v.object({
|
|
6
|
+
oasType: v.literal('response'),
|
|
7
|
+
description: v.string(),
|
|
8
|
+
headers: v.optional(v.record(v.string(), v.union([oasHeaderData, oasHeaderRefData]))),
|
|
9
|
+
content: v.optional(v.record(v.string(), oasMediaTypeData))
|
|
10
|
+
// links: z.record(z.union([link, ref])).optional()
|
|
11
|
+
});
|
|
@@ -80,8 +80,8 @@ export const toSchemaV3 = ({ schema, context }) => {
|
|
|
80
80
|
})
|
|
81
81
|
.with({ anyOf: P.array() }, matched => {
|
|
82
82
|
return context.trace('anyOf', () => {
|
|
83
|
-
const
|
|
84
|
-
const
|
|
83
|
+
const _lastThree = context.stackTrail.slice(-3).toString();
|
|
84
|
+
const _lastFive = context.stackTrail.slice(-5).toString();
|
|
85
85
|
// deno-lint-ignore ban-ts-comment
|
|
86
86
|
// @ts-expect-error
|
|
87
87
|
if (matched['x-expansionResources']) {
|