News for hackers. Stuff that matters.
Re:.NET Blazor by JackMorgan on Tuesday November 21, 2023 @10:48AM (#38365241)
I use swashbuckle and swagger-typescript-api to automatically scrape my controllers and generate API calls and TS types every time I rebuild. No hassle or overhead at all. No need for converters or anything.

I've been using this now for several projects, it's a great way to have all the power of TS for client side and C# for server side.

https://www.npmjs.com/package/swagger-typescript-api

https://www.nuget.org/packages/Swashbuckle

Re:.NET Blazor by CharlieDigital on Tuesday November 21, 2023 @11:21AM (#38365708)
I do the same.

I have a small write-up here: https://chrlschn.dev/blog/2023/10/end-to-end-type-safety-wit...

You get end-to-end type safety (even better once you connect it to EF Core since you get it all ways to your DB).

With this setup with hot-reload (currently broken in .NET 8 [0]), productivity is really, really good. Like tRPC but with one of the most powerful ORMs out there right now.

[0] https://github.com/dotnet/sdk/issues/36918

Re:.NET Blazor by aerhardt on Tuesday November 21, 2023 @11:38AM (#38365991)
I do the same in Django with drf-spectacular. I have a precommit hook that autogenerates (fairly thin) TypeScript schemas and routes on commit. This is not take merit from LOB devs who want to use C# back-to-front. I will use it as an argument to those who say that this is why you should go full TypeScript on any new web project though.
Re:.NET Blazor by switch007 on Tuesday November 21, 2023 @01:04PM (#38367423)
N.B. the last commit/release for Swashbuckle was Jan this year.

https://github.com/RicoSuter/NSwag might be a better choice for a new project. It look much more maintained and active than Swashbuckle

Re:.NET Blazor by dustymcp on Tuesday November 21, 2023 @03:49PM (#38369889)
yeah nswag has been pretty consistent i can recommend aswell.