News for hackers. Stuff that matters.
Re:Rust Is Eating JavaScript by whizzter on Sunday February 16, 2025 @09:34AM (#43068344)
This is where OpenAPI/Swagger shines, we use C# backends and with NSwag (built in now also I think) you get an online API-spec directly from the controller (and types) of the C# code.

Only extra step is running a tool to download the swagger and produce auto-generated typescript definitions, otherwise the workflow is the same as shared code (Some projects are typescript on both ends but C# gives a ton of other benefits for backends).

Re:Rust Is Eating JavaScript by cjonas on Sunday February 16, 2025 @09:43AM (#43068410)
My recent experience with NSwag was really bad... It could only handle the simplest of jsonschema. We were trying to connect with a typescript API that had heavy use of union and product types. Maybe the problem was just that C# doesn't support algebraic typings?
Re:Rust Is Eating JavaScript by astrospective on Sunday February 16, 2025 @10:01AM (#43068528)
That would track, one of the few things I miss when writing c#. Instead you break out into interfaces as much as you can.
Re:Rust Is Eating JavaScript by whizzter on Sunday February 16, 2025 @01:35PM (#43070362)
Yeah, the C++/Java/C# family of type systems have obvious holes in them. There are various hacks/implementations for them but since they're not in the core they're not really expected to be supported by random tools either.

Like mentioned, our regular pipe is C# producer (server) and TS consumer (client). Consuming services authored in Java,etc is usually not a problem either but the TS system definetly has a bunch of more cases that aren't easily mapped.

Re:Rust Is Eating JavaScript by lbreakjai on Sunday February 16, 2025 @05:08PM (#43072216)
This is what we do. We use kiota to generate clients within other C# services, and orval to generate a client in the frontend. We also run some basic checks against the openapi definition in branch, to detect breaking changes and whatnot.