@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
|
@@ -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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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"}
|
|
@@ -144,6 +144,11 @@ import "../../_dnt.polyfills.js";
|
|
|
144
144
|
* ```
|
|
145
145
|
*/
|
|
146
146
|
export class OasParameter {
|
|
147
|
+
/**
|
|
148
|
+
* Creates a new OasParameter instance.
|
|
149
|
+
*
|
|
150
|
+
* @param fields - Parameter configuration fields including name, location, schema, and serialization options
|
|
151
|
+
*/
|
|
147
152
|
constructor(fields) {
|
|
148
153
|
/** Type identifier for OAS parameter objects */
|
|
149
154
|
Object.defineProperty(this, "oasType", {
|
|
@@ -166,66 +171,77 @@ export class OasParameter {
|
|
|
166
171
|
writable: true,
|
|
167
172
|
value: void 0
|
|
168
173
|
});
|
|
174
|
+
/** A brief description of the parameter's purpose and usage */
|
|
169
175
|
Object.defineProperty(this, "description", {
|
|
170
176
|
enumerable: true,
|
|
171
177
|
configurable: true,
|
|
172
178
|
writable: true,
|
|
173
179
|
value: void 0
|
|
174
180
|
});
|
|
181
|
+
/** Determines whether this parameter is mandatory for the operation */
|
|
175
182
|
Object.defineProperty(this, "required", {
|
|
176
183
|
enumerable: true,
|
|
177
184
|
configurable: true,
|
|
178
185
|
writable: true,
|
|
179
186
|
value: void 0
|
|
180
187
|
});
|
|
188
|
+
/** Indicates that the parameter is deprecated and should be avoided */
|
|
181
189
|
Object.defineProperty(this, "deprecated", {
|
|
182
190
|
enumerable: true,
|
|
183
191
|
configurable: true,
|
|
184
192
|
writable: true,
|
|
185
193
|
value: void 0
|
|
186
194
|
});
|
|
195
|
+
/** Whether to allow empty values for this parameter */
|
|
187
196
|
Object.defineProperty(this, "allowEmptyValue", {
|
|
188
197
|
enumerable: true,
|
|
189
198
|
configurable: true,
|
|
190
199
|
writable: true,
|
|
191
200
|
value: void 0
|
|
192
201
|
});
|
|
202
|
+
/** Whether reserved characters are allowed in parameter values */
|
|
193
203
|
Object.defineProperty(this, "allowReserved", {
|
|
194
204
|
enumerable: true,
|
|
195
205
|
configurable: true,
|
|
196
206
|
writable: true,
|
|
197
207
|
value: void 0
|
|
198
208
|
});
|
|
209
|
+
/** The schema defining the parameter's data type and validation rules */
|
|
199
210
|
Object.defineProperty(this, "schema", {
|
|
200
211
|
enumerable: true,
|
|
201
212
|
configurable: true,
|
|
202
213
|
writable: true,
|
|
203
214
|
value: void 0
|
|
204
215
|
});
|
|
216
|
+
/** Example values demonstrating parameter usage */
|
|
205
217
|
Object.defineProperty(this, "examples", {
|
|
206
218
|
enumerable: true,
|
|
207
219
|
configurable: true,
|
|
208
220
|
writable: true,
|
|
209
221
|
value: void 0
|
|
210
222
|
});
|
|
223
|
+
/** Media type definitions for complex parameter content */
|
|
211
224
|
Object.defineProperty(this, "content", {
|
|
212
225
|
enumerable: true,
|
|
213
226
|
configurable: true,
|
|
214
227
|
writable: true,
|
|
215
228
|
value: void 0
|
|
216
229
|
});
|
|
230
|
+
/** The serialization style for the parameter (form, simple, etc.) */
|
|
217
231
|
Object.defineProperty(this, "style", {
|
|
218
232
|
enumerable: true,
|
|
219
233
|
configurable: true,
|
|
220
234
|
writable: true,
|
|
221
235
|
value: void 0
|
|
222
236
|
});
|
|
237
|
+
/** Whether to explode parameter values into separate key-value pairs */
|
|
223
238
|
Object.defineProperty(this, "explode", {
|
|
224
239
|
enumerable: true,
|
|
225
240
|
configurable: true,
|
|
226
241
|
writable: true,
|
|
227
242
|
value: void 0
|
|
228
243
|
});
|
|
244
|
+
/** Custom extension fields (x-* properties) defined for this parameter */
|
|
229
245
|
Object.defineProperty(this, "extensionFields", {
|
|
230
246
|
enumerable: true,
|
|
231
247
|
configurable: true,
|
|
@@ -248,15 +264,40 @@ export class OasParameter {
|
|
|
248
264
|
this.explode = fields.explode;
|
|
249
265
|
this.extensionFields = fields.extensionFields;
|
|
250
266
|
}
|
|
267
|
+
/**
|
|
268
|
+
* Determines if this parameter is a reference object.
|
|
269
|
+
*
|
|
270
|
+
* @returns Always false since this is a concrete parameter instance, not a reference
|
|
271
|
+
*/
|
|
251
272
|
isRef() {
|
|
252
273
|
return false;
|
|
253
274
|
}
|
|
275
|
+
/**
|
|
276
|
+
* Resolves this parameter object.
|
|
277
|
+
*
|
|
278
|
+
* @returns The parameter instance itself since it's already a concrete object
|
|
279
|
+
*/
|
|
254
280
|
resolve() {
|
|
255
281
|
return this;
|
|
256
282
|
}
|
|
283
|
+
/**
|
|
284
|
+
* Resolves this parameter object one level.
|
|
285
|
+
*
|
|
286
|
+
* @returns The parameter instance itself since it's already a concrete object
|
|
287
|
+
*/
|
|
257
288
|
resolveOnce() {
|
|
258
289
|
return this;
|
|
259
290
|
}
|
|
291
|
+
/**
|
|
292
|
+
* Extracts the schema for this parameter.
|
|
293
|
+
*
|
|
294
|
+
* Returns the direct schema if available, or extracts schema from content
|
|
295
|
+
* for the specified media type.
|
|
296
|
+
*
|
|
297
|
+
* @param mediaType - Media type to extract schema from when using content definitions
|
|
298
|
+
* @returns The parameter's schema object
|
|
299
|
+
* @throws Error if no schema is found for the specified media type
|
|
300
|
+
*/
|
|
260
301
|
toSchema(mediaType = 'application/json') {
|
|
261
302
|
if (this.schema) {
|
|
262
303
|
return this.schema;
|
|
@@ -267,6 +308,12 @@ export class OasParameter {
|
|
|
267
308
|
}
|
|
268
309
|
return schema;
|
|
269
310
|
}
|
|
311
|
+
/**
|
|
312
|
+
* Converts this OAS parameter to an OpenAPI v3 JSON schema representation.
|
|
313
|
+
*
|
|
314
|
+
* @param options - Conversion options including reference handling and formatting preferences
|
|
315
|
+
* @returns OpenAPI v3 parameter object with all properties and validation constraints
|
|
316
|
+
*/
|
|
270
317
|
toJsonSchema(options) {
|
|
271
318
|
return {
|
|
272
319
|
name: this.name,
|
|
@@ -65,6 +65,12 @@ export type OasParameterRefData = {
|
|
|
65
65
|
* Valibot schema for validating parameter reference data.
|
|
66
66
|
*/
|
|
67
67
|
export declare const oasParameterRefData: v.GenericSchema<OasParameterRefData>;
|
|
68
|
+
/**
|
|
69
|
+
* Data type for OpenAPI example reference objects.
|
|
70
|
+
*
|
|
71
|
+
* Represents $ref references to example objects in OpenAPI documents,
|
|
72
|
+
* enabling example reuse across multiple schema definitions and operations.
|
|
73
|
+
*/
|
|
68
74
|
export type OasExampleRefData = {
|
|
69
75
|
oasType: 'ref';
|
|
70
76
|
refType: 'example';
|
|
@@ -72,7 +78,16 @@ export type OasExampleRefData = {
|
|
|
72
78
|
summary?: string;
|
|
73
79
|
description?: string;
|
|
74
80
|
};
|
|
81
|
+
/**
|
|
82
|
+
* Valibot schema for validating example reference data.
|
|
83
|
+
*/
|
|
75
84
|
export declare const oasExampleRefData: v.GenericSchema<OasExampleRefData>;
|
|
85
|
+
/**
|
|
86
|
+
* Data type for OpenAPI request body reference objects.
|
|
87
|
+
*
|
|
88
|
+
* Represents $ref references to request body objects in OpenAPI documents,
|
|
89
|
+
* allowing request body definitions to be reused across operations.
|
|
90
|
+
*/
|
|
76
91
|
export type OasRequestBodyRefData = {
|
|
77
92
|
oasType: 'ref';
|
|
78
93
|
refType: 'requestBody';
|
|
@@ -80,7 +95,16 @@ export type OasRequestBodyRefData = {
|
|
|
80
95
|
summary?: string;
|
|
81
96
|
description?: string;
|
|
82
97
|
};
|
|
98
|
+
/**
|
|
99
|
+
* Valibot schema for validating request body reference data.
|
|
100
|
+
*/
|
|
83
101
|
export declare const oasRequestBodyRefData: v.GenericSchema<OasRequestBodyRefData>;
|
|
102
|
+
/**
|
|
103
|
+
* Data type for OpenAPI header reference objects.
|
|
104
|
+
*
|
|
105
|
+
* Represents $ref references to header objects in OpenAPI documents,
|
|
106
|
+
* enabling header definition reuse across operations and responses.
|
|
107
|
+
*/
|
|
84
108
|
export type OasHeaderRefData = {
|
|
85
109
|
oasType: 'ref';
|
|
86
110
|
refType: 'header';
|
|
@@ -88,13 +112,37 @@ export type OasHeaderRefData = {
|
|
|
88
112
|
summary?: string;
|
|
89
113
|
description?: string;
|
|
90
114
|
};
|
|
115
|
+
/**
|
|
116
|
+
* Valibot schema for validating header reference data.
|
|
117
|
+
*/
|
|
91
118
|
export declare const oasHeaderRefData: v.GenericSchema<OasHeaderRefData>;
|
|
119
|
+
/**
|
|
120
|
+
* Data type for OpenAPI security scheme reference objects.
|
|
121
|
+
*
|
|
122
|
+
* Represents $ref references to security scheme objects in OpenAPI documents,
|
|
123
|
+
* allowing security scheme definitions to be reused across operations.
|
|
124
|
+
*/
|
|
92
125
|
export type OasSecuritySchemeRefData = {
|
|
93
126
|
oasType: 'ref';
|
|
94
127
|
refType: 'securityScheme';
|
|
95
128
|
$ref: string;
|
|
96
129
|
};
|
|
130
|
+
/**
|
|
131
|
+
* Valibot schema for validating security scheme reference data.
|
|
132
|
+
*/
|
|
97
133
|
export declare const oasSecuritySchemeRefData: v.GenericSchema<OasSecuritySchemeRefData>;
|
|
134
|
+
/**
|
|
135
|
+
* Union type representing all possible OpenAPI reference data types.
|
|
136
|
+
*
|
|
137
|
+
* Encompasses all supported reference types in the OpenAPI specification,
|
|
138
|
+
* providing type-safe handling of references to various component types.
|
|
139
|
+
*/
|
|
98
140
|
export type OasRefData = OasSchemaRefData | OasResponseRefData | OasParameterRefData | OasExampleRefData | OasRequestBodyRefData | OasHeaderRefData | OasSecuritySchemeRefData;
|
|
141
|
+
/**
|
|
142
|
+
* Valibot schema for validating any OpenAPI reference data.
|
|
143
|
+
*
|
|
144
|
+
* Union schema that validates all supported reference types,
|
|
145
|
+
* ensuring type safety across the entire reference system.
|
|
146
|
+
*/
|
|
99
147
|
export declare const oasRefData: v.GenericSchema<OasRefData>;
|
|
100
148
|
//# sourceMappingURL=ref-types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ref-types.d.ts","sourceRoot":"","sources":["../../../src/oas/ref/ref-types.ts"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wBAAwB,CAI7E,CAAA;AAUF;;;;;GAKG;AACH,MAAM,MAAM,UAAU,GAClB,gBAAgB,GAChB,kBAAkB,GAClB,mBAAmB,GACnB,iBAAiB,GACjB,qBAAqB,GACrB,gBAAgB,GAChB,wBAAwB,CAAA;AAG5B;;;;;GAKG;AACH,eAAO,MAAM,UAAU,EAAE,CAAC,CAAC,aAAa,CAAC,UAAU,CASjD,CAAA"}
|
package/esm/oas/ref/ref-types.js
CHANGED
|
@@ -30,6 +30,9 @@ export const oasParameterRefData = v.object({
|
|
|
30
30
|
summary: v.optional(v.string()),
|
|
31
31
|
description: v.optional(markdown)
|
|
32
32
|
});
|
|
33
|
+
/**
|
|
34
|
+
* Valibot schema for validating example reference data.
|
|
35
|
+
*/
|
|
33
36
|
export const oasExampleRefData = v.object({
|
|
34
37
|
oasType: v.literal('ref'),
|
|
35
38
|
refType: v.literal('example'),
|
|
@@ -37,6 +40,9 @@ export const oasExampleRefData = v.object({
|
|
|
37
40
|
summary: v.optional(v.string()),
|
|
38
41
|
description: v.optional(markdown)
|
|
39
42
|
});
|
|
43
|
+
/**
|
|
44
|
+
* Valibot schema for validating request body reference data.
|
|
45
|
+
*/
|
|
40
46
|
export const oasRequestBodyRefData = v.object({
|
|
41
47
|
oasType: v.literal('ref'),
|
|
42
48
|
refType: v.literal('requestBody'),
|
|
@@ -44,6 +50,9 @@ export const oasRequestBodyRefData = v.object({
|
|
|
44
50
|
summary: v.optional(v.string()),
|
|
45
51
|
description: v.optional(markdown)
|
|
46
52
|
});
|
|
53
|
+
/**
|
|
54
|
+
* Valibot schema for validating header reference data.
|
|
55
|
+
*/
|
|
47
56
|
export const oasHeaderRefData = v.object({
|
|
48
57
|
oasType: v.literal('ref'),
|
|
49
58
|
refType: v.literal('header'),
|
|
@@ -51,12 +60,21 @@ export const oasHeaderRefData = v.object({
|
|
|
51
60
|
summary: v.optional(v.string()),
|
|
52
61
|
description: v.optional(markdown)
|
|
53
62
|
});
|
|
63
|
+
/**
|
|
64
|
+
* Valibot schema for validating security scheme reference data.
|
|
65
|
+
*/
|
|
54
66
|
export const oasSecuritySchemeRefData = v.object({
|
|
55
67
|
oasType: v.literal('ref'),
|
|
56
68
|
refType: v.literal('securityScheme'),
|
|
57
69
|
$ref: v.string()
|
|
58
70
|
});
|
|
59
71
|
// OasPathItemRefData
|
|
72
|
+
/**
|
|
73
|
+
* Valibot schema for validating any OpenAPI reference data.
|
|
74
|
+
*
|
|
75
|
+
* Union schema that validates all supported reference types,
|
|
76
|
+
* ensuring type safety across the entire reference system.
|
|
77
|
+
*/
|
|
60
78
|
export const oasRefData = v.union([
|
|
61
79
|
oasSchemaRefData,
|
|
62
80
|
oasResponseRefData,
|
|
@@ -2,22 +2,94 @@ import "../../_dnt.polyfills.js";
|
|
|
2
2
|
import type { ToJsonSchemaOptions } from '../schema/Schema.js';
|
|
3
3
|
import type { OpenAPIV3 } from 'openapi-types';
|
|
4
4
|
import type { OasServerVariable } from '../serverVariable/ServerVariable.js';
|
|
5
|
+
/**
|
|
6
|
+
* Constructor fields for {@link OasServer}.
|
|
7
|
+
*
|
|
8
|
+
* Defines the configuration options available when creating server instances,
|
|
9
|
+
* including URL, description, variables, and extension fields.
|
|
10
|
+
*/
|
|
5
11
|
export type ServerFields = {
|
|
6
12
|
description?: string | undefined;
|
|
7
13
|
url: string;
|
|
8
14
|
variables?: Record<string, OasServerVariable> | undefined;
|
|
9
15
|
extensionFields?: Record<string, unknown>;
|
|
10
16
|
};
|
|
17
|
+
/**
|
|
18
|
+
* Represents a Server Object in the OpenAPI Specification.
|
|
19
|
+
*
|
|
20
|
+
* The `OasServer` class encapsulates server connectivity information, including
|
|
21
|
+
* the server URL, optional description, and variable definitions for URL templating.
|
|
22
|
+
* Servers are used to specify different environments (development, staging, production)
|
|
23
|
+
* or different API versions that clients can connect to.
|
|
24
|
+
*
|
|
25
|
+
* @example Basic server
|
|
26
|
+
* ```typescript
|
|
27
|
+
* const server = new OasServer({
|
|
28
|
+
* url: 'https://api.example.com/v1',
|
|
29
|
+
* description: 'Production API server'
|
|
30
|
+
* });
|
|
31
|
+
* ```
|
|
32
|
+
*
|
|
33
|
+
* @example Server with variables
|
|
34
|
+
* ```typescript
|
|
35
|
+
* const server = new OasServer({
|
|
36
|
+
* url: 'https://{environment}.example.com/{version}',
|
|
37
|
+
* description: 'Configurable API server',
|
|
38
|
+
* variables: {
|
|
39
|
+
* environment: new OasServerVariable({
|
|
40
|
+
* enum: ['api', 'staging', 'dev'],
|
|
41
|
+
* default: 'api',
|
|
42
|
+
* description: 'API environment'
|
|
43
|
+
* }),
|
|
44
|
+
* version: new OasServerVariable({
|
|
45
|
+
* default: 'v1',
|
|
46
|
+
* description: 'API version'
|
|
47
|
+
* })
|
|
48
|
+
* }
|
|
49
|
+
* });
|
|
50
|
+
* ```
|
|
51
|
+
*/
|
|
11
52
|
export declare class OasServer {
|
|
53
|
+
/** Type identifier for this OAS server */
|
|
12
54
|
oasType: 'server';
|
|
55
|
+
/** Human-readable description of the server */
|
|
13
56
|
description: string | undefined;
|
|
57
|
+
/** Server URL with optional variable templating */
|
|
14
58
|
url: string;
|
|
59
|
+
/** Variable definitions for URL templating */
|
|
15
60
|
variables: Record<string, OasServerVariable> | undefined;
|
|
61
|
+
/** Custom extension fields (x-* properties) */
|
|
16
62
|
extensionFields: Record<string, unknown> | undefined;
|
|
63
|
+
/**
|
|
64
|
+
* Creates a new OasServer instance.
|
|
65
|
+
*
|
|
66
|
+
* @param fields - Server configuration including URL, description, and variables
|
|
67
|
+
*/
|
|
17
68
|
constructor(fields: ServerFields);
|
|
69
|
+
/**
|
|
70
|
+
* Determines if this server is a reference object.
|
|
71
|
+
*
|
|
72
|
+
* @returns Always false since servers are not reference objects in OpenAPI
|
|
73
|
+
*/
|
|
18
74
|
isRef(): boolean;
|
|
75
|
+
/**
|
|
76
|
+
* Resolves this server object.
|
|
77
|
+
*
|
|
78
|
+
* @returns The server instance itself since it's already a concrete object
|
|
79
|
+
*/
|
|
19
80
|
resolve(): OasServer;
|
|
81
|
+
/**
|
|
82
|
+
* Resolves this server object one level.
|
|
83
|
+
*
|
|
84
|
+
* @returns The server instance itself since it's already a concrete object
|
|
85
|
+
*/
|
|
20
86
|
resolveOnce(): OasServer;
|
|
87
|
+
/**
|
|
88
|
+
* Converts this OAS server to an OpenAPI v3 JSON schema representation.
|
|
89
|
+
*
|
|
90
|
+
* @param _options - Conversion options (currently unused for server objects)
|
|
91
|
+
* @returns OpenAPI v3 server object with URL, description, and variables
|
|
92
|
+
*/
|
|
21
93
|
toJsonSchema(_options: ToJsonSchemaOptions): OpenAPIV3.ServerObject;
|
|
22
94
|
}
|
|
23
95
|
//# sourceMappingURL=Server.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Server.d.ts","sourceRoot":"","sources":["../../../src/oas/server/Server.ts"],"names":[],"mappings":"AAAA,OAAO,yBAAyB,CAAC;AACjC,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAA;AAC9D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,eAAe,CAAA;AAC9C,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,qCAAqC,CAAA;AAE5E,MAAM,MAAM,YAAY,GAAG;IACzB,WAAW,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;IAChC,GAAG,EAAE,MAAM,CAAA;IACX,SAAS,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,iBAAiB,CAAC,GAAG,SAAS,CAAA;IACzD,eAAe,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;CAC1C,CAAA;AAED,qBAAa,SAAS;IACpB,OAAO,EAAE,QAAQ,CAAW;IAC5B,WAAW,EAAE,MAAM,GAAG,SAAS,CAAA;IAC/B,GAAG,EAAE,MAAM,CAAA;IACX,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,iBAAiB,CAAC,GAAG,SAAS,CAAA;IACxD,eAAe,EAAE,MAAM,CAA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,SAAS,CAAC,YAAY;CAOpE"}
|
package/esm/oas/server/Server.js
CHANGED
|
@@ -1,30 +1,75 @@
|
|
|
1
1
|
import "../../_dnt.polyfills.js";
|
|
2
|
+
/**
|
|
3
|
+
* Represents a Server Object in the OpenAPI Specification.
|
|
4
|
+
*
|
|
5
|
+
* The `OasServer` class encapsulates server connectivity information, including
|
|
6
|
+
* the server URL, optional description, and variable definitions for URL templating.
|
|
7
|
+
* Servers are used to specify different environments (development, staging, production)
|
|
8
|
+
* or different API versions that clients can connect to.
|
|
9
|
+
*
|
|
10
|
+
* @example Basic server
|
|
11
|
+
* ```typescript
|
|
12
|
+
* const server = new OasServer({
|
|
13
|
+
* url: 'https://api.example.com/v1',
|
|
14
|
+
* description: 'Production API server'
|
|
15
|
+
* });
|
|
16
|
+
* ```
|
|
17
|
+
*
|
|
18
|
+
* @example Server with variables
|
|
19
|
+
* ```typescript
|
|
20
|
+
* const server = new OasServer({
|
|
21
|
+
* url: 'https://{environment}.example.com/{version}',
|
|
22
|
+
* description: 'Configurable API server',
|
|
23
|
+
* variables: {
|
|
24
|
+
* environment: new OasServerVariable({
|
|
25
|
+
* enum: ['api', 'staging', 'dev'],
|
|
26
|
+
* default: 'api',
|
|
27
|
+
* description: 'API environment'
|
|
28
|
+
* }),
|
|
29
|
+
* version: new OasServerVariable({
|
|
30
|
+
* default: 'v1',
|
|
31
|
+
* description: 'API version'
|
|
32
|
+
* })
|
|
33
|
+
* }
|
|
34
|
+
* });
|
|
35
|
+
* ```
|
|
36
|
+
*/
|
|
2
37
|
export class OasServer {
|
|
38
|
+
/**
|
|
39
|
+
* Creates a new OasServer instance.
|
|
40
|
+
*
|
|
41
|
+
* @param fields - Server configuration including URL, description, and variables
|
|
42
|
+
*/
|
|
3
43
|
constructor(fields) {
|
|
44
|
+
/** Type identifier for this OAS server */
|
|
4
45
|
Object.defineProperty(this, "oasType", {
|
|
5
46
|
enumerable: true,
|
|
6
47
|
configurable: true,
|
|
7
48
|
writable: true,
|
|
8
49
|
value: 'server'
|
|
9
50
|
});
|
|
51
|
+
/** Human-readable description of the server */
|
|
10
52
|
Object.defineProperty(this, "description", {
|
|
11
53
|
enumerable: true,
|
|
12
54
|
configurable: true,
|
|
13
55
|
writable: true,
|
|
14
56
|
value: void 0
|
|
15
57
|
});
|
|
58
|
+
/** Server URL with optional variable templating */
|
|
16
59
|
Object.defineProperty(this, "url", {
|
|
17
60
|
enumerable: true,
|
|
18
61
|
configurable: true,
|
|
19
62
|
writable: true,
|
|
20
63
|
value: void 0
|
|
21
64
|
});
|
|
65
|
+
/** Variable definitions for URL templating */
|
|
22
66
|
Object.defineProperty(this, "variables", {
|
|
23
67
|
enumerable: true,
|
|
24
68
|
configurable: true,
|
|
25
69
|
writable: true,
|
|
26
70
|
value: void 0
|
|
27
71
|
});
|
|
72
|
+
/** Custom extension fields (x-* properties) */
|
|
28
73
|
Object.defineProperty(this, "extensionFields", {
|
|
29
74
|
enumerable: true,
|
|
30
75
|
configurable: true,
|
|
@@ -36,15 +81,36 @@ export class OasServer {
|
|
|
36
81
|
this.variables = fields.variables;
|
|
37
82
|
this.extensionFields = fields.extensionFields;
|
|
38
83
|
}
|
|
84
|
+
/**
|
|
85
|
+
* Determines if this server is a reference object.
|
|
86
|
+
*
|
|
87
|
+
* @returns Always false since servers are not reference objects in OpenAPI
|
|
88
|
+
*/
|
|
39
89
|
isRef() {
|
|
40
90
|
return false;
|
|
41
91
|
}
|
|
92
|
+
/**
|
|
93
|
+
* Resolves this server object.
|
|
94
|
+
*
|
|
95
|
+
* @returns The server instance itself since it's already a concrete object
|
|
96
|
+
*/
|
|
42
97
|
resolve() {
|
|
43
98
|
return this;
|
|
44
99
|
}
|
|
100
|
+
/**
|
|
101
|
+
* Resolves this server object one level.
|
|
102
|
+
*
|
|
103
|
+
* @returns The server instance itself since it's already a concrete object
|
|
104
|
+
*/
|
|
45
105
|
resolveOnce() {
|
|
46
106
|
return this;
|
|
47
107
|
}
|
|
108
|
+
/**
|
|
109
|
+
* Converts this OAS server to an OpenAPI v3 JSON schema representation.
|
|
110
|
+
*
|
|
111
|
+
* @param _options - Conversion options (currently unused for server objects)
|
|
112
|
+
* @returns OpenAPI v3 server object with URL, description, and variables
|
|
113
|
+
*/
|
|
48
114
|
toJsonSchema(_options) {
|
|
49
115
|
return {
|
|
50
116
|
description: this.description,
|
|
@@ -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,OAAO,sBAAsB,CAAC;AAC9B,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAA;AACpE,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAA;AACnD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAA;AACtD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAA;AACtD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAA;AAE/C,KAAK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