Replies: 3 comments 1 reply
-
@cheersmas Hi,
This is from TypeBox. The const T = Type.String({ format: 'uuid', default: '00000000-0000-0000-0000-000000000000' }) The default value helps ensure that TypeBox generates a correct value. |
Beta Was this translation helpful? Give feedback.
-
TypeBox doesn't use TypeBox implements https://json-schema.org/understanding-json-schema/reference/generic.html
The Value.Create function falls into the "Non-Validation Tools" category, where this function can be used outside of validation pipelines to initialize a value. The Value.Create function will initialize a value with the If using Value.Create and you receive an error trying to create the value, the recommendation is to ensure the type that is causing the error have a default value, and that the default value matches the anticipated type.
TypeBox does not implement any formats by default (not even the ones listed for the There has been some consideration towards TypeBox implementing the default https://github.com/sinclairzx81/typebox/tree/master/examples/formats Until a complete set of validators can be established, TypeBox requires integrators to define their own formats. This would be inline with Elysia's implementation. Hope this helps |
Beta Was this translation helpful? Give feedback.
-
Maybe I can chime in a bit here. In the specific context of Elysiajs, I found that Elysia does seem to use So even though it's just for validation, Elysia is still needing to call |
Beta Was this translation helpful? Give feedback.
-
I'm trying to setup validations for email and password like following:
rest of the code for route
but when I use this to validate my body in a request it throws an error that
ValueCreate.String: String types with formats must specify a default value
if I remove the format fromemail
it throws the same error but forpattern
used inpassword
:ValueCreate.String: String types with patterns must specify a default value
.Debugger throws from here: which feels like an elysia file.
Do they require defaults? I didn't see them in the docs.
Is this coming from bun or is this from typebox?
Beta Was this translation helpful? Give feedback.
All reactions