-
-
Notifications
You must be signed in to change notification settings - Fork 269
missing swagger route doc when using model[] in response #1147
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
The import Elysia, { t } from 'elysia';
export const todoSchema = t.Object({
id: t.String(),
createdAt: t.Date(),
updatedAt: t.Date(),
createdById: t.String(),
title: t.String(),
description: t.Optional(t.String()),
assignedAt: t.Optional(t.Date()),
completedAt: t.Optional(t.Date()),
SubtaskIds: t.Array(t.String()),
ParentTaskIds: t.Array(t.String()),
});
export const todoService = new Elysia({ name: 'todos/service' }).model({
todo: todoSchema,
});
export const todoRouter = new Elysia({ prefix: '/todos', tags: ['todos'] })
.use(todoService)
.get(
'/',
() => {
return [
{
id: '1',
createdAt: new Date(),
updatedAt: new Date(),
createdById: '1',
title: 'Todo 1',
description: 'Description 1',
assignedAt: new Date(),
completedAt: new Date(),
SubtaskIds: ['1', '2', '3'],
ParentTaskIds: ['1', '2', '3'],
},
];
},
{
response: t.Array(todoSchema),
query: t.Object({
userId: t.String(),
}),
}
)
.get('/:id', ({ params: { id } }) => id, {
params: t.Object({
// id: t.RegExp(/^\d+$/),
id: t.String({ format: 'regex', pattern: '^\\d+$' }),
}),
}); |
Todo[] should work too Idk why salty merge it without fully testing |
How is it now? Is it working? |
What version of Elysia is running?
Latest version: 1.2.25 published 3 weeks ago
What platform is your computer?
ubuntu 24
What steps can reproduce the bug?
add swagger plugin and check the route documentation, it's missing
What is the expected behavior?
No response
What do you see instead?
No response
Additional information
No response
Have you try removing the
node_modules
andbun.lockb
and try again yet?No response
The text was updated successfully, but these errors were encountered: