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
16.74k stars 6.02k forks source link

[Elixir] Add server generator for Phoenix #7104

Open wing328 opened 6 years ago

wing328 commented 6 years ago
Description

We would like to add a new server generator for Elixir Phoenix

Similar to what we've done for PowerShell, Rust and other generators, we can first create a Petstore Phoenix server app with 3 endpoints listed below:

Then based on the Elixir Phoenix code, we'll start the reverse engineering process to create the generator and templates.

cc @mbuhot

Swagger-codegen version

Latest master

Suggest a fix/enhancement

If anyone wants to help out on this, please reply to let us know.

wing328 commented 6 years ago

We may want to first refactor ElixirClientCodegen.java into AbstractElixirCodegen.java (abstract class as the base of all Elixir generators)

Here are some abstract classes for other languages (e.g. C#, Java, Ada, Eiffel, etc): https://github.com/swagger-api/swagger-codegen/tree/master/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages (Abstract*Codegen.java)

isaac-rstor commented 6 years ago

Just wanted to chime in and note that I am working on a little project to get a plug-only (will support elixir without phoenix) codegenerator as a mix task item. Would work by entering "mix swagger" in the project directory. Suggestions on how to integrate this into this project would be most welcome.

wing328 commented 6 years ago

Just wanted to chime in and note that I am working on a little project to get a plug-only (will support elixir without phoenix)

Do you mean you want to create an Elixir server stub generator for another framework but not phoenix?

wing328 commented 6 years ago

https://github.com/swagger-api/swagger-codegen/wiki/How-to-add-a-generator-for-a-new-language-or-framework is a good starting point to create a server generator.