@nestia/migrate 0.12.0 → 0.12.1

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.
@@ -1,263 +1,307 @@
1
- import ts from "typescript";
2
- import { ExpressionFactory } from "typia/lib/factories/ExpressionFactory";
3
- import { TypeFactory } from "typia/lib/factories/TypeFactory";
4
- import { FormatCheatSheet } from "typia/lib/tags/internal/FormatCheatSheet";
5
- import { Escaper } from "typia/lib/utils/Escaper";
6
-
7
- import { ISwaggerComponents } from "../structures/ISwaggerComponents";
8
- import { ISwaggerSchema } from "../structures/ISwaggerSchema";
9
- import { FilePrinter } from "../utils/FilePrinter";
10
- import { SwaggerTypeChecker } from "../utils/SwaggerTypeChecker";
11
- import { MigrateImportProgrammer } from "./MigrateImportProgrammer";
12
-
13
- export namespace MigrateSchemaProgrammer {
14
- /* -----------------------------------------------------------
15
- FACADE
16
- ----------------------------------------------------------- */
17
- export const write =
18
- (components: ISwaggerComponents) =>
19
- (importer: MigrateImportProgrammer) =>
20
- (schema: ISwaggerSchema): ts.TypeNode => {
21
- const union: ts.TypeNode[] = [];
22
- if (SwaggerTypeChecker.isUnknown(schema))
23
- return TypeFactory.keyword("any");
24
- else if (SwaggerTypeChecker.isNullOnly(schema)) return createNode("null");
25
- else if (SwaggerTypeChecker.isNullable(components)(schema))
26
- union.push(createNode("null"));
27
-
28
- const type: ts.TypeNode = (() => {
29
- // ATOMIC
30
- if (SwaggerTypeChecker.isBoolean(schema)) return writeBoolean(schema);
31
- else if (SwaggerTypeChecker.isInteger(schema))
32
- return writeInteger(importer)(schema);
33
- else if (SwaggerTypeChecker.isNumber(schema))
34
- return writeNumber(importer)(schema);
35
- // INSTANCES
36
- else if (SwaggerTypeChecker.isString(schema))
37
- return writeString(importer)(schema);
38
- else if (SwaggerTypeChecker.isArray(schema))
39
- return writeArray(components)(importer)(schema);
40
- else if (SwaggerTypeChecker.isObject(schema))
41
- return writeObject(components)(importer)(schema);
42
- else if (SwaggerTypeChecker.isReference(schema))
43
- return writeReference(importer)(schema);
44
- // NESTED UNION
45
- else if (SwaggerTypeChecker.isAnyOf(schema))
46
- return writeUnion(components)(importer)(schema.anyOf);
47
- else if (SwaggerTypeChecker.isOneOf(schema))
48
- return writeUnion(components)(importer)(schema.oneOf);
49
- else return TypeFactory.keyword("any");
50
- })();
51
- union.push(type);
52
-
53
- if (union.length === 0) return TypeFactory.keyword("any");
54
- else if (union.length === 1) return union[0];
55
- return ts.factory.createUnionTypeNode(union);
56
- };
57
-
58
- /* -----------------------------------------------------------
59
- ATOMICS
60
- ----------------------------------------------------------- */
61
- const writeBoolean = (schema: ISwaggerSchema.IBoolean): ts.TypeNode => {
62
- if (schema.enum?.length)
63
- return ts.factory.createLiteralTypeNode(
64
- schema.enum[0] ? ts.factory.createTrue() : ts.factory.createFalse(),
65
- );
66
- return TypeFactory.keyword("boolean");
67
- };
68
-
69
- const writeInteger =
70
- (importer: MigrateImportProgrammer) =>
71
- (schema: ISwaggerSchema.IInteger): ts.TypeNode =>
72
- writeNumeric(() => [
73
- TypeFactory.keyword("number"),
74
- importer.tag("Type", "int32"),
75
- ])(importer)(schema);
76
-
77
- const writeNumber =
78
- (importer: MigrateImportProgrammer) =>
79
- (schema: ISwaggerSchema.INumber): ts.TypeNode =>
80
- writeNumeric(() => [TypeFactory.keyword("number")])(importer)(schema);
81
-
82
- const writeNumeric =
83
- (factory: () => ts.TypeNode[]) =>
84
- (importer: MigrateImportProgrammer) =>
85
- (schema: ISwaggerSchema.IInteger | ISwaggerSchema.INumber): ts.TypeNode => {
86
- if (schema.enum?.length)
87
- return ts.factory.createUnionTypeNode(
88
- schema.enum.map((i) =>
89
- ts.factory.createLiteralTypeNode(ExpressionFactory.number(i)),
90
- ),
91
- );
92
- const intersection: ts.TypeNode[] = factory();
93
- if (schema.default !== undefined)
94
- intersection.push(importer.tag("Default", schema.default));
95
- if (schema.minimum !== undefined)
96
- intersection.push(
97
- importer.tag(
98
- schema.exclusiveMinimum ? "ExclusiveMinimum" : "Minimum",
99
- schema.minimum,
100
- ),
101
- );
102
- if (schema.maximum !== undefined)
103
- intersection.push(
104
- importer.tag(
105
- schema.exclusiveMaximum ? "ExclusiveMaximum" : "Maximum",
106
- schema.maximum,
107
- ),
108
- );
109
- if (schema.multipleOf !== undefined)
110
- intersection.push(importer.tag("MultipleOf", schema.multipleOf));
111
-
112
- return intersection.length === 1
113
- ? intersection[0]
114
- : ts.factory.createIntersectionTypeNode(intersection);
115
- };
116
-
117
- const writeString =
118
- (importer: MigrateImportProgrammer) =>
119
- (schema: ISwaggerSchema.IString): ts.TypeNode => {
120
- if (schema.format === "binary")
121
- return ts.factory.createTypeReferenceNode("File");
122
-
123
- const intersection: ts.TypeNode[] = [TypeFactory.keyword("string")];
124
- if (schema.default !== undefined)
125
- intersection.push(importer.tag("Default", schema.default));
126
- if (schema.minLength !== undefined)
127
- intersection.push(importer.tag("MinLength", schema.minLength));
128
- if (schema.maxLength !== undefined)
129
- intersection.push(importer.tag("MaxLength", schema.maxLength));
130
- if (schema.pattern !== undefined)
131
- intersection.push(importer.tag("Pattern", schema.pattern));
132
- if (
133
- schema.format !== undefined &&
134
- (FormatCheatSheet as Record<string, string>)[schema.format] !==
135
- undefined
136
- )
137
- intersection.push(importer.tag("Format", schema.format));
138
- return intersection.length === 1
139
- ? intersection[0]
140
- : ts.factory.createIntersectionTypeNode(intersection);
141
- };
142
-
143
- /* -----------------------------------------------------------
144
- INSTANCES
145
- ----------------------------------------------------------- */
146
- const writeArray =
147
- (components: ISwaggerComponents) =>
148
- (importer: MigrateImportProgrammer) =>
149
- (schema: ISwaggerSchema.IArray): ts.TypeNode => {
150
- const intersection: ts.TypeNode[] = [
151
- ts.factory.createArrayTypeNode(
152
- write(components)(importer)(schema.items),
153
- ),
154
- ];
155
- if (schema.minItems !== undefined)
156
- intersection.push(importer.tag("MinItems", schema.minItems));
157
- if (schema.maxItems !== undefined)
158
- intersection.push(importer.tag("MaxItems", schema.maxItems));
159
- return intersection.length === 1
160
- ? intersection[0]
161
- : ts.factory.createIntersectionTypeNode(intersection);
162
- };
163
-
164
- const writeObject =
165
- (components: ISwaggerComponents) =>
166
- (importer: MigrateImportProgrammer) =>
167
- (schema: ISwaggerSchema.IObject): ts.TypeNode => {
168
- const regular = () =>
169
- ts.factory.createTypeLiteralNode(
170
- Object.entries(schema.properties ?? []).map(([key, value]) =>
171
- writeRegularProperty(components)(importer)(schema.required ?? [])(
172
- key,
173
- value,
174
- ),
175
- ),
176
- );
177
- const dynamic = () =>
178
- ts.factory.createTypeLiteralNode([
179
- writeDynamicProperty(components)(importer)(
180
- schema.additionalProperties as ISwaggerSchema,
181
- ),
182
- ]);
183
- return !!schema.properties?.length &&
184
- typeof schema.additionalProperties === "object"
185
- ? ts.factory.createIntersectionTypeNode([regular(), dynamic()])
186
- : typeof schema.additionalProperties === "object"
187
- ? dynamic()
188
- : regular();
189
- };
190
-
191
- const writeRegularProperty =
192
- (components: ISwaggerComponents) =>
193
- (importer: MigrateImportProgrammer) =>
194
- (required: string[]) =>
195
- (key: string, value: ISwaggerSchema) =>
196
- FilePrinter.description(
197
- ts.factory.createPropertySignature(
198
- undefined,
199
- Escaper.variable(key)
200
- ? ts.factory.createIdentifier(key)
201
- : ts.factory.createStringLiteral(key),
202
- required.includes(key)
203
- ? undefined
204
- : ts.factory.createToken(ts.SyntaxKind.QuestionToken),
205
- write(components)(importer)(value),
206
- ),
207
- writeComment(value),
208
- );
209
-
210
- const writeDynamicProperty =
211
- (components: ISwaggerComponents) =>
212
- (importer: MigrateImportProgrammer) =>
213
- (value: ISwaggerSchema) =>
214
- FilePrinter.description(
215
- ts.factory.createIndexSignature(
216
- undefined,
217
- [
218
- ts.factory.createParameterDeclaration(
219
- undefined,
220
- undefined,
221
- ts.factory.createIdentifier("key"),
222
- undefined,
223
- TypeFactory.keyword("string"),
224
- ),
225
- ],
226
- write(components)(importer)(value),
227
- ),
228
- writeComment(value),
229
- );
230
-
231
- const writeReference =
232
- (importer: MigrateImportProgrammer) =>
233
- (
234
- schema: ISwaggerSchema.IReference,
235
- ): ts.TypeReferenceNode | ts.KeywordTypeNode => {
236
- if (schema.$ref.startsWith("#/components/schemas") === false)
237
- return TypeFactory.keyword("any");
238
- const name: string = schema.$ref.split("/").at(-1)!;
239
- return name === ""
240
- ? TypeFactory.keyword("any")
241
- : importer.dto(schema.$ref.split("/").at(-1)!);
242
- };
243
-
244
- /* -----------------------------------------------------------
245
- UNIONS
246
- ----------------------------------------------------------- */
247
- const writeUnion =
248
- (components: ISwaggerComponents) =>
249
- (importer: MigrateImportProgrammer) =>
250
- (elements: ISwaggerSchema[]): ts.UnionTypeNode =>
251
- ts.factory.createUnionTypeNode(elements.map(write(components)(importer)));
252
- }
253
- const createNode = (text: string) => ts.factory.createTypeReferenceNode(text);
254
- const writeComment = (schema: ISwaggerSchema): string =>
255
- [
256
- ...(schema.description?.length ? [schema.description] : []),
257
- ...(schema.description?.length &&
258
- (schema.title !== undefined || schema.deprecated === true)
259
- ? [""]
260
- : []),
261
- ...(schema.title !== undefined ? [`@title ${schema.title}`] : []),
262
- ...(schema.deprecated === true ? [`@deprecated`] : []),
263
- ].join("\n");
1
+ import ts from "typescript";
2
+ import typia from "typia";
3
+ import { ExpressionFactory } from "typia/lib/factories/ExpressionFactory";
4
+ import { TypeFactory } from "typia/lib/factories/TypeFactory";
5
+ import { FormatCheatSheet } from "typia/lib/tags/internal/FormatCheatSheet";
6
+ import { Escaper } from "typia/lib/utils/Escaper";
7
+
8
+ import { ISwaggerComponents } from "../structures/ISwaggerComponents";
9
+ import { ISwaggerSchema } from "../structures/ISwaggerSchema";
10
+ import { FilePrinter } from "../utils/FilePrinter";
11
+ import { SwaggerTypeChecker } from "../utils/SwaggerTypeChecker";
12
+ import { MigrateImportProgrammer } from "./MigrateImportProgrammer";
13
+
14
+ export namespace MigrateSchemaProgrammer {
15
+ /* -----------------------------------------------------------
16
+ FACADE
17
+ ----------------------------------------------------------- */
18
+ export const write =
19
+ (components: ISwaggerComponents) =>
20
+ (importer: MigrateImportProgrammer) =>
21
+ (schema: ISwaggerSchema): ts.TypeNode => {
22
+ const union: ts.TypeNode[] = [];
23
+ if (SwaggerTypeChecker.isUnknown(schema))
24
+ return TypeFactory.keyword("any");
25
+ else if (SwaggerTypeChecker.isNullOnly(schema)) return createNode("null");
26
+ else if (SwaggerTypeChecker.isNullable(components)(schema))
27
+ union.push(createNode("null"));
28
+
29
+ const type: ts.TypeNode = (() => {
30
+ // ATOMIC
31
+ if (SwaggerTypeChecker.isBoolean(schema))
32
+ return writeBoolean(importer)(schema);
33
+ else if (SwaggerTypeChecker.isInteger(schema))
34
+ return writeInteger(importer)(schema);
35
+ else if (SwaggerTypeChecker.isNumber(schema))
36
+ return writeNumber(importer)(schema);
37
+ // INSTANCES
38
+ else if (SwaggerTypeChecker.isString(schema))
39
+ return writeString(importer)(schema);
40
+ else if (SwaggerTypeChecker.isArray(schema))
41
+ return writeArray(components)(importer)(schema);
42
+ else if (SwaggerTypeChecker.isObject(schema))
43
+ return writeObject(components)(importer)(schema);
44
+ else if (SwaggerTypeChecker.isReference(schema))
45
+ return writeReference(importer)(schema);
46
+ // NESTED UNION
47
+ else if (SwaggerTypeChecker.isAnyOf(schema))
48
+ return writeUnion(components)(importer)(schema.anyOf);
49
+ else if (SwaggerTypeChecker.isOneOf(schema))
50
+ return writeUnion(components)(importer)(schema.oneOf);
51
+ else return TypeFactory.keyword("any");
52
+ })();
53
+ union.push(type);
54
+
55
+ if (union.length === 0) return TypeFactory.keyword("any");
56
+ else if (union.length === 1) return union[0];
57
+ return ts.factory.createUnionTypeNode(union);
58
+ };
59
+
60
+ /* -----------------------------------------------------------
61
+ ATOMICS
62
+ ----------------------------------------------------------- */
63
+ const writeBoolean =
64
+ (importer: MigrateImportProgrammer) =>
65
+ (schema: ISwaggerSchema.IBoolean): ts.TypeNode => {
66
+ if (schema.enum?.length)
67
+ return ts.factory.createLiteralTypeNode(
68
+ schema.enum[0] ? ts.factory.createTrue() : ts.factory.createFalse(),
69
+ );
70
+ const intersection: ts.TypeNode[] = [TypeFactory.keyword("boolean")];
71
+ writePlugin({
72
+ importer,
73
+ regular: typia.misc.literals<keyof ISwaggerSchema.IBoolean>(),
74
+ intersection,
75
+ })(schema);
76
+ return intersection.length === 1
77
+ ? intersection[0]
78
+ : ts.factory.createIntersectionTypeNode(intersection);
79
+ };
80
+
81
+ const writeInteger =
82
+ (importer: MigrateImportProgrammer) =>
83
+ (schema: ISwaggerSchema.IInteger): ts.TypeNode =>
84
+ writeNumeric(() => [
85
+ TypeFactory.keyword("number"),
86
+ importer.tag("Type", "int32"),
87
+ ])(importer)(schema);
88
+
89
+ const writeNumber =
90
+ (importer: MigrateImportProgrammer) =>
91
+ (schema: ISwaggerSchema.INumber): ts.TypeNode =>
92
+ writeNumeric(() => [TypeFactory.keyword("number")])(importer)(schema);
93
+
94
+ const writeNumeric =
95
+ (factory: () => ts.TypeNode[]) =>
96
+ (importer: MigrateImportProgrammer) =>
97
+ (schema: ISwaggerSchema.IInteger | ISwaggerSchema.INumber): ts.TypeNode => {
98
+ if (schema.enum?.length)
99
+ return ts.factory.createUnionTypeNode(
100
+ schema.enum.map((i) =>
101
+ ts.factory.createLiteralTypeNode(ExpressionFactory.number(i)),
102
+ ),
103
+ );
104
+ const intersection: ts.TypeNode[] = factory();
105
+ if (schema.default !== undefined)
106
+ intersection.push(importer.tag("Default", schema.default));
107
+ if (schema.minimum !== undefined)
108
+ intersection.push(
109
+ importer.tag(
110
+ schema.exclusiveMinimum ? "ExclusiveMinimum" : "Minimum",
111
+ schema.minimum,
112
+ ),
113
+ );
114
+ if (schema.maximum !== undefined)
115
+ intersection.push(
116
+ importer.tag(
117
+ schema.exclusiveMaximum ? "ExclusiveMaximum" : "Maximum",
118
+ schema.maximum,
119
+ ),
120
+ );
121
+ if (schema.multipleOf !== undefined)
122
+ intersection.push(importer.tag("MultipleOf", schema.multipleOf));
123
+ writePlugin({
124
+ importer,
125
+ regular: typia.misc.literals<keyof ISwaggerSchema.INumber>(),
126
+ intersection,
127
+ })(schema);
128
+ return intersection.length === 1
129
+ ? intersection[0]
130
+ : ts.factory.createIntersectionTypeNode(intersection);
131
+ };
132
+
133
+ const writeString =
134
+ (importer: MigrateImportProgrammer) =>
135
+ (schema: ISwaggerSchema.IString): ts.TypeNode => {
136
+ if (schema.format === "binary")
137
+ return ts.factory.createTypeReferenceNode("File");
138
+
139
+ const intersection: ts.TypeNode[] = [TypeFactory.keyword("string")];
140
+ if (schema.default !== undefined)
141
+ intersection.push(importer.tag("Default", schema.default));
142
+ if (schema.minLength !== undefined)
143
+ intersection.push(importer.tag("MinLength", schema.minLength));
144
+ if (schema.maxLength !== undefined)
145
+ intersection.push(importer.tag("MaxLength", schema.maxLength));
146
+ if (schema.pattern !== undefined)
147
+ intersection.push(importer.tag("Pattern", schema.pattern));
148
+ if (
149
+ schema.format !== undefined &&
150
+ (FormatCheatSheet as Record<string, string>)[schema.format] !==
151
+ undefined
152
+ )
153
+ intersection.push(importer.tag("Format", schema.format));
154
+ if (schema.contentMediaType !== undefined)
155
+ intersection.push(
156
+ importer.tag("ContentMediaType", schema.contentMediaType),
157
+ );
158
+ writePlugin({
159
+ importer,
160
+ regular: typia.misc.literals<keyof ISwaggerSchema.IString>(),
161
+ intersection,
162
+ })(schema);
163
+ return intersection.length === 1
164
+ ? intersection[0]
165
+ : ts.factory.createIntersectionTypeNode(intersection);
166
+ };
167
+
168
+ /* -----------------------------------------------------------
169
+ INSTANCES
170
+ ----------------------------------------------------------- */
171
+ const writeArray =
172
+ (components: ISwaggerComponents) =>
173
+ (importer: MigrateImportProgrammer) =>
174
+ (schema: ISwaggerSchema.IArray): ts.TypeNode => {
175
+ const intersection: ts.TypeNode[] = [
176
+ ts.factory.createArrayTypeNode(
177
+ write(components)(importer)(schema.items),
178
+ ),
179
+ ];
180
+ if (schema.minItems !== undefined)
181
+ intersection.push(importer.tag("MinItems", schema.minItems));
182
+ if (schema.maxItems !== undefined)
183
+ intersection.push(importer.tag("MaxItems", schema.maxItems));
184
+ writePlugin({
185
+ importer,
186
+ regular: typia.misc.literals<keyof ISwaggerSchema.IArray>(),
187
+ intersection,
188
+ })(schema);
189
+ return intersection.length === 1
190
+ ? intersection[0]
191
+ : ts.factory.createIntersectionTypeNode(intersection);
192
+ };
193
+
194
+ const writeObject =
195
+ (components: ISwaggerComponents) =>
196
+ (importer: MigrateImportProgrammer) =>
197
+ (schema: ISwaggerSchema.IObject): ts.TypeNode => {
198
+ const regular = () =>
199
+ ts.factory.createTypeLiteralNode(
200
+ Object.entries(schema.properties ?? []).map(([key, value]) =>
201
+ writeRegularProperty(components)(importer)(schema.required ?? [])(
202
+ key,
203
+ value,
204
+ ),
205
+ ),
206
+ );
207
+ const dynamic = () =>
208
+ ts.factory.createTypeLiteralNode([
209
+ writeDynamicProperty(components)(importer)(
210
+ schema.additionalProperties as ISwaggerSchema,
211
+ ),
212
+ ]);
213
+ return !!schema.properties?.length &&
214
+ typeof schema.additionalProperties === "object"
215
+ ? ts.factory.createIntersectionTypeNode([regular(), dynamic()])
216
+ : typeof schema.additionalProperties === "object"
217
+ ? dynamic()
218
+ : regular();
219
+ };
220
+
221
+ const writeRegularProperty =
222
+ (components: ISwaggerComponents) =>
223
+ (importer: MigrateImportProgrammer) =>
224
+ (required: string[]) =>
225
+ (key: string, value: ISwaggerSchema) =>
226
+ FilePrinter.description(
227
+ ts.factory.createPropertySignature(
228
+ undefined,
229
+ Escaper.variable(key)
230
+ ? ts.factory.createIdentifier(key)
231
+ : ts.factory.createStringLiteral(key),
232
+ required.includes(key)
233
+ ? undefined
234
+ : ts.factory.createToken(ts.SyntaxKind.QuestionToken),
235
+ write(components)(importer)(value),
236
+ ),
237
+ writeComment(value),
238
+ );
239
+
240
+ const writeDynamicProperty =
241
+ (components: ISwaggerComponents) =>
242
+ (importer: MigrateImportProgrammer) =>
243
+ (value: ISwaggerSchema) =>
244
+ FilePrinter.description(
245
+ ts.factory.createIndexSignature(
246
+ undefined,
247
+ [
248
+ ts.factory.createParameterDeclaration(
249
+ undefined,
250
+ undefined,
251
+ ts.factory.createIdentifier("key"),
252
+ undefined,
253
+ TypeFactory.keyword("string"),
254
+ ),
255
+ ],
256
+ write(components)(importer)(value),
257
+ ),
258
+ writeComment(value),
259
+ );
260
+
261
+ const writeReference =
262
+ (importer: MigrateImportProgrammer) =>
263
+ (
264
+ schema: ISwaggerSchema.IReference,
265
+ ): ts.TypeReferenceNode | ts.KeywordTypeNode => {
266
+ if (schema.$ref.startsWith("#/components/schemas") === false)
267
+ return TypeFactory.keyword("any");
268
+ const name: string = schema.$ref.split("/").at(-1)!;
269
+ return name === ""
270
+ ? TypeFactory.keyword("any")
271
+ : importer.dto(schema.$ref.split("/").at(-1)!);
272
+ };
273
+
274
+ /* -----------------------------------------------------------
275
+ UNIONS
276
+ ----------------------------------------------------------- */
277
+ const writeUnion =
278
+ (components: ISwaggerComponents) =>
279
+ (importer: MigrateImportProgrammer) =>
280
+ (elements: ISwaggerSchema[]): ts.UnionTypeNode =>
281
+ ts.factory.createUnionTypeNode(elements.map(write(components)(importer)));
282
+ }
283
+ const createNode = (text: string) => ts.factory.createTypeReferenceNode(text);
284
+ const writeComment = (schema: ISwaggerSchema): string =>
285
+ [
286
+ ...(schema.description?.length ? [schema.description] : []),
287
+ ...(schema.description?.length &&
288
+ (schema.title !== undefined || schema.deprecated === true)
289
+ ? [""]
290
+ : []),
291
+ ...(schema.title !== undefined ? [`@title ${schema.title}`] : []),
292
+ ...(schema.deprecated === true ? [`@deprecated`] : []),
293
+ ].join("\n");
294
+ const writePlugin =
295
+ (props: {
296
+ importer: MigrateImportProgrammer;
297
+ regular: string[];
298
+ intersection: ts.TypeNode[];
299
+ }) =>
300
+ (schema: any) => {
301
+ const extra: any = {};
302
+ for (const [key, value] of Object.entries(schema))
303
+ if (value !== undefined && false === props.regular.includes(key))
304
+ extra[key] = value;
305
+ if (Object.keys(extra).length !== 0)
306
+ props.intersection.push(props.importer.tag("JsonSchemaPlugin", extra));
307
+ };
@@ -1,13 +1,13 @@
1
- import { ISwaggerRouteParameter } from "./ISwaggerRouteParameter";
2
- import { ISwaggerRouteRequestBody } from "./ISwaggerRouteRequestBody";
3
- import { ISwaggerRouteResponse } from "./ISwaggerRouteResponse";
4
- import { ISwaggerSchema } from "./ISwaggerSchema";
5
- import { ISwaggerSecurityScheme } from "./ISwaggerSecurityScheme";
6
-
7
- export interface ISwaggerComponents {
8
- parameters?: Record<string, ISwaggerRouteParameter>;
9
- requestBodies?: Record<string, ISwaggerRouteRequestBody>;
10
- responses?: Record<string, ISwaggerRouteResponse>;
11
- schemas?: Record<string, ISwaggerSchema>;
12
- securitySchemes?: Record<string, ISwaggerSecurityScheme>;
13
- }
1
+ import { ISwaggerRouteParameter } from "./ISwaggerRouteParameter";
2
+ import { ISwaggerRouteRequestBody } from "./ISwaggerRouteRequestBody";
3
+ import { ISwaggerRouteResponse } from "./ISwaggerRouteResponse";
4
+ import { ISwaggerSchema } from "./ISwaggerSchema";
5
+ import { ISwaggerSecurityScheme } from "./ISwaggerSecurityScheme";
6
+
7
+ export interface ISwaggerComponents {
8
+ parameters?: Record<string, ISwaggerRouteParameter>;
9
+ requestBodies?: Record<string, ISwaggerRouteRequestBody>;
10
+ responses?: Record<string, ISwaggerRouteResponse>;
11
+ schemas?: Record<string, ISwaggerSchema>;
12
+ securitySchemes?: Record<string, ISwaggerSecurityScheme>;
13
+ }
@@ -52,6 +52,7 @@ export namespace ISwaggerSchema {
52
52
  enum?: string[];
53
53
  format?: string;
54
54
  pattern?: string;
55
+ contentMediaType?: string;
55
56
  /** @type uint */ minLength?: number;
56
57
  /** @type uint */ maxLength?: number;
57
58
  }