Zod integration and nullable values for the schema #746
Unanswered
Nils-Kolvenbach
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I am currently exploring options to implement search functionality for elek.io - which is a file based CMS that runs on your local computer instead of a server. Orama seems to be the best fit yet (thanks for all your work). But I am running into some problems trying to implement it.
Schema duplication
Since orama uses it's own schema and I am using zod I have to duplicate my schemas. Of cause orama cannot possibly support all schema validation libraries out there. But maybe someone has an idea how to improve on this?
Zod:
Orama:
Weaker search result types
The result type of oramas search function is looser compared to my other functions returning a strict type inferred from it's zod schema. This would require me to use a type guard or to cast - or is there another solution I might not see right now?
Zod:
Orama:
Nullable values do not seem to be supported
As you might have noticed, the type of
updated
is a number or null. There currently is no mention of nullable values in the documentation and I don't know how to handle this. I would like to haveupdated
as a searchable value. Do I have to set it to undefined before inserting it into the orama db and then set it to null again after if the value is null?Any feedback is appreciated and thanks in advance!
Beta Was this translation helpful? Give feedback.
All reactions