Nice work with typia, the job done has been amazing :)
Would you be willing to create a Fastify plugin for typia?
The results can be amazing! Happy to help you with it.
Iām part of Fastify team btw, in case you would like to share some thoughts or doubts about Fastify :)
So at this point I'm wondering if the benefits of nestia for Fastify can't be embedded upstream (as in making it fast by default when just using fastify)?
Yeah, made everything within a repo of your authorship and once done, we can incorporate it at the list of community plugins :)
Feel free to ping me out if you want a second pair eyes!
At first, fastify provides plugin interfaces only through the JSON schema defition. As typia can generate JSON schema, it is possible to utilizing current plugin interface of fastify like above.
However, typia is a transformer library generating optimal code in the compilation time, utilizing pure TypeScript type. To maximize strength of typia and make users to be much convenient, I think below code would be should be possible.
importfastifyfrom"fastify";importtypiaProviderfrom"@fastify/type-provider-typia";constserver=fastify();constwrapper=typiaProvider.install(server);wrapper.post<{query:SomeQueryDto;body:SomeRequestBodyDto;response:SomeResponseBodyDto;}>("/some-path",(req,rep)=>{req.query// -> type checked SomeQueryDtoreq.body// -> type checked SomeRequestBodyDtorep.send({...});// -> faster stringify with type assertion (SomeResponseBodyDto)req.headers;// -> no type checking because not specified});
The typiaProvider.post<T>() function will generate both type assertion (+ JSON serialization when response) and JSON schema definition for Swagger at the same time. Of course, above code requires modifications from plugin APIs of fastify. Therefore, I need to debate about it detaily as an issue.
p.s) I'm developing protobuf features, therefore when fastify accepts typia as a plugin, you can easily support protobuf typed routers very easily.
Wow, that sounds interesting. What modifications are you looking for exactly?
In theory, the fastify.register should provide you access to the encapsulated context where the plugin is being added, and therefore decorate any possible route being register through fastify.<post | get | ...>.
But please, open an issue at fastify repo and we can help you sorting things out :)
I've been making guide documents of typia and nestia in nowaydays, and such documentation works had consumed much more time than what I'd expected. Therefore, could not develop the plugin in this weekend.
Anyway, stuyding fastify, I understood that there're enormous things to develop to adjust transform library typia in fastify. There are already a lot of elements to be developed, so I'm going to make a fastify plugin like nestia, which can build SDK library.
Please wait for one to two months, then I'll take interesting plugin.
Now, only "Swagger to NestJS" converter project is left for me. It may requires 2~3 weeks, and I'll start the pure fastify plugin project after that. Also, I'll run benchmark fastify + typia, too. Thanks for waiting.
Nice work with typia, the job done has been amazing :)
Would you be willing to create a Fastify plugin for typia?
The results can be amazing! Happy to help you with it.
Iām part of Fastify team btw, in case you would like to share some thoughts or doubts about Fastify :)
So at this point I'm wondering if the benefits of nestia for Fastify can't be embedded upstream (as in making it fast by default when just using fastify)?
Got it, I'll try at next Sunday (not tomorrow).
Anyway, where the plugin would be placed in? Just in my github account? Or as a fastify repo?
Sure thing!
Yeah, made everything within a repo of your authorship and once done, we can incorporate it at the list of community plugins :)
Feel free to ping me out if you want a second pair eyes!
What is your github accout name?
I will write an issue on
fastifyrepo tagging you, and need to debate about below:At first,
fastifyprovides plugin interfaces only through the JSON schema defition. Astypiacan generate JSON schema, it is possible to utilizing current plugin interface offastifylike above.However,
typiais a transformer library generating optimal code in the compilation time, utilizing pure TypeScript type. To maximize strength oftypiaand make users to be much convenient, I think below code would be should be possible.The
typiaProvider.post<T>()function will generate both type assertion (+ JSON serialization whenresponse) and JSON schema definition for Swagger at the same time. Of course, above code requires modifications from plugin APIs offastify. Therefore, I need to debate about it detaily as an issue.p.s) I'm developing protobuf features, therefore when
fastifyacceptstypiaas a plugin, you can easily support protobuf typed routers very easily.Hey! Please reach out in GH as
metcoder95!Wow, that sounds interesting. What modifications are you looking for exactly?
In theory, the
fastify.registershould provide you access to the encapsulated context where the plugin is being added, and therefore decorate any possible route being register throughfastify.<post | get | ...>.But please, open an issue at
fastifyrepo and we can help you sorting things out :)Sorry for late.
I've been making guide documents of
typiaandnestiain nowaydays, and such documentation works had consumed much more time than what I'd expected. Therefore, could not develop the plugin in this weekend.Anyway, stuyding
fastify, I understood that there're enormous things to develop to adjust transform librarytypiainfastify. There are already a lot of elements to be developed, so I'm going to make a fastifypluginlike nestia, which can build SDK library.Please wait for one to two months, then I'll take interesting plugin.
Please, do not rush it. Happy to wait for the results, please let me know if you need any support or similar. Happy to support you with anything!
Currently, succeeded to support
fastifythroughnestiainNestJS.nestia.io/docs/
github.com/samchon/nestia/tree/mas...
Now, only "Swagger to NestJS" converter project is left for me. It may requires 2~3 weeks, and I'll start the pure fastify plugin project after that. Also, I'll run benchmark
fastify + typia, too. Thanks for waiting.Hey! That's amazing! Don't worry about the plugin, take your time :)