empty string now but length string later?
For a few of my schemas i have them setup like this, which means the values can be empty string:
But there are cases where I want to ensure the values are filled in, is there a way with arktype to specify that I want a schema to expect a value?
This is something that I run into a lot where the initial values stored into the DB are empty strings but when the data is updated via some controller i need to ensure the values are passed in. I dont want to duplicate all my schemas. Any recommendations?
1 Reply
The best way to handle a transform like this would be a custom wrapper.
Here's an example of how you could implement it:
You could extend that
map
call to apply other custom transforms depending on the value type