swagger-api / swagger-codegen

swagger-codegen contains a template-driven engine to generate documentation, API clients and server stubs in different languages by parsing your OpenAPI / Swagger definition.
http://swagger.io
Apache License 2.0
17.04k stars 6.03k forks source link

[C#] Codegen for Unity #8569

Open iBicha opened 6 years ago

iBicha commented 6 years ago
Description

Even though there's two generators for C# (csharp and csharp-dotnet2) both relying on RestSharp, and also both can be adapted to work with Unity, the game engine. But here's my motivation for a separate generator for Unity:

Please let me know what do you think.

kolodi commented 5 years ago

I'm interested in making the client generator specific for unity. I was searching the internet if there is something ready. We also finally have "official" json.net ported to the unity. The idea of using scriptable objects to store configurations for each API resource/methods/whole API is also very valid. I remember doing something like this a year ago using swagger 2.0, it was very custom for my project tho. We can start with something simple, for example, supporting only OpenAPI 3.0 and, maybe, creating some universal HTTP handler based on the scriptable object configuration without actual generation of classes and structs for the data.

EliCDavis commented 5 years ago

Is anyone working on this currently?

iBicha commented 5 years ago

Not that I know of tbh, I didn't get back to swagger/OpenAPI for a while, so I couldn't contribute much.

kolodi commented 5 years ago

Is anyone working on this currently?

I have this one working in Unity on all platforms.

EliCDavis commented 5 years ago

Dope. Well, I've forked this project and hopefully, it won't take me too long to implement. Never done this before.

Edit: Opted for building my own that includes extra functionality that doesn't make sense sitting in the swagger-codegen repo (like generating scriptable objects from arbitrary definitions found in the swagger file). The code generated uses 100% unity libraries. No need to include other dependencies in your project.

HugoMario commented 5 years ago

hello guys, please ping when you need to merge any PR.