Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Add swagger to phoenix framework application

I am new to Elixir/Phoenix. Is there a way to add Swagger documentation to the Phoenix api project?

I looked at https://github.com/xerions/phoenix_swagger but that was updated several months ago and has unresolved old open issues.

This is another one https://github.com/OpenAperture/swaggerdoc with similar issues.

Or should I be using Maru for api projects?

like image 905
Puneet Avatar asked Mar 18 '26 16:03

Puneet


2 Answers

Both projects get updates. SwaggerDoc offers Ecto support, but the Build status has been failing for two months.

PhoenixSwagger doesn't, but depends on extending the controller (which you can use to implement Ecto support yourself). Also it appears to be actively maintained at the moment.

like image 157
raarts Avatar answered Mar 22 '26 11:03

raarts


We are actively maintaining https://github.com/everydayhero/phoenix_swagger with additional features

defmodule MyApp.UserController do
  use MyApp.Web, :controller
  import PhoenixSwagger

  swagger_path :index do
    get "/users"
    summary "Get users"
    description "Get all users"
    response 200, "Success", :Users
    tag "users"
  end
like image 28
Mike Buhot Avatar answered Mar 22 '26 12:03

Mike Buhot



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!