Skip to content

Commit 57c694e

Browse files
committed
fix: update usage of x-ts-type for schemas
See #1933
1 parent cd8a44b commit 57c694e

File tree

8 files changed

+21
-21
lines changed

8 files changed

+21
-21
lines changed

docs/site/Controller-generator.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ export class TodoController {
119119
responses: {
120120
'200': {
121121
description: 'Todo model instance',
122-
content: {'application/json': {'x-ts-type': Todo}},
122+
content: {'application/json': {schema: {'x-ts-type': Todo}}},
123123
},
124124
},
125125
})
@@ -131,7 +131,7 @@ export class TodoController {
131131
responses: {
132132
'200': {
133133
description: 'Todo model count',
134-
content: {'application/json': {'x-ts-type': Number}},
134+
content: {'application/json': {schema: {'x-ts-type': Number}}},
135135
},
136136
},
137137
})
@@ -163,7 +163,7 @@ export class TodoController {
163163
responses: {
164164
'200': {
165165
description: 'Todo PATCH success count',
166-
content: {'application/json': {'x-ts-type': Number}},
166+
content: {'application/json': {schema: {'x-ts-type': Number}}},
167167
},
168168
},
169169
})
@@ -178,7 +178,7 @@ export class TodoController {
178178
responses: {
179179
'200': {
180180
description: 'Todo model instance',
181-
content: {'application/json': {'x-ts-type': Todo}},
181+
content: {'application/json': {schema: {'x-ts-type': Todo}}},
182182
},
183183
},
184184
})

docs/site/todo-list-tutorial-controller.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ export class TodoListController {
131131
responses: {
132132
'200': {
133133
description: 'TodoList model instance',
134-
content: {'application/json': {'x-ts-type': TodoList}},
134+
content: {'application/json': {schema: {'x-ts-type': TodoList}}},
135135
},
136136
},
137137
})
@@ -157,7 +157,7 @@ export class TodoListController {
157157
responses: {
158158
'200': {
159159
description: 'Array of TodoList model instances',
160-
content: {'application/json': {'x-ts-type': TodoList}},
160+
content: {'application/json': {schema: {'x-ts-type': TodoList}}},
161161
},
162162
},
163163
})
@@ -186,7 +186,7 @@ export class TodoListController {
186186
responses: {
187187
'200': {
188188
description: 'TodoList model instance',
189-
content: {'application/json': {'x-ts-type': TodoList}},
189+
content: {'application/json': {schema: {'x-ts-type': TodoList}}},
190190
},
191191
},
192192
})

examples/todo-list/src/controllers/todo-list-todo.controller.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ export class TodoListTodoController {
3131
responses: {
3232
'200': {
3333
description: 'TodoList.Todo model instance',
34-
content: {'application/json': {'x-ts-type': Todo}},
34+
content: {'application/json': {schema: {'x-ts-type': Todo}}},
3535
},
3636
},
3737
})

examples/todo-list/src/controllers/todo-list.controller.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ export class TodoListController {
3333
responses: {
3434
'200': {
3535
description: 'TodoList model instance',
36-
content: {'application/json': {'x-ts-type': TodoList}},
36+
content: {'application/json': {schema: {'x-ts-type': TodoList}}},
3737
},
3838
},
3939
})
@@ -59,7 +59,7 @@ export class TodoListController {
5959
responses: {
6060
'200': {
6161
description: 'Array of TodoList model instances',
62-
content: {'application/json': {'x-ts-type': TodoList}},
62+
content: {'application/json': {schema: {'x-ts-type': TodoList}}},
6363
},
6464
},
6565
})
@@ -88,7 +88,7 @@ export class TodoListController {
8888
responses: {
8989
'200': {
9090
description: 'TodoList model instance',
91-
content: {'application/json': {'x-ts-type': TodoList}},
91+
content: {'application/json': {schema: {'x-ts-type': TodoList}}},
9292
},
9393
},
9494
})

