You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
wrote some tests for test/validator/body.test.ts to investigate t.Integer() validation that was passing through in my project. Found that it wasn't validating my integers at all and was only really checking there were numbers.
it('rejects malformed integer from array object',async()=>{constapp=newElysia().post('/',({ body })=>body,{body: t.Array(t.Object({name: t.String(),job: t.String(),trait: t.Optional(t.String()),age: t.Integer(),rank: t.Integer()}))})constres=awaitapp.handle(post('/',[{name: 'sucrose',job: 'alchemist',age: 16.4,rank: 4}]))expect(res.status).toBe(422)})it('rejects malformed integer directly in array',async()=>{constapp=newElysia().post('/',({ body })=>body,{body: t.Array(t.Integer())})constres=awaitapp.handle(post('/',[1,2,3,4.2]))expect(res.status).toBe(422)})
found that they fail and pass through a 200. Seems like integer support is new #953 and this may have been an oversight?
What is the expected behavior?
Elysia should validate the nested integer and return a 422
What do you see instead?
Elysia passes through the non-integer to deeper layers, unvalidated.
Additional information
No response
Have you try removing the node_modules and bun.lockb and try again yet?
yes
The text was updated successfully, but these errors were encountered:
What version of Elysia is running?
1.2.10
What platform is your computer?
Darwin 24.1.0 arm64 arm
What steps can reproduce the bug?
wrote some tests for
test/validator/body.test.ts
to investigatet.Integer()
validation that was passing through in my project. Found that it wasn't validating my integers at all and was only really checking there were numbers.found that they fail and pass through a 200. Seems like integer support is new #953 and this may have been an oversight?
What is the expected behavior?
Elysia should validate the nested integer and return a 422
What do you see instead?
Elysia passes through the non-integer to deeper layers, unvalidated.
Additional information
No response
Have you try removing the
node_modules
andbun.lockb
and try again yet?yes
The text was updated successfully, but these errors were encountered: