@skmtc/core 0.0.802 → 0.0.803
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 +3 -0
- package/esm/context/CoreContext.d.ts.map +1 -1
- package/esm/context/CoreContext.js +17 -12
- package/esm/context/GenerateContext.d.ts +2 -1
- package/esm/context/GenerateContext.d.ts.map +1 -1
- package/esm/context/ParseContext.d.ts +3 -3
- package/esm/context/ParseContext.d.ts.map +1 -1
- package/esm/context/RenderContext.d.ts +4 -1
- package/esm/context/RenderContext.d.ts.map +1 -1
- package/esm/context/RenderContext.js +11 -6
- package/esm/dsl/operation/OperationDriver.d.ts +36 -0
- package/esm/dsl/operation/OperationDriver.d.ts.map +1 -1
- package/esm/dsl/operation/OperationDriver.js +36 -0
- package/esm/dsl/operation/toOperationBase.d.ts +58 -0
- package/esm/dsl/operation/toOperationBase.d.ts.map +1 -1
- package/esm/dsl/operation/toOperationBase.js +46 -0
- package/esm/dsl/operation/toOperationEntry.d.ts +37 -0
- package/esm/dsl/operation/toOperationEntry.d.ts.map +1 -1
- package/esm/dsl/operation/toOperationEntry.js +28 -0
- package/esm/mod.d.ts +1 -0
- package/esm/mod.d.ts.map +1 -1
- package/esm/mod.js +1 -0
- package/esm/oas/array/Array.d.ts +26 -0
- package/esm/oas/array/Array.d.ts.map +1 -1
- package/esm/oas/array/Array.js +26 -0
- package/esm/oas/array/array-types.d.ts +12 -0
- package/esm/oas/array/array-types.d.ts.map +1 -1
- package/esm/oas/array/array-types.js +6 -0
- package/esm/oas/boolean/Boolean.d.ts +26 -0
- package/esm/oas/boolean/Boolean.d.ts.map +1 -1
- package/esm/oas/boolean/Boolean.js +26 -0
- package/esm/oas/boolean/toBoolean.d.ts +57 -0
- package/esm/oas/boolean/toBoolean.d.ts.map +1 -1
- package/esm/oas/boolean/toBoolean.js +57 -0
- package/esm/oas/number/toNumber.d.ts +62 -0
- package/esm/oas/number/toNumber.d.ts.map +1 -1
- package/esm/oas/number/toNumber.js +62 -0
- package/esm/oas/parameter/Parameter.d.ts +47 -0
- package/esm/oas/parameter/Parameter.d.ts.map +1 -1
- package/esm/oas/parameter/Parameter.js +47 -0
- package/esm/types/CustomValue.d.ts +58 -0
- package/esm/types/CustomValue.d.ts.map +1 -1
- package/esm/types/CustomValue.js +58 -0
- package/esm/types/DenoJson.d.ts +24 -0
- package/esm/types/DenoJson.d.ts.map +1 -1
- package/esm/types/DenoJson.js +12 -0
- package/esm/types/Enrichments.d.ts +103 -0
- package/esm/types/Enrichments.d.ts.map +1 -1
- package/esm/types/Enrichments.js +52 -0
- package/esm/types/GeneratedValue.d.ts +17 -0
- package/esm/types/GeneratedValue.d.ts.map +1 -1
- package/esm/types/Logger.d.ts +9 -0
- package/esm/types/Logger.d.ts.map +1 -0
- package/esm/types/Logger.js +1 -0
- package/package.json +1 -1
- package/script/context/CoreContext.d.ts +3 -0
- package/script/context/CoreContext.d.ts.map +1 -1
- package/script/context/CoreContext.js +17 -12
- package/script/context/GenerateContext.d.ts +2 -1
- package/script/context/GenerateContext.d.ts.map +1 -1
- package/script/context/ParseContext.d.ts +3 -3
- package/script/context/ParseContext.d.ts.map +1 -1
- package/script/context/RenderContext.d.ts +4 -1
- package/script/context/RenderContext.d.ts.map +1 -1
- package/script/context/RenderContext.js +11 -6
- package/script/dsl/operation/OperationDriver.d.ts +36 -0
- package/script/dsl/operation/OperationDriver.d.ts.map +1 -1
- package/script/dsl/operation/OperationDriver.js +36 -0
- package/script/dsl/operation/toOperationBase.d.ts +58 -0
- package/script/dsl/operation/toOperationBase.d.ts.map +1 -1
- package/script/dsl/operation/toOperationBase.js +46 -0
- package/script/dsl/operation/toOperationEntry.d.ts +37 -0
- package/script/dsl/operation/toOperationEntry.d.ts.map +1 -1
- package/script/dsl/operation/toOperationEntry.js +28 -0
- package/script/mod.d.ts +1 -0
- package/script/mod.d.ts.map +1 -1
- package/script/mod.js +1 -0
- package/script/oas/array/Array.d.ts +26 -0
- package/script/oas/array/Array.d.ts.map +1 -1
- package/script/oas/array/Array.js +26 -0
- package/script/oas/array/array-types.d.ts +12 -0
- package/script/oas/array/array-types.d.ts.map +1 -1
- package/script/oas/array/array-types.js +6 -0
- package/script/oas/boolean/Boolean.d.ts +26 -0
- package/script/oas/boolean/Boolean.d.ts.map +1 -1
- package/script/oas/boolean/Boolean.js +26 -0
- package/script/oas/boolean/toBoolean.d.ts +57 -0
- package/script/oas/boolean/toBoolean.d.ts.map +1 -1
- package/script/oas/boolean/toBoolean.js +57 -0
- package/script/oas/number/toNumber.d.ts +62 -0
- package/script/oas/number/toNumber.d.ts.map +1 -1
- package/script/oas/number/toNumber.js +62 -0
- package/script/oas/parameter/Parameter.d.ts +47 -0
- package/script/oas/parameter/Parameter.d.ts.map +1 -1
- package/script/oas/parameter/Parameter.js +47 -0
- package/script/types/CustomValue.d.ts +58 -0
- package/script/types/CustomValue.d.ts.map +1 -1
- package/script/types/CustomValue.js +58 -0
- package/script/types/DenoJson.d.ts +24 -0
- package/script/types/DenoJson.d.ts.map +1 -1
- package/script/types/DenoJson.js +12 -0
- package/script/types/Enrichments.d.ts +103 -0
- package/script/types/Enrichments.d.ts.map +1 -1
- package/script/types/Enrichments.js +52 -0
- package/script/types/GeneratedValue.d.ts +17 -0
- package/script/types/GeneratedValue.d.ts.map +1 -1
- package/script/types/Logger.d.ts +9 -0
- package/script/types/Logger.d.ts.map +1 -0
- package/script/types/Logger.js +2 -0
|
@@ -5,6 +5,68 @@ type ToNumberArgs = {
|
|
|
5
5
|
value: OpenAPIV3.SchemaObject;
|
|
6
6
|
context: ParseContext;
|
|
7
7
|
};
|
|
8
|
+
/**
|
|
9
|
+
* Transforms an OpenAPI v3 number schema object into an internal OAS number representation.
|
|
10
|
+
*
|
|
11
|
+
* This function processes OpenAPI number schemas by extracting and parsing nullable values,
|
|
12
|
+
* examples, enumerations, and default values. It handles the complete transformation from
|
|
13
|
+
* raw OpenAPI JSON to the SKMTC internal number representation with proper validation
|
|
14
|
+
* of number formats and constraints.
|
|
15
|
+
*
|
|
16
|
+
* The transformation follows a pipeline approach:
|
|
17
|
+
* 1. Parse nullable flag and extract base value
|
|
18
|
+
* 2. Parse example values with nullable support
|
|
19
|
+
* 3. Parse enumeration constraints
|
|
20
|
+
* 4. Parse default values
|
|
21
|
+
* 5. Create final OasNumber instance with format validation
|
|
22
|
+
*
|
|
23
|
+
* @param args - Transformation arguments
|
|
24
|
+
* @param args.context - Parse context providing utilities and tracing
|
|
25
|
+
* @param args.value - The OpenAPI v3 number schema object to transform
|
|
26
|
+
* @returns Transformed OAS number object with parsed properties
|
|
27
|
+
*
|
|
28
|
+
* @example Basic number transformation
|
|
29
|
+
* ```typescript
|
|
30
|
+
* import { toNumber } from '@skmtc/core';
|
|
31
|
+
*
|
|
32
|
+
* const openApiNumber = {
|
|
33
|
+
* type: 'number',
|
|
34
|
+
* format: 'double',
|
|
35
|
+
* minimum: 0,
|
|
36
|
+
* maximum: 100
|
|
37
|
+
* };
|
|
38
|
+
*
|
|
39
|
+
* const oasNumber = toNumber({
|
|
40
|
+
* context: parseContext,
|
|
41
|
+
* value: openApiNumber
|
|
42
|
+
* });
|
|
43
|
+
*
|
|
44
|
+
* console.log(oasNumber.format); // 'double'
|
|
45
|
+
* console.log(oasNumber.minimum); // 0
|
|
46
|
+
* ```
|
|
47
|
+
*
|
|
48
|
+
* @example Number with nullable and constraints
|
|
49
|
+
* ```typescript
|
|
50
|
+
* const priceNumber = {
|
|
51
|
+
* type: 'number',
|
|
52
|
+
* format: 'float',
|
|
53
|
+
* nullable: true,
|
|
54
|
+
* minimum: 0.01,
|
|
55
|
+
* maximum: 9999.99,
|
|
56
|
+
* exclusiveMaximum: true,
|
|
57
|
+
* default: null,
|
|
58
|
+
* example: 19.99
|
|
59
|
+
* };
|
|
60
|
+
*
|
|
61
|
+
* const oasNumber = toNumber({
|
|
62
|
+
* context: parseContext,
|
|
63
|
+
* value: priceNumber
|
|
64
|
+
* });
|
|
65
|
+
*
|
|
66
|
+
* console.log(oasNumber.nullable); // true
|
|
67
|
+
* console.log(oasNumber.exclusiveMaximum); // true
|
|
68
|
+
* ```
|
|
69
|
+
*/
|
|
8
70
|
export declare const toNumber: ({ context, value }: ToNumberArgs) => OasNumber;
|
|
9
71
|
export {};
|
|
10
72
|
//# sourceMappingURL=toNumber.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"toNumber.d.ts","sourceRoot":"","sources":["../../../src/oas/number/toNumber.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,eAAe,CAAA;AAC9C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAA;AACjE,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAA;AAQvC,KAAK,YAAY,GAAG;IAClB,KAAK,EAAE,SAAS,CAAC,YAAY,CAAA;IAC7B,OAAO,EAAE,YAAY,CAAA;CACtB,CAAA;AAED,eAAO,MAAM,QAAQ,GAAI,oBAAoB,YAAY,KAAG,SA2B3D,CAAA"}
|
|
1
|
+
{"version":3,"file":"toNumber.d.ts","sourceRoot":"","sources":["../../../src/oas/number/toNumber.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,eAAe,CAAA;AAC9C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAA;AACjE,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAA;AAQvC,KAAK,YAAY,GAAG;IAClB,KAAK,EAAE,SAAS,CAAC,YAAY,CAAA;IAC7B,OAAO,EAAE,YAAY,CAAA;CACtB,CAAA;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6DG;AACH,eAAO,MAAM,QAAQ,GAAI,oBAAoB,YAAY,KAAG,SA2B3D,CAAA"}
|
|
@@ -42,6 +42,68 @@ const parseNullable_js_1 = require("../_helpers/parseNullable.js");
|
|
|
42
42
|
const parseExample_js_1 = require("../_helpers/parseExample.js");
|
|
43
43
|
const parseEnum_js_1 = require("../_helpers/parseEnum.js");
|
|
44
44
|
const parseFormat_js_1 = require("../_helpers/parseFormat.js");
|
|
45
|
+
/**
|
|
46
|
+
* Transforms an OpenAPI v3 number schema object into an internal OAS number representation.
|
|
47
|
+
*
|
|
48
|
+
* This function processes OpenAPI number schemas by extracting and parsing nullable values,
|
|
49
|
+
* examples, enumerations, and default values. It handles the complete transformation from
|
|
50
|
+
* raw OpenAPI JSON to the SKMTC internal number representation with proper validation
|
|
51
|
+
* of number formats and constraints.
|
|
52
|
+
*
|
|
53
|
+
* The transformation follows a pipeline approach:
|
|
54
|
+
* 1. Parse nullable flag and extract base value
|
|
55
|
+
* 2. Parse example values with nullable support
|
|
56
|
+
* 3. Parse enumeration constraints
|
|
57
|
+
* 4. Parse default values
|
|
58
|
+
* 5. Create final OasNumber instance with format validation
|
|
59
|
+
*
|
|
60
|
+
* @param args - Transformation arguments
|
|
61
|
+
* @param args.context - Parse context providing utilities and tracing
|
|
62
|
+
* @param args.value - The OpenAPI v3 number schema object to transform
|
|
63
|
+
* @returns Transformed OAS number object with parsed properties
|
|
64
|
+
*
|
|
65
|
+
* @example Basic number transformation
|
|
66
|
+
* ```typescript
|
|
67
|
+
* import { toNumber } from '@skmtc/core';
|
|
68
|
+
*
|
|
69
|
+
* const openApiNumber = {
|
|
70
|
+
* type: 'number',
|
|
71
|
+
* format: 'double',
|
|
72
|
+
* minimum: 0,
|
|
73
|
+
* maximum: 100
|
|
74
|
+
* };
|
|
75
|
+
*
|
|
76
|
+
* const oasNumber = toNumber({
|
|
77
|
+
* context: parseContext,
|
|
78
|
+
* value: openApiNumber
|
|
79
|
+
* });
|
|
80
|
+
*
|
|
81
|
+
* console.log(oasNumber.format); // 'double'
|
|
82
|
+
* console.log(oasNumber.minimum); // 0
|
|
83
|
+
* ```
|
|
84
|
+
*
|
|
85
|
+
* @example Number with nullable and constraints
|
|
86
|
+
* ```typescript
|
|
87
|
+
* const priceNumber = {
|
|
88
|
+
* type: 'number',
|
|
89
|
+
* format: 'float',
|
|
90
|
+
* nullable: true,
|
|
91
|
+
* minimum: 0.01,
|
|
92
|
+
* maximum: 9999.99,
|
|
93
|
+
* exclusiveMaximum: true,
|
|
94
|
+
* default: null,
|
|
95
|
+
* example: 19.99
|
|
96
|
+
* };
|
|
97
|
+
*
|
|
98
|
+
* const oasNumber = toNumber({
|
|
99
|
+
* context: parseContext,
|
|
100
|
+
* value: priceNumber
|
|
101
|
+
* });
|
|
102
|
+
*
|
|
103
|
+
* console.log(oasNumber.nullable); // true
|
|
104
|
+
* console.log(oasNumber.exclusiveMaximum); // true
|
|
105
|
+
* ```
|
|
106
|
+
*/
|
|
45
107
|
const toNumber = ({ context, value }) => {
|
|
46
108
|
const { nullable, value: valueWithoutNullable } = (0, parseNullable_js_1.parseNullable)({
|
|
47
109
|
value,
|
|
@@ -188,22 +188,69 @@ export declare class OasParameter {
|
|
|
188
188
|
name: string;
|
|
189
189
|
/** Where the parameter is located (path, query, header, cookie) */
|
|
190
190
|
location: OasParameterLocation;
|
|
191
|
+
/** A brief description of the parameter's purpose and usage */
|
|
191
192
|
description?: string | undefined;
|
|
193
|
+
/** Determines whether this parameter is mandatory for the operation */
|
|
192
194
|
required?: boolean | undefined;
|
|
195
|
+
/** Indicates that the parameter is deprecated and should be avoided */
|
|
193
196
|
deprecated?: boolean | undefined;
|
|
197
|
+
/** Whether to allow empty values for this parameter */
|
|
194
198
|
allowEmptyValue?: boolean | undefined;
|
|
199
|
+
/** Whether reserved characters are allowed in parameter values */
|
|
195
200
|
allowReserved?: boolean | undefined;
|
|
201
|
+
/** The schema defining the parameter's data type and validation rules */
|
|
196
202
|
schema?: OasSchema | OasRef<'schema'> | undefined;
|
|
203
|
+
/** Example values demonstrating parameter usage */
|
|
197
204
|
examples?: Record<string, OasExample | OasRef<'example'>> | undefined;
|
|
205
|
+
/** Media type definitions for complex parameter content */
|
|
198
206
|
content?: Record<string, OasMediaType> | undefined;
|
|
207
|
+
/** The serialization style for the parameter (form, simple, etc.) */
|
|
199
208
|
style: OasParameterStyle;
|
|
209
|
+
/** Whether to explode parameter values into separate key-value pairs */
|
|
200
210
|
explode: boolean;
|
|
211
|
+
/** Custom extension fields (x-* properties) defined for this parameter */
|
|
201
212
|
extensionFields: Record<string, unknown> | undefined;
|
|
213
|
+
/**
|
|
214
|
+
* Creates a new OasParameter instance.
|
|
215
|
+
*
|
|
216
|
+
* @param fields - Parameter configuration fields including name, location, schema, and serialization options
|
|
217
|
+
*/
|
|
202
218
|
constructor(fields: ParameterFields);
|
|
219
|
+
/**
|
|
220
|
+
* Determines if this parameter is a reference object.
|
|
221
|
+
*
|
|
222
|
+
* @returns Always false since this is a concrete parameter instance, not a reference
|
|
223
|
+
*/
|
|
203
224
|
isRef(): this is OasRef<'parameter'>;
|
|
225
|
+
/**
|
|
226
|
+
* Resolves this parameter object.
|
|
227
|
+
*
|
|
228
|
+
* @returns The parameter instance itself since it's already a concrete object
|
|
229
|
+
*/
|
|
204
230
|
resolve(): OasParameter;
|
|
231
|
+
/**
|
|
232
|
+
* Resolves this parameter object one level.
|
|
233
|
+
*
|
|
234
|
+
* @returns The parameter instance itself since it's already a concrete object
|
|
235
|
+
*/
|
|
205
236
|
resolveOnce(): OasParameter;
|
|
237
|
+
/**
|
|
238
|
+
* Extracts the schema for this parameter.
|
|
239
|
+
*
|
|
240
|
+
* Returns the direct schema if available, or extracts schema from content
|
|
241
|
+
* for the specified media type.
|
|
242
|
+
*
|
|
243
|
+
* @param mediaType - Media type to extract schema from when using content definitions
|
|
244
|
+
* @returns The parameter's schema object
|
|
245
|
+
* @throws Error if no schema is found for the specified media type
|
|
246
|
+
*/
|
|
206
247
|
toSchema(mediaType?: string): OasSchema | OasRef<'schema'>;
|
|
248
|
+
/**
|
|
249
|
+
* Converts this OAS parameter to an OpenAPI v3 JSON schema representation.
|
|
250
|
+
*
|
|
251
|
+
* @param options - Conversion options including reference handling and formatting preferences
|
|
252
|
+
* @returns OpenAPI v3 parameter object with all properties and validation constraints
|
|
253
|
+
*/
|
|
207
254
|
toJsonSchema(options: ToJsonSchemaOptions): OpenAPIV3.ParameterObject;
|
|
208
255
|
}
|
|
209
256
|
//# sourceMappingURL=Parameter.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Parameter.d.ts","sourceRoot":"","sources":["../../../src/oas/parameter/Parameter.ts"],"names":[],"mappings":"AAAA,OAAO,yBAAyB,CAAC;AACjC,OAAO,KAAK,EAAE,oBAAoB,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAA;AACnF,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;AACpD,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAA;AAC9D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,eAAe,CAAA;AAK9C;;GAEG;AACH,MAAM,MAAM,eAAe,GAAG;IAC5B,gCAAgC;IAChC,IAAI,EAAE,MAAM,CAAA;IACZ,kEAAkE;IAClE,QAAQ,EAAE,oBAAoB,CAAA;IAC9B,2CAA2C;IAC3C,WAAW,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;IAChC,qDAAqD;IACrD,QAAQ,CAAC,EAAE,OAAO,GAAG,SAAS,CAAA;IAC9B,iDAAiD;IACjD,UAAU,CAAC,EAAE,OAAO,GAAG,SAAS,CAAA;IAChC,sDAAsD;IACtD,eAAe,CAAC,EAAE,OAAO,GAAG,SAAS,CAAA;IACrC,qEAAqE;IACrE,aAAa,CAAC,EAAE,OAAO,GAAG,SAAS,CAAA;IACnC,oDAAoD;IACpD,MAAM,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mDAAmD;IACnD,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,UAAU,GAAG,MAAM,CAAC,SAAS,CAAC,CAAC,GAAG,SAAS,CAAA;IACrE,2DAA2D;IAC3D,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,YAAY,CAAC,GAAG,SAAS,CAAA;IAClD,qEAAqE;IACrE,KAAK,EAAE,iBAAiB,CAAA;IACxB,wEAAwE;IACxE,OAAO,EAAE,OAAO,CAAA;IAChB,0EAA0E;IAC1E,eAAe,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,SAAS,CAAA;IACpD;;;;OAIG;gBACS,MAAM,EAAE,eAAe;IAkBnC;;;;OAIG;IACH,KAAK,IAAI,IAAI,IAAI,MAAM,CAAC,WAAW,CAAC;IAIpC;;;;OAIG;IACH,OAAO,IAAI,YAAY;IAIvB;;;;OAIG;IACH,WAAW,IAAI,YAAY;IAI3B;;;;;;;;;OASG;IACH,QAAQ,CAAC,SAAS,GAAE,MAA2B,GAAG,SAAS,GAAG,MAAM,CAAC,QAAQ,CAAC;IAc9E;;;;;OAKG;IACH,YAAY,CAAC,OAAO,EAAE,mBAAmB,GAAG,SAAS,CAAC,eAAe;CAuBtE"}
|
|
@@ -147,6 +147,11 @@ require("../../_dnt.polyfills.js");
|
|
|
147
147
|
* ```
|
|
148
148
|
*/
|
|
149
149
|
class OasParameter {
|
|
150
|
+
/**
|
|
151
|
+
* Creates a new OasParameter instance.
|
|
152
|
+
*
|
|
153
|
+
* @param fields - Parameter configuration fields including name, location, schema, and serialization options
|
|
154
|
+
*/
|
|
150
155
|
constructor(fields) {
|
|
151
156
|
/** Type identifier for OAS parameter objects */
|
|
152
157
|
Object.defineProperty(this, "oasType", {
|
|
@@ -169,66 +174,77 @@ class OasParameter {
|
|
|
169
174
|
writable: true,
|
|
170
175
|
value: void 0
|
|
171
176
|
});
|
|
177
|
+
/** A brief description of the parameter's purpose and usage */
|
|
172
178
|
Object.defineProperty(this, "description", {
|
|
173
179
|
enumerable: true,
|
|
174
180
|
configurable: true,
|
|
175
181
|
writable: true,
|
|
176
182
|
value: void 0
|
|
177
183
|
});
|
|
184
|
+
/** Determines whether this parameter is mandatory for the operation */
|
|
178
185
|
Object.defineProperty(this, "required", {
|
|
179
186
|
enumerable: true,
|
|
180
187
|
configurable: true,
|
|
181
188
|
writable: true,
|
|
182
189
|
value: void 0
|
|
183
190
|
});
|
|
191
|
+
/** Indicates that the parameter is deprecated and should be avoided */
|
|
184
192
|
Object.defineProperty(this, "deprecated", {
|
|
185
193
|
enumerable: true,
|
|
186
194
|
configurable: true,
|
|
187
195
|
writable: true,
|
|
188
196
|
value: void 0
|
|
189
197
|
});
|
|
198
|
+
/** Whether to allow empty values for this parameter */
|
|
190
199
|
Object.defineProperty(this, "allowEmptyValue", {
|
|
191
200
|
enumerable: true,
|
|
192
201
|
configurable: true,
|
|
193
202
|
writable: true,
|
|
194
203
|
value: void 0
|
|
195
204
|
});
|
|
205
|
+
/** Whether reserved characters are allowed in parameter values */
|
|
196
206
|
Object.defineProperty(this, "allowReserved", {
|
|
197
207
|
enumerable: true,
|
|
198
208
|
configurable: true,
|
|
199
209
|
writable: true,
|
|
200
210
|
value: void 0
|
|
201
211
|
});
|
|
212
|
+
/** The schema defining the parameter's data type and validation rules */
|
|
202
213
|
Object.defineProperty(this, "schema", {
|
|
203
214
|
enumerable: true,
|
|
204
215
|
configurable: true,
|
|
205
216
|
writable: true,
|
|
206
217
|
value: void 0
|
|
207
218
|
});
|
|
219
|
+
/** Example values demonstrating parameter usage */
|
|
208
220
|
Object.defineProperty(this, "examples", {
|
|
209
221
|
enumerable: true,
|
|
210
222
|
configurable: true,
|
|
211
223
|
writable: true,
|
|
212
224
|
value: void 0
|
|
213
225
|
});
|
|
226
|
+
/** Media type definitions for complex parameter content */
|
|
214
227
|
Object.defineProperty(this, "content", {
|
|
215
228
|
enumerable: true,
|
|
216
229
|
configurable: true,
|
|
217
230
|
writable: true,
|
|
218
231
|
value: void 0
|
|
219
232
|
});
|
|
233
|
+
/** The serialization style for the parameter (form, simple, etc.) */
|
|
220
234
|
Object.defineProperty(this, "style", {
|
|
221
235
|
enumerable: true,
|
|
222
236
|
configurable: true,
|
|
223
237
|
writable: true,
|
|
224
238
|
value: void 0
|
|
225
239
|
});
|
|
240
|
+
/** Whether to explode parameter values into separate key-value pairs */
|
|
226
241
|
Object.defineProperty(this, "explode", {
|
|
227
242
|
enumerable: true,
|
|
228
243
|
configurable: true,
|
|
229
244
|
writable: true,
|
|
230
245
|
value: void 0
|
|
231
246
|
});
|
|
247
|
+
/** Custom extension fields (x-* properties) defined for this parameter */
|
|
232
248
|
Object.defineProperty(this, "extensionFields", {
|
|
233
249
|
enumerable: true,
|
|
234
250
|
configurable: true,
|
|
@@ -251,15 +267,40 @@ class OasParameter {
|
|
|
251
267
|
this.explode = fields.explode;
|
|
252
268
|
this.extensionFields = fields.extensionFields;
|
|
253
269
|
}
|
|
270
|
+
/**
|
|
271
|
+
* Determines if this parameter is a reference object.
|
|
272
|
+
*
|
|
273
|
+
* @returns Always false since this is a concrete parameter instance, not a reference
|
|
274
|
+
*/
|
|
254
275
|
isRef() {
|
|
255
276
|
return false;
|
|
256
277
|
}
|
|
278
|
+
/**
|
|
279
|
+
* Resolves this parameter object.
|
|
280
|
+
*
|
|
281
|
+
* @returns The parameter instance itself since it's already a concrete object
|
|
282
|
+
*/
|
|
257
283
|
resolve() {
|
|
258
284
|
return this;
|
|
259
285
|
}
|
|
286
|
+
/**
|
|
287
|
+
* Resolves this parameter object one level.
|
|
288
|
+
*
|
|
289
|
+
* @returns The parameter instance itself since it's already a concrete object
|
|
290
|
+
*/
|
|
260
291
|
resolveOnce() {
|
|
261
292
|
return this;
|
|
262
293
|
}
|
|
294
|
+
/**
|
|
295
|
+
* Extracts the schema for this parameter.
|
|
296
|
+
*
|
|
297
|
+
* Returns the direct schema if available, or extracts schema from content
|
|
298
|
+
* for the specified media type.
|
|
299
|
+
*
|
|
300
|
+
* @param mediaType - Media type to extract schema from when using content definitions
|
|
301
|
+
* @returns The parameter's schema object
|
|
302
|
+
* @throws Error if no schema is found for the specified media type
|
|
303
|
+
*/
|
|
263
304
|
toSchema(mediaType = 'application/json') {
|
|
264
305
|
if (this.schema) {
|
|
265
306
|
return this.schema;
|
|
@@ -270,6 +311,12 @@ class OasParameter {
|
|
|
270
311
|
}
|
|
271
312
|
return schema;
|
|
272
313
|
}
|
|
314
|
+
/**
|
|
315
|
+
* Converts this OAS parameter to an OpenAPI v3 JSON schema representation.
|
|
316
|
+
*
|
|
317
|
+
* @param options - Conversion options including reference handling and formatting preferences
|
|
318
|
+
* @returns OpenAPI v3 parameter object with all properties and validation constraints
|
|
319
|
+
*/
|
|
273
320
|
toJsonSchema(options) {
|
|
274
321
|
return {
|
|
275
322
|
name: this.name,
|
|
@@ -9,15 +9,73 @@ type CreateArgs = {
|
|
|
9
9
|
value: Stringable;
|
|
10
10
|
generatorKey?: GeneratorKey;
|
|
11
11
|
};
|
|
12
|
+
/**
|
|
13
|
+
* Represents a custom value in the SKMTC generation pipeline.
|
|
14
|
+
*
|
|
15
|
+
* CustomValue allows generators to create arbitrary content that doesn't fit
|
|
16
|
+
* standard schema types. Used for injecting custom code, templates, or specialized
|
|
17
|
+
* content during the generation process.
|
|
18
|
+
*
|
|
19
|
+
* @example Creating custom content
|
|
20
|
+
* ```typescript
|
|
21
|
+
* const customValue = new CustomValue({
|
|
22
|
+
* context: generateContext,
|
|
23
|
+
* value: 'const customCode = "generated";',
|
|
24
|
+
* generatorKey: 'my-generator'
|
|
25
|
+
* });
|
|
26
|
+
*
|
|
27
|
+
* console.log(customValue.toString()); // "const customCode = "generated";"
|
|
28
|
+
* ```
|
|
29
|
+
*/
|
|
12
30
|
export declare class CustomValue extends ContentBase {
|
|
31
|
+
/** Type identifier for this custom value */
|
|
13
32
|
type: "custom";
|
|
33
|
+
/** The underlying value content that can be converted to string */
|
|
14
34
|
value: Stringable;
|
|
35
|
+
/**
|
|
36
|
+
* Creates a new CustomValue instance.
|
|
37
|
+
*
|
|
38
|
+
* @param args - Creation arguments including context, value, and optional generator key
|
|
39
|
+
*/
|
|
15
40
|
constructor({ context, value, generatorKey }: CreateArgs);
|
|
41
|
+
/**
|
|
42
|
+
* Determines if this custom value is a reference.
|
|
43
|
+
*
|
|
44
|
+
* @returns Always false since custom values are concrete content, not references
|
|
45
|
+
*/
|
|
16
46
|
isRef(): this is OasRef<'schema'>;
|
|
47
|
+
/**
|
|
48
|
+
* Resolves this custom value.
|
|
49
|
+
*
|
|
50
|
+
* @returns The custom value itself since it's already resolved
|
|
51
|
+
*/
|
|
17
52
|
resolve(): CustomValue;
|
|
53
|
+
/**
|
|
54
|
+
* Resolves this custom value one level.
|
|
55
|
+
*
|
|
56
|
+
* @returns The custom value itself since it's already resolved
|
|
57
|
+
*/
|
|
18
58
|
resolveOnce(): CustomValue;
|
|
59
|
+
/**
|
|
60
|
+
* Converts the custom value to its string representation.
|
|
61
|
+
*
|
|
62
|
+
* @returns String representation of the underlying value
|
|
63
|
+
*/
|
|
19
64
|
toString(): string;
|
|
20
65
|
}
|
|
66
|
+
/**
|
|
67
|
+
* Type guard function to check if a value is a CustomValue instance.
|
|
68
|
+
*
|
|
69
|
+
* @param value - Value to check
|
|
70
|
+
* @returns True if the value is a CustomValue, false otherwise
|
|
71
|
+
*
|
|
72
|
+
* @example Type checking
|
|
73
|
+
* ```typescript
|
|
74
|
+
* if (isCustomValue(someValue)) {
|
|
75
|
+
* console.log(someValue.value); // TypeScript knows it's a CustomValue
|
|
76
|
+
* }
|
|
77
|
+
* ```
|
|
78
|
+
*/
|
|
21
79
|
export declare const isCustomValue: (value: unknown) => value is CustomValue;
|
|
22
80
|
export {};
|
|
23
81
|
//# sourceMappingURL=CustomValue.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CustomValue.d.ts","sourceRoot":"","sources":["../../src/types/CustomValue.ts"],"names":[],"mappings":"AAAA,OAA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,OAAO,EAAE,KAAK,EAAE,YAAY,EAAE,EAAE,UAAU;IAMxD;;;;OAIG;IACH,KAAK,IAAI,IAAI,IAAI,MAAM,CAAC,QAAQ,CAAC;IAIjC;;;;OAIG;IACH,OAAO,IAAI,WAAW;IAItB;;;;OAIG;IACH,WAAW,IAAI,WAAW;IAI1B;;;;OAIG;IACM,QAAQ,IAAI,MAAM;CAG5B;AAED;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,aAAa,GAAI,OAAO,OAAO,KAAG,KAAK,IAAI,WAEvD,CAAA"}
|
|
@@ -3,15 +3,40 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.isCustomValue = exports.CustomValue = void 0;
|
|
4
4
|
require("../_dnt.polyfills.js");
|
|
5
5
|
const ContentBase_js_1 = require("../dsl/ContentBase.js");
|
|
6
|
+
/**
|
|
7
|
+
* Represents a custom value in the SKMTC generation pipeline.
|
|
8
|
+
*
|
|
9
|
+
* CustomValue allows generators to create arbitrary content that doesn't fit
|
|
10
|
+
* standard schema types. Used for injecting custom code, templates, or specialized
|
|
11
|
+
* content during the generation process.
|
|
12
|
+
*
|
|
13
|
+
* @example Creating custom content
|
|
14
|
+
* ```typescript
|
|
15
|
+
* const customValue = new CustomValue({
|
|
16
|
+
* context: generateContext,
|
|
17
|
+
* value: 'const customCode = "generated";',
|
|
18
|
+
* generatorKey: 'my-generator'
|
|
19
|
+
* });
|
|
20
|
+
*
|
|
21
|
+
* console.log(customValue.toString()); // "const customCode = "generated";"
|
|
22
|
+
* ```
|
|
23
|
+
*/
|
|
6
24
|
class CustomValue extends ContentBase_js_1.ContentBase {
|
|
25
|
+
/**
|
|
26
|
+
* Creates a new CustomValue instance.
|
|
27
|
+
*
|
|
28
|
+
* @param args - Creation arguments including context, value, and optional generator key
|
|
29
|
+
*/
|
|
7
30
|
constructor({ context, value, generatorKey }) {
|
|
8
31
|
super({ context, generatorKey });
|
|
32
|
+
/** Type identifier for this custom value */
|
|
9
33
|
Object.defineProperty(this, "type", {
|
|
10
34
|
enumerable: true,
|
|
11
35
|
configurable: true,
|
|
12
36
|
writable: true,
|
|
13
37
|
value: 'custom'
|
|
14
38
|
});
|
|
39
|
+
/** The underlying value content that can be converted to string */
|
|
15
40
|
Object.defineProperty(this, "value", {
|
|
16
41
|
enumerable: true,
|
|
17
42
|
configurable: true,
|
|
@@ -20,20 +45,53 @@ class CustomValue extends ContentBase_js_1.ContentBase {
|
|
|
20
45
|
});
|
|
21
46
|
this.value = value;
|
|
22
47
|
}
|
|
48
|
+
/**
|
|
49
|
+
* Determines if this custom value is a reference.
|
|
50
|
+
*
|
|
51
|
+
* @returns Always false since custom values are concrete content, not references
|
|
52
|
+
*/
|
|
23
53
|
isRef() {
|
|
24
54
|
return false;
|
|
25
55
|
}
|
|
56
|
+
/**
|
|
57
|
+
* Resolves this custom value.
|
|
58
|
+
*
|
|
59
|
+
* @returns The custom value itself since it's already resolved
|
|
60
|
+
*/
|
|
26
61
|
resolve() {
|
|
27
62
|
return this;
|
|
28
63
|
}
|
|
64
|
+
/**
|
|
65
|
+
* Resolves this custom value one level.
|
|
66
|
+
*
|
|
67
|
+
* @returns The custom value itself since it's already resolved
|
|
68
|
+
*/
|
|
29
69
|
resolveOnce() {
|
|
30
70
|
return this;
|
|
31
71
|
}
|
|
72
|
+
/**
|
|
73
|
+
* Converts the custom value to its string representation.
|
|
74
|
+
*
|
|
75
|
+
* @returns String representation of the underlying value
|
|
76
|
+
*/
|
|
32
77
|
toString() {
|
|
33
78
|
return `${this.value}`;
|
|
34
79
|
}
|
|
35
80
|
}
|
|
36
81
|
exports.CustomValue = CustomValue;
|
|
82
|
+
/**
|
|
83
|
+
* Type guard function to check if a value is a CustomValue instance.
|
|
84
|
+
*
|
|
85
|
+
* @param value - Value to check
|
|
86
|
+
* @returns True if the value is a CustomValue, false otherwise
|
|
87
|
+
*
|
|
88
|
+
* @example Type checking
|
|
89
|
+
* ```typescript
|
|
90
|
+
* if (isCustomValue(someValue)) {
|
|
91
|
+
* console.log(someValue.value); // TypeScript knows it's a CustomValue
|
|
92
|
+
* }
|
|
93
|
+
* ```
|
|
94
|
+
*/
|
|
37
95
|
const isCustomValue = (value) => {
|
|
38
96
|
return Boolean(value && typeof value === 'object' && 'type' in value && value.type === 'custom');
|
|
39
97
|
};
|
|
@@ -1,12 +1,36 @@
|
|
|
1
1
|
import "../_dnt.polyfills.js";
|
|
2
2
|
import * as v from 'valibot';
|
|
3
|
+
/**
|
|
4
|
+
* Valibot schema for root-level deno.json configuration files.
|
|
5
|
+
*
|
|
6
|
+
* Validates workspace-level deno.json files that manage multiple packages
|
|
7
|
+
* and define workspace-wide imports and exports.
|
|
8
|
+
*/
|
|
3
9
|
export declare const rootDenoJson: v.GenericSchema<RootDenoJson>;
|
|
10
|
+
/**
|
|
11
|
+
* Type definition for root-level deno.json configuration.
|
|
12
|
+
*
|
|
13
|
+
* Represents the structure of workspace-level deno.json files that coordinate
|
|
14
|
+
* multiple packages within a Deno workspace.
|
|
15
|
+
*/
|
|
4
16
|
export type RootDenoJson = {
|
|
5
17
|
imports?: Record<string, string>;
|
|
6
18
|
exports?: Record<string, string>;
|
|
7
19
|
workspace?: string[];
|
|
8
20
|
};
|
|
21
|
+
/**
|
|
22
|
+
* Valibot schema for package-level deno.json configuration files.
|
|
23
|
+
*
|
|
24
|
+
* Validates individual package deno.json files that define package-specific
|
|
25
|
+
* metadata, dependencies, and export configurations.
|
|
26
|
+
*/
|
|
9
27
|
export declare const packageDenoJson: v.GenericSchema<PackageDenoJson>;
|
|
28
|
+
/**
|
|
29
|
+
* Type definition for package-level deno.json configuration.
|
|
30
|
+
*
|
|
31
|
+
* Represents the structure of individual package deno.json files with
|
|
32
|
+
* required name/version fields and optional import/export configurations.
|
|
33
|
+
*/
|
|
10
34
|
export type PackageDenoJson = {
|
|
11
35
|
name: string;
|
|
12
36
|
version: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DenoJson.d.ts","sourceRoot":"","sources":["../../src/types/DenoJson.ts"],"names":[],"mappings":"AAAA,OAAO,sBAAsB,CAAC;AAC9B,OAAO,KAAK,CAAC,MAAM,SAAS,CAAA;AAE5B,eAAO,MAAM,YAAY,EAAE,CAAC,CAAC,aAAa,CAAC,YAAY,CAIrD,CAAA;AAEF,MAAM,MAAM,YAAY,GAAG;IACzB,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;IAChC,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;IAChC,SAAS,CAAC,EAAE,MAAM,EAAE,CAAA;CACrB,CAAA;AAED,eAAO,MAAM,eAAe,EAAE,CAAC,CAAC,aAAa,CAAC,eAAe,CAK3D,CAAA;AAEF,MAAM,MAAM,eAAe,GAAG;IAC5B,IAAI,EAAE,MAAM,CAAA;IACZ,OAAO,EAAE,MAAM,CAAA;IACf,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;IAChC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,MAAM,CAAA;CACzC,CAAA"}
|
|
1
|
+
{"version":3,"file":"DenoJson.d.ts","sourceRoot":"","sources":["../../src/types/DenoJson.ts"],"names":[],"mappings":"AAAA,OAAO,sBAAsB,CAAC;AAC9B,OAAO,KAAK,CAAC,MAAM,SAAS,CAAA;AAE5B;;;;;GAKG;AACH,eAAO,MAAM,YAAY,EAAE,CAAC,CAAC,aAAa,CAAC,YAAY,CAIrD,CAAA;AAEF;;;;;GAKG;AACH,MAAM,MAAM,YAAY,GAAG;IACzB,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;IAChC,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;IAChC,SAAS,CAAC,EAAE,MAAM,EAAE,CAAA;CACrB,CAAA;AAED;;;;;GAKG;AACH,eAAO,MAAM,eAAe,EAAE,CAAC,CAAC,aAAa,CAAC,eAAe,CAK3D,CAAA;AAEF;;;;;GAKG;AACH,MAAM,MAAM,eAAe,GAAG;IAC5B,IAAI,EAAE,MAAM,CAAA;IACZ,OAAO,EAAE,MAAM,CAAA;IACf,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;IAChC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,MAAM,CAAA;CACzC,CAAA"}
|
package/script/types/DenoJson.js
CHANGED
|
@@ -36,11 +36,23 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
36
36
|
exports.packageDenoJson = exports.rootDenoJson = void 0;
|
|
37
37
|
require("../_dnt.polyfills.js");
|
|
38
38
|
const v = __importStar(require("valibot"));
|
|
39
|
+
/**
|
|
40
|
+
* Valibot schema for root-level deno.json configuration files.
|
|
41
|
+
*
|
|
42
|
+
* Validates workspace-level deno.json files that manage multiple packages
|
|
43
|
+
* and define workspace-wide imports and exports.
|
|
44
|
+
*/
|
|
39
45
|
exports.rootDenoJson = v.looseObject({
|
|
40
46
|
imports: v.optional(v.record(v.string(), v.string())),
|
|
41
47
|
exports: v.optional(v.record(v.string(), v.string())),
|
|
42
48
|
workspace: v.optional(v.array(v.string()))
|
|
43
49
|
});
|
|
50
|
+
/**
|
|
51
|
+
* Valibot schema for package-level deno.json configuration files.
|
|
52
|
+
*
|
|
53
|
+
* Validates individual package deno.json files that define package-specific
|
|
54
|
+
* metadata, dependencies, and export configurations.
|
|
55
|
+
*/
|
|
44
56
|
exports.packageDenoJson = v.looseObject({
|
|
45
57
|
name: v.string(),
|
|
46
58
|
version: v.string(),
|