examples/todo-list/src/controllers/todo.controller.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ export class TodoController {
2424
responses: {
2525
'200': {
2626
description: 'Todo model instance',
27-
content: {'application/json': {'x-ts-type': Todo}},
27+
content: {'application/json': {schema: {'x-ts-type': Todo}}},
2828
},
2929
},
3030
})
@@ -36,7 +36,7 @@ export class TodoController {
3636
responses: {
3737
'200': {
3838
description: 'Todo model instance',
39-
content: {'application/json': {'x-ts-type': Todo}},
39+
content: {'application/json': {schema: {'x-ts-type': Todo}}},
4040
},
4141
},
4242
})
@@ -108,7 +108,7 @@ export class TodoController {
108108
responses: {
109109
'200': {
110110
description: 'TodoList model instance',
111-
content: {'application/json': {'x-ts-type': TodoList}},
111+
content: {'application/json': {schema: {'x-ts-type': TodoList}}},
112112
},
113113
},
114114
})

examples/todo/src/controllers/todo.controller.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ export class TodoController {
2929
responses: {
3030
'200': {
3131
description: 'Todo model instance',
32-
content: {'application/json': {'x-ts-type': Todo}},
32+
content: {'application/json': {schema: {'x-ts-type': Todo}}},
3333
},
3434
},
3535
})
@@ -49,7 +49,7 @@ export class TodoController {
4949
responses: {
5050
'200': {
5151
description: 'Todo model instance',
52-
content: {'application/json': {'x-ts-type': Todo}},
52+
content: {'application/json': {schema: {'x-ts-type': Todo}}},
5353
},
5454
},
5555
})

packages/cli/generators/controller/templates/src/controllers/controller-rest-template.ts.ejs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ export class <%= className %>Controller {
2828
responses: {
2929
'200': {
3030
description: '<%= modelName %> model instance',
31-
content: {'application/json': {'x-ts-type': <%= modelName %>}},
31+
content: {'application/json': {schema: {'x-ts-type': <%= modelName %>}}},
3232
},
3333
},
3434
})
@@ -87,7 +87,7 @@ export class <%= className %>Controller {
8787
responses: {
8888
'200': {
8989
description: '<%= modelName %> model instance',
90-
content: {'application/json': {'x-ts-type': <%= modelName %>}},
90+
content: {'application/json': {schema: {'x-ts-type': <%= modelName %>}}},
9191
},
9292
},
9393
})

packages/cli/test/integration/generators/controller.integration.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -247,7 +247,7 @@ function checkRestCrudContents() {
247247
/responses: {/,
248248
/'200': {/,
249249
/description: 'ProductReview model instance'/,
250-
/content: {'application\/json': {'x-ts-type': ProductReview}},\s{1,}},\s{1,}},\s{1,}}\)/,
250+
/content: {'application\/json': {schema: {'x-ts-type': ProductReview}}},\s{1,}},\s{1,}},\s{1,}}\)/,
251251
/async create\(\@requestBody\(\) productReview: ProductReview\)/,
252252
];
253253
postCreateRegEx.forEach(regex => {
@@ -273,7 +273,7 @@ function checkRestCrudContents() {
273273
/responses: {/,
274274
/'200': {/,
275275
/description: 'Array of ProductReview model instances'/,
276-
/content: {'application\/json': {'x-ts-type': ProductReview}},\s{1,}},\s{1,}},\s{1,}}\)/,
276+
/content: {'application\/json': {schema: {'x-ts-type': ProductReview}}},\s{1,}},\s{1,}},\s{1,}}\)/,
277277
/async find\(\s*\@param\.query\.object\('filter', getFilterSchemaFor\(ProductReview\)\) filter\?: Filter(|,\s+)\)/,
278278
];
279279
getFindRegEx.forEach(regex => {
@@ -299,7 +299,7 @@ function checkRestCrudContents() {
299299
/responses: {/,
300300
/'200': {/,
301301
/description: 'ProductReview model instance'/,
302-
/content: {'application\/json': {'x-ts-type': ProductReview}},\s{1,}},\s{1,}},\s{1,}}\)/,
302+
/content: {'application\/json': {schema: {'x-ts-type': ProductReview}}},\s{1,}},\s{1,}},\s{1,}}\)/,
303303
/async findById\(\@param.path.number\('id'\)/,
304304
];
305305
getFindByIdRegEx.forEach(regex => {

0 commit comments

Comments
 (0)