Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

No more output from phx.swagger.generate after upgrading to 0.8.1 #210

Open
phtrivier opened this issue Nov 6, 2018 · 8 comments
Open

Comments

@phtrivier
Copy link

phtrivier commented Nov 6, 2018

I have an umbrella project where one of the applications is a phoenix project.
I updated the version of phoenix_swagger in the phx app from ~> 0.7 to ~> 0.8.
This downloaded version 0.8.1, after which I have two issues:

  • When running mix test in the phx app, some other application can not start, with an error message complaining about plug_cowboy
warning: please add the following dependency to your mix.exs:

    {:plug_cowboy, "~> 1.0"}

This dependency is required by Plug.Adapters.Cowboy
which you may be using directly or indirectly.
Note you no longer need to depend on :cowboy directly.
  • When running mix phx.swagger.generate -r MyApp.Router -e MyApp.Endpoint priv/static/endpoint.json from the phx app, either nothing happens (no file is generated), or I get some nonsensical error:
Compiling 203 files (.ex)
** (MatchError) no match of right hand side value: {:error, :bad_directory}
    (mix) lib/mix/compilers/elixir.ex:168: Mix.Compilers.Elixir.compile_manifest/9
    (mix) lib/mix/task.ex:316: Mix.Task.run_task/3
    lib/mix/tasks/swagger.generate.ex:31: Mix.Tasks.Phx.Swagger.Generate.run/1
    (mix) lib/mix/task.ex:316: Mix.Task.run_task/3
    (mix) lib/mix/cli.ex:79: Mix.CLI.run_task/2
** (RuntimeError) Swagger Private build failed
    mix.exs:96: Sitecc.Mixfile.shell_or_fail/2
    mix.exs:103: Sitecc.Mixfile.swagger_build/1
    (mix) lib/mix/task.ex:355: Mix.Task.run_alias/3
    (mix) lib/mix/task.ex:279: Mix.Task.run/2
    (mix) lib/mix/cli.ex:79: Mix.CLI.run_task/2

I can imagine it's pretty localized to my project, and mix is not exactly deterministic, so it might have broken my install beyond repair.

However, no amount of rm -rf _builds && rm -rf deps && mix deps.get && mix deps.compile && mix please.please.please.do.something (which is my highly scientific elixir-compliant way of "working") seems to do the trick.

So any idea how I could attack the problem, would help.

I'm sticking to 0.7.0 in the meantime.

Thanks !

@mbuhot
Copy link
Contributor

mbuhot commented Nov 6, 2018

Which versions of plug, phoenix and elixir are you on? I’ll try to reproduce this issue.

@phtrivier
Copy link
Author

I'm using phoenix 1.34 and plug 1.6.4.
That being said, I would not be surprised if it was somehow linked to one of my swagger definitions, but the lack of logs make it hard to check...

@aristotelesbr
Copy link

I have the same problem...

Resolving Hex dependencies...
Dependency resolution completed:
Unchanged:

....
phoenix 1.3.4
phoenix_ecto 3.6.0
phoenix_html 2.12.0
phoenix_live_reload 1.1.7
phoenix_pubsub 1.1.1

plug 1.7.1
...

@beno
Copy link

beno commented Jan 26, 2019

My problems seem to be even worse, I have basically the same umbrella setup, I have to use 0.7 to get any kind of feedback, and when I can get it to work by explicitly adding the -r and -e options all I ever get is an empty file:

{
  "swagger": "2.0",
  "paths": {},
  "info": {
    "version": "1.0",
    "title": "My API"
  },
  "host": "localhost:4000",
  "definitions": {}
}

I am on Phoenix 1.4.0, plug 1.7.1, plug_cowboy 2.0.1

Edit: I looks like you need to add swagger_definitions functions to the controllers to get any kind of output? That is not clear from the docs.

Edit2: hmm, I still don't see any paths in my swagger.json...

Edit 3: oh you need swagger_path macros?

@shijithkjayan
Copy link

shijithkjayan commented Apr 20, 2019

I too had the same issue
followed this medium article to implement swagger. Except that I used the latest version of PhoenixSwagger, and the swagger.json file is not being generated.

My other dependency versions are as follows,
phoenix - 1.3.3,
phoenix_ecto - 3.2
phoenix_html 2.10
phoenix_pubsub - 1.0

Then I downgraded PhoenixSwagger to 0.6.2 and now it works fine.

@mbuhot
Copy link
Contributor

mbuhot commented Apr 20, 2019

@shijithkjayan did you add the required configuration?, added in version 0.8:

https://github.com/xerions/phoenix_swagger/blob/master/CHANGELOG.md#080

@djthread
Copy link

djthread commented Aug 5, 2019

I think this issue might be touching on the one I just submitted, #237.

I have no paths ("paths":{}) in my umbrella app.

@leeduckgo
Copy link

same problem now

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants