-
-
Notifications
You must be signed in to change notification settings - Fork 387
Closed
Labels
bugSomething isn't workingSomething isn't working
Description
What version of Elysia is running?
What platform is your computer?
Linux 6.16.6-3-cachyos x86_64 unknown
What environment are you using
1.2.21
Are you using dynamic mode?
no
What steps can reproduce the bug?
new Elysia()
.use(openapi())
.model({
idParam: t.Object({
id: t.Union([
t.String({ format: 'uuid' }),
t.Number({ minimum: 1, maximum: Number.MAX_SAFE_INTEGER })
])
}),
response200: t.Object({
message: t.String(),
content: t.Array(t.Object({
id: t.Union([t.String(), t.Number()])
}))
})
})
.get('/:id', ({ params: { id } }) => ({
message: 'ok',
content: [{ id }]
}), {
params: 'idParam',
response: 'response200'
})
.listen(3000);What is the expected behavior?
https://spec.openapis.org/oas/latest.html#operation-object
- Parameters should appear in the operation object.
- When I set params together with responses in the hook parameters for a route, the schemas should work correctly.
Example of expected response:
{
"message": "ok",
"content": [
{
"id": "22"
}
]
}What do you see instead?
- In the generated documentation, no parameters are shown.
- More importantly, when params are set together with responses in the hook parameters, the returned response is incorrectly parsed.
Example of actual response:
{
"message": "ok",
"content": "[\"{\\\"id\\\":22}\"]"
}Additional information
No response
Have you try removing the node_modules and bun.lockb and try again yet?
No response
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working