Smart architecture for handling Types, Models and Schemas with TS and OAS3 #2769
Unanswered
benediktdertinger
asked this question in
Q&A
Replies: 3 comments 7 replies
-
Another tool you can try is typebox not sure if it exactly addresses your use case but is another really sweet tool for this kind of problem |
Beta Was this translation helpful? Give feedback.
1 reply
-
hey @benediktdertinger did you ever find a solution to this problem? |
Beta Was this translation helpful? Give feedback.
6 replies
-
Don't use Mongoose. You are doing a relational model on top of a non-relational database. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
UPDATE: TL;DR
--> This article (5. Splitting the user model into backend and frontend representations) was helpful.
Hello everyone,
we are currently migrating huge APIs from Fastify 2.x to 3.x. While refactoring major parts we decided to us an feature-base architecture (e.g. user routes, services etc. in one folder) instead of separating by type (like controllers, services etc.).
While doing so we realized we also have to put a lot of effort in writing pretty similar logic and structures for these things:
Ideally these should be compatible with Open API Specification 3 (fastify-oas) in the end (which is working quite well when writing all the schemas).
There are some helpers like fluent-schema or json-schema-to-typescript but they all are limited in some way. JSON Schema for example does not allow for using variables (obviously) but is needed to create TS Types.
Before discussing detailed questions I was just wondering if there are already recommended workflows and architectures (besides the ones mentioned) to reduce efforts?
Beta Was this translation helpful? Give feedback.
All reactions