RicoSuter / NSwag

The Swagger/OpenAPI toolchain for .NET, ASP.NET Core and TypeScript.
http://NSwag.org
MIT License
6.68k stars 1.23k forks source link

C# Code generation with MessagePack serializer / deserializer ? #2531

Open christopheblin opened 4 years ago

christopheblin commented 4 years ago

For efficiency reasons, we use MessagePack instead of JSON in our WEB APIs (i.e when you add the HTTP header Accept = application/x-msgpack).

Is it possible to customize code generation of NSwag to use MessagePack ?

From what I can see, the code generation will need to change the Accept header as well as the serialization/deserialization, but maybe this is not easy to do ...

RicoSuter commented 4 years ago

You could replace the template and add message pack serialization. This PR adds additional XML serialization but message pack would look similar (probably even simpler): https://github.com/RicoSuter/NSwag/pull/2248

RicoSuter commented 4 years ago

Also see: https://github.com/RicoSuter/NSwag/issues/2082#issuecomment-517247453

Maybe there are other messagepack related issues.