-
-
Notifications
You must be signed in to change notification settings - Fork 494
Open
Labels
bugSomething isn't workingSomething isn't working
Description
What version of Elysia is running?
1.4.28
What platform is your computer?
Linux 6.18.13-arch1-1 x86_64 unknown
What environment are you using
Bun v1.3.9
Are you using dynamic mode?
no
What steps can reproduce the bug?
given this simple example
import { Elysia, t } from "elysia";
new Elysia()
.get("/", ({ query: { a, b } }) => `a = ${a}, b = ${b}`, {
query: t.Object({
a: t.Integer({ minimum: 1, maximum: 100 }),
b: t.Integer({ minimum: 1, maximum: 100 }),
}),
})
.listen(3000);then use invalid value for a / b such as 0 or 101
What is the expected behavior?
The path should retain.
What do you see instead?
The resulting error path is root instead of a or b.
{
"type": "validation",
"on": "property",
"property": "root",
"message": "Expected integer to be greater or equal to 1",
"summary": "Expected integer to be greater or equal to 1",
"found": 0,
"errors": [
{
"summary": "Expected integer to be greater or equal to 1",
"type": 25,
"schema": {
"minimum": 1,
"maximum": 100,
"type": "integer"
},
"path": "",
"value": 0,
"message": "Expected integer to be greater or equal to 1",
"errors": []
}
]
}Additional information
When i use invalid number, for example non numeric string, the error is correct, here's an example
{
"type": "validation",
"on": "query",
"property": "/a",
"message": "Expected union value",
"summary": "Property 'a' should be one of: 'integer', 'integer'",
"expected": {},
"found": {},
"errors": [
{
"type": 62,
"schema": {},
"path": "/a",
"value": "invalid",
"message": "Expected union value",
"errors": [],
"summary": "Property 'a' should be one of: 'integer', 'integer'"
},
{
"type": 62,
"schema": {},
"path": "/b",
"value": "invalid",
"message": "Expected union value",
"errors": [],
"summary": "Property 'b' should be one of: 'integer', 'integer'"
}
]
}Have you try removing the node_modules and bun.lockb and try again yet?
yes
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working