@skmtc/core 0.0.802 → 0.0.804
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/oas/ref/ref-types.d.ts +48 -0
- package/esm/oas/ref/ref-types.d.ts.map +1 -1
- package/esm/oas/ref/ref-types.js +18 -0
- package/esm/oas/server/Server.d.ts +72 -0
- package/esm/oas/server/Server.d.ts.map +1 -1
- package/esm/oas/server/Server.js +66 -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/oas/ref/ref-types.d.ts +48 -0
- package/script/oas/ref/ref-types.d.ts.map +1 -1
- package/script/oas/ref/ref-types.js +18 -0
- package/script/oas/server/Server.d.ts +72 -0
- package/script/oas/server/Server.d.ts.map +1 -1
- package/script/oas/server/Server.js +66 -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
|
@@ -98,6 +98,11 @@ require("../../_dnt.polyfills.js");
|
|
|
98
98
|
* ```
|
|
99
99
|
*/
|
|
100
100
|
class OasArray {
|
|
101
|
+
/**
|
|
102
|
+
* Creates a new OasArray instance.
|
|
103
|
+
*
|
|
104
|
+
* @param fields - Array configuration fields including items schema, validation constraints, and metadata
|
|
105
|
+
*/
|
|
101
106
|
constructor(fields) {
|
|
102
107
|
/**
|
|
103
108
|
* Object is part the 'schema' set which is used
|
|
@@ -227,15 +232,36 @@ class OasArray {
|
|
|
227
232
|
this.enums = fields.enums;
|
|
228
233
|
this.defaultValue = fields.defaultValue;
|
|
229
234
|
}
|
|
235
|
+
/**
|
|
236
|
+
* Determines if this array is a reference object.
|
|
237
|
+
*
|
|
238
|
+
* @returns Always returns false since this is a concrete array instance, not a reference
|
|
239
|
+
*/
|
|
230
240
|
isRef() {
|
|
231
241
|
return false;
|
|
232
242
|
}
|
|
243
|
+
/**
|
|
244
|
+
* Resolves this array object.
|
|
245
|
+
*
|
|
246
|
+
* @returns The array instance itself since it's already a concrete object, not a reference
|
|
247
|
+
*/
|
|
233
248
|
resolve() {
|
|
234
249
|
return this;
|
|
235
250
|
}
|
|
251
|
+
/**
|
|
252
|
+
* Resolves this array object one level.
|
|
253
|
+
*
|
|
254
|
+
* @returns The array instance itself since it's already a concrete object, not a reference
|
|
255
|
+
*/
|
|
236
256
|
resolveOnce() {
|
|
237
257
|
return this;
|
|
238
258
|
}
|
|
259
|
+
/**
|
|
260
|
+
* Converts this OAS array to an OpenAPI v3 JSON schema representation.
|
|
261
|
+
*
|
|
262
|
+
* @param options - Conversion options including reference handling and formatting preferences
|
|
263
|
+
* @returns OpenAPI v3 array schema object with type, items schema, and all validation constraints
|
|
264
|
+
*/
|
|
239
265
|
toJsonSchema(options) {
|
|
240
266
|
return {
|
|
241
267
|
type: 'array',
|
|
@@ -9,6 +9,12 @@ import { type OasSchemaRefData } from '../ref/ref-types.js';
|
|
|
9
9
|
* to handle recursive schema references.
|
|
10
10
|
*/
|
|
11
11
|
export declare const oasArrayData: v.GenericSchema<OasArrayData>;
|
|
12
|
+
/**
|
|
13
|
+
* Valibot schema for array data without the items property.
|
|
14
|
+
*
|
|
15
|
+
* Used for parsing array schemas when the items property is handled separately,
|
|
16
|
+
* typically during schema transformation and validation processes.
|
|
17
|
+
*/
|
|
12
18
|
export declare const oasArrayDataWithoutItems: v.GenericSchema<OasArrayDataWithoutItems>;
|
|
13
19
|
/**
|
|
14
20
|
* Data type for OpenAPI array schema objects.
|
|
@@ -37,6 +43,12 @@ export type OasArrayData = {
|
|
|
37
43
|
/** Array of valid enumeration values */
|
|
38
44
|
enums?: unknown[];
|
|
39
45
|
};
|
|
46
|
+
/**
|
|
47
|
+
* Array schema data without the items property.
|
|
48
|
+
*
|
|
49
|
+
* Represents an array schema with all properties except the items definition.
|
|
50
|
+
* Used during parsing phases where item schemas are processed separately.
|
|
51
|
+
*/
|
|
40
52
|
export type OasArrayDataWithoutItems = {
|
|
41
53
|
/** Type identifier (always 'array') */
|
|
42
54
|
type: 'array';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"array-types.d.ts","sourceRoot":"","sources":["../../../src/oas/array/array-types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,SAAS,CAAA;AAC5B,OAAO,EAAE,KAAK,aAAa,EAAiB,MAAM,2BAA2B,CAAA;AAC7E,OAAO,EAAE,KAAK,gBAAgB,EAAoB,MAAM,qBAAqB,CAAA;AAE7E;;;;;;GAMG;AACH,eAAO,MAAM,YAAY,EAAE,CAAC,CAAC,aAAa,CAAC,YAAY,CAUrD,CAAA;AAEF,eAAO,MAAM,wBAAwB,EAAE,CAAC,CAAC,aAAa,CAAC,wBAAwB,CAS7E,CAAA;AAEF;;;;;;GAMG;AACH,MAAM,MAAM,YAAY,GAAG;IACzB,uCAAuC;IACvC,IAAI,EAAE,OAAO,CAAA;IACb,wCAAwC;IACxC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ACH,eAAO,MAAM,wBAAwB,EAAE,CAAC,CAAC,aAAa,CAAC,wBAAwB,CAS7E,CAAA;AAEF;;;;;;GAMG;AACH,MAAM,MAAM,YAAY,GAAG;IACzB,uCAAuC;IACvC,IAAI,EAAE,OAAO,CAAA;IACb,wCAAwC;IACxC,KAAK,EAAE,aAAa,GAAG,gBAAgB,CAAA;IACvC,yCAAyC;IACzC,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,kDAAkD;IAClD,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,kCAAkC;IAClC,OAAO,CAAC,EAAE,OAAO,EAAE,CAAA;IACnB,sCAAsC;IACtC,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,uCAAuC;IACvC,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,uCAAuC;IACvC,WAAW,CAAC,EAAE,OAAO,CAAA;IACrB,wCAAwC;IACxC,KAAK,CAAC,EAAE,OAAO,EAAE,CAAA;CAClB,CAAA;AAED;;;;;GAKG;AACH,MAAM,MAAM,wBAAwB,GAAG;IACrC,uCAAuC;IACvC,IAAI,EAAE,OAAO,CAAA;IACb,yCAAyC;IACzC,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,kDAAkD;IAClD,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,kCAAkC;IAClC,OAAO,CAAC,EAAE,OAAO,EAAE,CAAA;IACnB,sCAAsC;IACtC,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,uCAAuC;IACvC,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,uCAAuC;IACvC,WAAW,CAAC,EAAE,OAAO,CAAA;IACrB,wCAAwC;IACxC,KAAK,CAAC,EAAE,OAAO,EAAE,CAAA;CAClB,CAAA"}
|
|
@@ -55,6 +55,12 @@ exports.oasArrayData = v.object({
|
|
|
55
55
|
uniqueItems: v.optional(v.boolean()),
|
|
56
56
|
enums: v.optional(v.array(v.unknown()))
|
|
57
57
|
});
|
|
58
|
+
/**
|
|
59
|
+
* Valibot schema for array data without the items property.
|
|
60
|
+
*
|
|
61
|
+
* Used for parsing array schemas when the items property is handled separately,
|
|
62
|
+
* typically during schema transformation and validation processes.
|
|
63
|
+
*/
|
|
58
64
|
exports.oasArrayDataWithoutItems = v.object({
|
|
59
65
|
type: v.literal('array'),
|
|
60
66
|
title: v.optional(v.string()),
|
|
@@ -191,10 +191,36 @@ export declare class OasBoolean<Nullable extends boolean | undefined = boolean |
|
|
|
191
191
|
* The default value of the boolean.
|
|
192
192
|
*/
|
|
193
193
|
default: Nullable extends true ? boolean | null | undefined : boolean | undefined;
|
|
194
|
+
/**
|
|
195
|
+
* Creates a new OasBoolean instance.
|
|
196
|
+
*
|
|
197
|
+
* @param fields - Boolean configuration fields including validation constraints and metadata
|
|
198
|
+
*/
|
|
194
199
|
constructor(fields?: BooleanFields<Nullable>);
|
|
200
|
+
/**
|
|
201
|
+
* Determines if this boolean is a reference object.
|
|
202
|
+
*
|
|
203
|
+
* @returns Always returns false since this is a concrete boolean instance, not a reference
|
|
204
|
+
*/
|
|
195
205
|
isRef(): this is OasRef<'schema'>;
|
|
206
|
+
/**
|
|
207
|
+
* Resolves this boolean object.
|
|
208
|
+
*
|
|
209
|
+
* @returns The boolean instance itself since it's already a concrete object, not a reference
|
|
210
|
+
*/
|
|
196
211
|
resolve(): OasBoolean<Nullable>;
|
|
212
|
+
/**
|
|
213
|
+
* Resolves this boolean object one level.
|
|
214
|
+
*
|
|
215
|
+
* @returns The boolean instance itself since it's already a concrete object, not a reference
|
|
216
|
+
*/
|
|
197
217
|
resolveOnce(): OasBoolean<Nullable>;
|
|
218
|
+
/**
|
|
219
|
+
* Converts this OAS boolean to an OpenAPI v3 JSON schema representation.
|
|
220
|
+
*
|
|
221
|
+
* @param options - Conversion options (currently unused for boolean schemas)
|
|
222
|
+
* @returns OpenAPI v3 boolean schema object with type and all validation constraints
|
|
223
|
+
*/
|
|
198
224
|
toJsonSchema(options?: ToJsonSchemaOptions): OpenAPIV3.NonArraySchem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AAQ,SAAS,IAAI,GAAG,OAAO,GAAG,IAAI,GAAG,SAAS,GAAG,OAAO,GAAG,SAAS,CAAA;IAEjF;;OAEG;IACH,KAAK,EAAE,QAAQ,SAAS,IAAI,GAAG,CAAC,OAAO,GAAG,IAAI,CAAC,EAAE,GAAG,SAAS,GAAG,OAAO,EAAE,GAAG,SAAS,CAAA;IACrF;;OAEG;IACH,OAAO,EAAE,QAAQ,SAAS,IAAI,GAAG,OAAO,GAAG,IAAI,GAAG,SAAS,GAAG,OAAO,GAAG,SAAS,CAAA;IAEjF;;;;OAIG;gBACS,MAAM,GAAE,aAAa,CAAC,QAAQ,CAAM;IAUhD;;;;OAIG;IACH,KAAK,IAAI,IAAI,IAAI,MAAM,CAAC,QAAQ,CAAC;IAIjC;;;;OAIG;IACH,OAAO,IAAI,UAAU,CAAC,QAAQ,CAAC;IAI/B;;;;OAIG;IACH,WAAW,IAAI,UAAU,CAAC,QAAQ,CAAC;IAInC;;;;;OAKG;IAEH,YAAY,CAAC,OAAO,CAAC,EAAE,mBAAmB,GAAG,SAAS,CAAC,oBAAoB;CAW5E"}
|
|
@@ -135,6 +135,11 @@ require("../../_dnt.polyfills.js");
|
|
|
135
135
|
* ```
|
|
136
136
|
*/
|
|
137
137
|
class OasBoolean {
|
|
138
|
+
/**
|
|
139
|
+
* Creates a new OasBoolean instance.
|
|
140
|
+
*
|
|
141
|
+
* @param fields - Boolean configuration fields including validation constraints and metadata
|
|
142
|
+
*/
|
|
138
143
|
constructor(fields = {}) {
|
|
139
144
|
/**
|
|
140
145
|
* Object is part the 'schema' set which is used
|
|
@@ -224,15 +229,36 @@ class OasBoolean {
|
|
|
224
229
|
this.enums = fields.enums;
|
|
225
230
|
this.default = fields.default;
|
|
226
231
|
}
|
|
232
|
+
/**
|
|
233
|
+
* Determines if this boolean is a reference object.
|
|
234
|
+
*
|
|
235
|
+
* @returns Always returns false since this is a concrete boolean instance, not a reference
|
|
236
|
+
*/
|
|
227
237
|
isRef() {
|
|
228
238
|
return false;
|
|
229
239
|
}
|
|
240
|
+
/**
|
|
241
|
+
* Resolves this boolean object.
|
|
242
|
+
*
|
|
243
|
+
* @returns The boolean instance itself since it's already a concrete object, not a reference
|
|
244
|
+
*/
|
|
230
245
|
resolve() {
|
|
231
246
|
return this;
|
|
232
247
|
}
|
|
248
|
+
/**
|
|
249
|
+
* Resolves this boolean object one level.
|
|
250
|
+
*
|
|
251
|
+
* @returns The boolean instance itself since it's already a concrete object, not a reference
|
|
252
|
+
*/
|
|
233
253
|
resolveOnce() {
|
|
234
254
|
return this;
|
|
235
255
|
}
|
|
256
|
+
/**
|
|
257
|
+
* Converts this OAS boolean to an OpenAPI v3 JSON schema representation.
|
|
258
|
+
*
|
|
259
|
+
* @param options - Conversion options (currently unused for boolean schemas)
|
|
260
|
+
* @returns OpenAPI v3 boolean schema object with type and all validation constraints
|
|
261
|
+
*/
|
|
236
262
|
// deno-lint-ignore no-unused-vars
|
|
237
263
|
toJsonSchema(options) {
|
|
238
264
|
return {
|
|
@@ -5,6 +5,63 @@ type ToBooleanArgs = {
|
|
|
5
5
|
value: OpenAPIV3.SchemaObject;
|
|
6
6
|
context: ParseContext;
|
|
7
7
|
};
|
|
8
|
+
/**
|
|
9
|
+
* Transforms an OpenAPI v3 boolean schema object into an internal OAS boolean representation.
|
|
10
|
+
*
|
|
11
|
+
* This function processes OpenAPI boolean 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 boolean representation with proper validation.
|
|
14
|
+
*
|
|
15
|
+
* The transformation follows a pipeline approach:
|
|
16
|
+
* 1. Parse nullable flag and extract base value
|
|
17
|
+
* 2. Parse example values with nullable support
|
|
18
|
+
* 3. Parse enumeration constraints (typically [true], [false], or [true, false])
|
|
19
|
+
* 4. Parse default values
|
|
20
|
+
* 5. Create final OasBoolean instance
|
|
21
|
+
*
|
|
22
|
+
* @param args - Transformation arguments
|
|
23
|
+
* @param args.value - The OpenAPI v3 boolean schema object to transform
|
|
24
|
+
* @param args.context - Parse context providing utilities and tracing
|
|
25
|
+
* @returns Transformed OAS boolean object with parsed properties
|
|
26
|
+
*
|
|
27
|
+
* @example Basic boolean transformation
|
|
28
|
+
* ```typescript
|
|
29
|
+
* import { toBoolean } from '@skmtc/core';
|
|
30
|
+
*
|
|
31
|
+
* const openApiBoolean = {
|
|
32
|
+
* type: 'boolean',
|
|
33
|
+
* default: false
|
|
34
|
+
* };
|
|
35
|
+
*
|
|
36
|
+
* const oasBoolean = toBoolean({
|
|
37
|
+
* value: openApiBoolean,
|
|
38
|
+
* context: parseContext
|
|
39
|
+
* });
|
|
40
|
+
*
|
|
41
|
+
* console.log(oasBoolean.default); // false
|
|
42
|
+
* ```
|
|
43
|
+
*
|
|
44
|
+
* @example Boolean with nullable and enum
|
|
45
|
+
* ```typescript
|
|
46
|
+
* const flagBoolean = {
|
|
47
|
+
* type: 'boolean',
|
|
48
|
+
* nullable: true,
|
|
49
|
+
* enum: [true, null],
|
|
50
|
+
* default: null,
|
|
51
|
+
* example: true,
|
|
52
|
+
* title: 'Feature Flag',
|
|
53
|
+
* description: 'Whether the feature is enabled'
|
|
54
|
+
* };
|
|
55
|
+
*
|
|
56
|
+
* const oasBoolean = toBoolean({
|
|
57
|
+
* value: flagBoolean,
|
|
58
|
+
* context: parseContext
|
|
59
|
+
* });
|
|
60
|
+
*
|
|
61
|
+
* console.log(oasBoolean.nullable); // true
|
|
62
|
+
* console.log(oasBoolean.enums); // [true, null]
|
|
63
|
+
* ```
|
|
64
|
+
*/
|
|
8
65
|
export declare const toBoolean: ({ value, context }: ToBooleanArgs) => OasBoolean;
|
|
9
66
|
type ToParsedBooleanArgs<Nullable extends boolean | undefined> = {
|
|
10
67
|
value: Omit<OpenAPIV3.SchemaObject, 'nullable' | 'example' | 'enums'>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"toBoolean.d.ts","sourceRoot":"","sources":["../../../src/o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,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAA;AACjE,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAA;AASzC,KAAK,aAAa,GAAG;IACnB,KAAK,EAAE,SAAS,CAAC,YAAY,CAAA;IAC7B,OAAO,EAAE,YAAY,CAAA;CACtB,CAAA;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwDG;AACH,eAAO,MAAM,SAAS,GAAI,oBAAoB,aAAa,KAAG,UAmC7D,CAAA;AAED,KAAK,mBAAmB,CAAC,QAAQ,SAAS,OAAO,GAAG,SAAS,IAAI;IAC/D,KAAK,EAAE,IAAI,CAAC,SAAS,CAAC,YAAY,EAAE,UAAU,GAAG,SAAS,GAAG,OAAO,CAAC,CAAA;IACrE,OAAO,EAAE,YAAY,CAAA;IACrB,QAAQ,EAAE,QAAQ,CAAA;IAClB,OAAO,EAAE,QAAQ,SAAS,IAAI,GAAG,OAAO,GAAG,IAAI,GAAG,SAAS,GAAG,OAAO,GAAG,SAAS,CAAA;IACjF,KAAK,EAAE,QAAQ,SAAS,IAAI,GAAG,CAAC,OAAO,GAAG,IAAI,CAAC,EAAE,GAAG,SAAS,GAAG,OAAO,EAAE,GAAG,SAAS,CAAA;IACrF,YAAY,EAAE,QAAQ,SAAS,IAAI,GAAG,OAAO,GAAG,IAAI,GAAG,SAAS,GAAG,OAAO,GAAG,SAAS,CAAA;CACvF,CAAA;AAED,eAAO,MAAM,eAAe,GAAI,QAAQ,SAAS,OAAO,GAAG,SAAS,EAAE,4DAOnE,mBAAmB,CAAC,QAAQ,CAAC,KAAG,UAAU,CAAC,QAAQ,CAmBrD,CAAA"}
|
|
@@ -42,6 +42,63 @@ 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 parseDefault_js_1 = require("../_helpers/parseDefault.js");
|
|
45
|
+
/**
|
|
46
|
+
* Transforms an OpenAPI v3 boolean schema object into an internal OAS boolean representation.
|
|
47
|
+
*
|
|
48
|
+
* This function processes OpenAPI boolean 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 boolean representation with proper validation.
|
|
51
|
+
*
|
|
52
|
+
* The transformation follows a pipeline approach:
|
|
53
|
+
* 1. Parse nullable flag and extract base value
|
|
54
|
+
* 2. Parse example values with nullable support
|
|
55
|
+
* 3. Parse enumeration constraints (typically [true], [false], or [true, false])
|
|
56
|
+
* 4. Parse default values
|
|
57
|
+
* 5. Create final OasBoolean instance
|
|
58
|
+
*
|
|
59
|
+
* @param args - Transformation arguments
|
|
60
|
+
* @param args.value - The OpenAPI v3 boolean schema object to transform
|
|
61
|
+
* @param args.context - Parse context providing utilities and tracing
|
|
62
|
+
* @returns Transformed OAS boolean object with parsed properties
|
|
63
|
+
*
|
|
64
|
+
* @example Basic boolean transformation
|
|
65
|
+
* ```typescript
|
|
66
|
+
* import { toBoolean } from '@skmtc/core';
|
|
67
|
+
*
|
|
68
|
+
* const openApiBoolean = {
|
|
69
|
+
* type: 'boolean',
|
|
70
|
+
* default: false
|
|
71
|
+
* };
|
|
72
|
+
*
|
|
73
|
+
* const oasBoolean = toBoolean({
|
|
74
|
+
* value: openApiBoolean,
|
|
75
|
+
* context: parseContext
|
|
76
|
+
* });
|
|
77
|
+
*
|
|
78
|
+
* console.log(oasBoolean.default); // false
|
|
79
|
+
* ```
|
|
80
|
+
*
|
|
81
|
+
* @example Boolean with nullable and enum
|
|
82
|
+
* ```typescript
|
|
83
|
+
* const flagBoolean = {
|
|
84
|
+
* type: 'boolean',
|
|
85
|
+
* nullable: true,
|
|
86
|
+
* enum: [true, null],
|
|
87
|
+
* default: null,
|
|
88
|
+
* example: true,
|
|
89
|
+
* title: 'Feature Flag',
|
|
90
|
+
* description: 'Whether the feature is enabled'
|
|
91
|
+
* };
|
|
92
|
+
*
|
|
93
|
+
* const oasBoolean = toBoolean({
|
|
94
|
+
* value: flagBoolean,
|
|
95
|
+
* context: parseContext
|
|
96
|
+
* });
|
|
97
|
+
*
|
|
98
|
+
* console.log(oasBoolean.nullable); // true
|
|
99
|
+
* console.log(oasBoolean.enums); // [true, null]
|
|
100
|
+
* ```
|
|
101
|
+
*/
|
|
45
102
|
const toBoolean = ({ value, context }) => {
|
|
46
103
|
const { nullable, value: valueWithoutNullable } = (0, parseNullable_js_1.parseNullable)({
|
|
47
104
|
value,
|
|
@@ -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,CA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