Skip to content

Commit

Permalink
Merge pull request #95 from 0xAX/fix-swagger-ui-path
Browse files Browse the repository at this point in the history
fix path to swagger specification file in UI plug
  • Loading branch information
surik authored May 9, 2017
2 parents 64d626c + fc14d10 commit e7e5c2a
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 6 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# 0.6.2

* fix path assignation of a swagger specification file in UI plug

# 0.6.1

* Provide default host and port when generating swagger host config
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ dependencies in the `mix.exs` file:
```elixir
def deps do
[
{:phoenix_swagger, "~> 0.6.1"},
{:phoenix_swagger, "~> 0.6.2"},
{:ex_json_schema, "~> 0.5"} # optional
]
end
Expand Down
8 changes: 4 additions & 4 deletions lib/phoenix_swagger/plug/swaggerui.ex
Original file line number Diff line number Diff line change
Expand Up @@ -167,18 +167,18 @@ defmodule PhoenixSwagger.Plug.SwaggerUI do
"""
def init(otp_app: app, swagger_file: swagger_file) do
body = EEx.eval_string(@template, spec_url: swagger_file)
swagger_file_path = Path.join([Application.app_dir(app), "priv/static", swagger_file])
[body: body, spec_url: swagger_file, swagger_file_path: swagger_file_path]
swagger_file_path = Path.join(["priv", "static", swagger_file])
[app: app, body: body, spec_url: swagger_file, swagger_file_path: swagger_file_path]
end

@doc """
Plug.call callback
"""
def call(conn, body: body, spec_url: url, swagger_file_path: swagger_file_path) do
def call(conn, app: app, body: body, spec_url: url, swagger_file_path: swagger_file_path) do
conn
|> Conn.assign(:index_body, body)
|> Conn.assign(:spec_url, url)
|> Conn.assign(:swagger_file_path, swagger_file_path)
|> Conn.assign(:swagger_file_path, Path.join([Application.app_dir(app), swagger_file_path]))
|> super([])
end
end
2 changes: 1 addition & 1 deletion mix.exs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
defmodule PhoenixSwagger.Mixfile do
use Mix.Project

@version "0.6.1"
@version "0.6.2"

def project do
[app: :phoenix_swagger,
Expand Down

0 comments on commit e7e5c2a

Please sign in to comment.