@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
|
@@ -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,
|
|
@@ -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"],"names":[],"mappings":"AACA,OAAO,KAAK,CAAC,MAAM,SAAS,CAAA;AAE5B;;;;;GAKG;AACH,MAAM,MAAM,gBAAgB,GAAG;IAC7B,gDAAgD;IAChD,OAAO,EAAE,KAAK,CAAA;IACd,0CAA0C;IAC1C,OAAO,EAAE,QAAQ,CAAA;IAC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AAM,UAAU,EAAE,CAAC,CAAC,aAAa,CAAC,UAAU,CASjD,CAAA"}
|
|
@@ -66,6 +66,9 @@ exports.oasParameterRefData = v.object({
|
|
|
66
66
|
summary: v.optional(v.string()),
|
|
67
67
|
description: v.optional(markdown_types_js_1.markdown)
|
|
68
68
|
});
|
|
69
|
+
/**
|
|
70
|
+
* Valibot schema for validating example reference data.
|
|
71
|
+
*/
|
|
69
72
|
exports.oasExampleRefData = v.object({
|
|
70
73
|
oasType: v.literal('ref'),
|
|
71
74
|
refType: v.literal('example'),
|
|
@@ -73,6 +76,9 @@ exports.oasExampleRefData = v.object({
|
|
|
73
76
|
summary: v.optional(v.string()),
|
|
74
77
|
description: v.optional(markdown_types_js_1.markdown)
|
|
75
78
|
});
|
|
79
|
+
/**
|
|
80
|
+
* Valibot schema for validating request body reference data.
|
|
81
|
+
*/
|
|
76
82
|
exports.oasRequestBodyRefData = v.object({
|
|
77
83
|
oasType: v.literal('ref'),
|
|
78
84
|
refType: v.literal('requestBody'),
|
|
@@ -80,6 +86,9 @@ exports.oasRequestBodyRefData = v.object({
|
|
|
80
86
|
summary: v.optional(v.string()),
|
|
81
87
|
description: v.optional(markdown_types_js_1.markdown)
|
|
82
88
|
});
|
|
89
|
+
/**
|
|
90
|
+
* Valibot schema for validating header reference data.
|
|
91
|
+
*/
|
|
83
92
|
exports.oasHeaderRefData = v.object({
|
|
84
93
|
oasType: v.literal('ref'),
|
|
85
94
|
refType: v.literal('header'),
|
|
@@ -87,12 +96,21 @@ exports.oasHeaderRefData = v.object({
|
|
|
87
96
|
summary: v.optional(v.string()),
|
|
88
97
|
description: v.optional(markdown_types_js_1.markdown)
|
|
89
98
|
});
|
|
99
|
+
/**
|
|
100
|
+
* Valibot schema for validating security scheme reference data.
|
|
101
|
+
*/
|
|
90
102
|
exports.oasSecuritySchemeRefData = v.object({
|
|
91
103
|
oasType: v.literal('ref'),
|
|
92
104
|
refType: v.literal('securityScheme'),
|
|
93
105
|
$ref: v.string()
|
|
94
106
|
});
|
|
95
107
|
// OasPathItemRefData
|
|
108
|
+
/**
|
|
109
|
+
* Valibot schema for validating any OpenAPI reference data.
|
|
110
|
+
*
|
|
111
|
+
* Union schema that validates all supported reference types,
|
|
112
|
+
* ensuring type safety across the entire reference system.
|
|
113
|
+
*/
|
|
96
114
|
exports.oasRefData = v.union([
|
|
97
115
|
exports.oasSchemaRefData,
|
|
98
116
|
exports.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,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,SAAS,CAAA;
|
|
1
|
+
{"version":3,"file":"Server.d.ts","sourceRoot":"","sources":["../../../src/oas/server/Server.ts"],"names":[],"mappings":"AAAA,OAAO,yBAAyB,CAAC;AACjC,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5
|
+
/**
|
|
6
|
+
* Represents a Server Object in the OpenAPI Specification.
|
|
7
|
+
*
|
|
8
|
+
* The `OasServer` class encapsulates server connectivity information, including
|
|
9
|
+
* the server URL, optional description, and variable definitions for URL templating.
|
|
10
|
+
* Servers are used to specify different environments (development, staging, production)
|
|
11
|
+
* or different API versions that clients can connect to.
|
|
12
|
+
*
|
|
13
|
+
* @example Basic server
|
|
14
|
+
* ```typescript
|
|
15
|
+
* const server = new OasServer({
|
|
16
|
+
* url: 'https://api.example.com/v1',
|
|
17
|
+
* description: 'Production API server'
|
|
18
|
+
* });
|
|
19
|
+
* ```
|
|
20
|
+
*
|
|
21
|
+
* @example Server with variables
|
|
22
|
+
* ```typescript
|
|
23
|
+
* const server = new OasServer({
|
|
24
|
+
* url: 'https://{environment}.example.com/{version}',
|
|
25
|
+
* description: 'Configurable API server',
|
|
26
|
+
* variables: {
|
|
27
|
+
* environment: new OasServerVariable({
|
|
28
|
+
* enum: ['api', 'staging', 'dev'],
|
|
29
|
+
* default: 'api',
|
|
30
|
+
* description: 'API environment'
|
|
31
|
+
* }),
|
|
32
|
+
* version: new OasServerVariable({
|
|
33
|
+
* default: 'v1',
|
|
34
|
+
* description: 'API version'
|
|
35
|
+
* })
|
|
36
|
+
* }
|
|
37
|
+
* });
|
|
38
|
+
* ```
|
|
39
|
+
*/
|
|
5
40
|
class OasServer {
|
|
41
|
+
/**
|
|
42
|
+
* Creates a new OasServer instance.
|
|
43
|
+
*
|
|
44
|
+
* @param fields - Server configuration including URL, description, and variables
|
|
45
|
+
*/
|
|
6
46
|
constructor(fields) {
|
|
47
|
+
/** Type identifier for this OAS server */
|
|
7
48
|
Object.defineProperty(this, "oasType", {
|
|
8
49
|
enumerable: true,
|
|
9
50
|
configurable: true,
|
|
10
51
|
writable: true,
|
|
11
52
|
value: 'server'
|
|
12
53
|
});
|
|
54
|
+
/** Human-readable description of the server */
|
|
13
55
|
Object.defineProperty(this, "description", {
|
|
14
56
|
enumerable: true,
|
|
15
57
|
configurable: true,
|
|
16
58
|
writable: true,
|
|
17
59
|
value: void 0
|
|
18
60
|
});
|
|
61
|
+
/** Server URL with optional variable templating */
|
|
19
62
|
Object.defineProperty(this, "url", {
|
|
20
63
|
enumerable: true,
|
|
21
64
|
configurable: true,
|
|
22
65
|
writable: true,
|
|
23
66
|
value: void 0
|
|
24
67
|
});
|
|
68
|
+
/** Variable definitions for URL templating */
|
|
25
69
|
Object.defineProperty(this, "variables", {
|
|
26
70
|
enumerable: true,
|
|
27
71
|
configurable: true,
|
|
28
72
|
writable: true,
|
|
29
73
|
value: void 0
|
|
30
74
|
});
|
|
75
|
+
/** Custom extension fields (x-* properties) */
|
|
31
76
|
Object.defineProperty(this, "extensionFields", {
|
|
32
77
|
enumerable: true,
|
|
33
78
|
configurable: true,
|
|
@@ -39,15 +84,36 @@ class OasServer {
|
|
|
39
84
|
this.variables = fields.variables;
|
|
40
85
|
this.extensionFields = fields.extensionFields;
|
|
41
86
|
}
|
|
87
|
+
/**
|
|
88
|
+
* Determines if this server is a reference object.
|
|
89
|
+
*
|
|
90
|
+
* @returns Always false since servers are not reference objects in OpenAPI
|
|
91
|
+
*/
|
|
42
92
|
isRef() {
|
|
43
93
|
return false;
|
|
44
94
|
}
|
|
95
|
+
/**
|
|
96
|
+
* Resolves this server object.
|
|
97
|
+
*
|
|
98
|
+
* @returns The server instance itself since it's already a concrete object
|
|
99
|
+
*/
|
|
45
100
|
resolve() {
|
|
46
101
|
return this;
|
|
47
102
|
}
|
|
103
|
+
/**
|
|
104
|
+
* Resolves this server object one level.
|
|
105
|
+
*
|
|
106
|
+
* @returns The server instance itself since it's already a concrete object
|
|
107
|
+
*/
|
|
48
108
|
resolveOnce() {
|
|
49
109
|
return this;
|
|
50
110
|
}
|
|
111
|
+
/**
|
|
112
|
+
* Converts this OAS server to an OpenAPI v3 JSON schema representation.
|
|
113
|
+
*
|
|
114
|
+
* @param _options - Conversion options (currently unused for server objects)
|
|
115
|
+
* @returns OpenAPI v3 server object with URL, description, and variables
|
|
116
|
+
*/
|
|
51
117
|
toJsonSchema(_options) {
|
|
52
118
|
return {
|
|
53
119
|
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,UAAU,GAAG;IAChB,OAAO,EAAE,eAAe,CAAA;IACxB,KAAK,EAAE,UAAU,CAAA;IACjB,YAAY,CAAC,EAAE,YAAY,CAAA;CAC5B,CAAA;AAED,qBAAa,WAAY,SAAQ,WAAW;IAC1C,IAAI,EAAG,QAAQ,CAAS;IACxB,KAAK,EAAE,UAAU,CAAA;
|
|
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,UAAU,GAAG;IAChB,OAAO,EAAE,eAAe,CAAA;IACxB,KAAK,EAAE,UAAU,CAAA;IACjB,YAAY,CAAC,EAAE,YAAY,CAAA;CAC5B,CAAA;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,qBAAa,WAAY,SAAQ,WAAW;IAC1C,4CAA4C;IAC5C,IAAI,EAAG,QAAQ,CAAS;IACxB,mEAAmE;IACnE,KAAK,EAAE,UAAU,CAAA;IAEjB;;;;OAIG;gBACS,EAAE,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
|
};
|