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
Hi! I'm using ElysiaJS and I find myself writing two versions of my schemas, a Mongoose one for using as a document model, and the TypeBox ones for using as guards and return types. Usually though, they're exactly the same, or at least extremely similar (thus extendable one from the other). Is there a known way of just writing one of these schemas and inferring the other? Ideally, I would just write a Mongoose schema, for example, and it should work as a return type as well (although maybe after a conversion process, perhaps). Or the other way around, the key is eliminating complexity
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Hi! I'm using ElysiaJS and I find myself writing two versions of my schemas, a Mongoose one for using as a document model, and the TypeBox ones for using as guards and return types. Usually though, they're exactly the same, or at least extremely similar (thus extendable one from the other). Is there a known way of just writing one of these schemas and inferring the other? Ideally, I would just write a Mongoose schema, for example, and it should work as a return type as well (although maybe after a conversion process, perhaps). Or the other way around, the key is eliminating complexity
Beta Was this translation helpful? Give feedback.
All reactions