Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,9 @@ The conversion uses schema fields and updates them into schemas unde the [Defini
* :boolean -> %{"type" => "boolean"}
* :string -> %{"type" => "string"}
* :binary -> %{"type" => "string", "format" => "binary"}
* :naive_datetime -> %{"type" => "string", "format" => "date-time"}
* :date -> %{"type" => "string", "format" => "date"}
* :time -> %{"type" => "string", "format" => "date-time"}
* :Ecto.DateTime -> %{"type" => "string", "format" => "date-time"}
* :Ecto.Date -> %{"type" => "string", "format" => "date"}
* :Ecto.Time -> %{"type" => "string", "format" => "date-time"}
Expand Down
13 changes: 10 additions & 3 deletions lib/mix/tasks/swagger.ex
Original file line number Diff line number Diff line change
Expand Up @@ -110,9 +110,13 @@ defmodule Mix.Tasks.Swagger do
@spec get_router([any]) :: term
def get_router(args) do
cond do
args != nil && length(args) > 0 -> Module.concat("Elixir", Enum.at(args, 0))
Mix.Project.umbrella? -> Mix.raise "Umbrella applications require an explicit router to be given to Phoenix.routes"
true -> Module.concat(Mix.Phoenix.base(), "Router")
args != nil && length(args) > 0 ->
Module.concat("Elixir", Enum.at(args, 0))
Mix.Project.umbrella? ->
Mix.raise "Umbrella applications require an explicit router to be given to Phoenix.routes"
true ->
Keyword.get(Mix.Phoenix.inflect(""), :web_module)
|> Module.concat("Router")
end
end

Expand Down Expand Up @@ -274,6 +278,9 @@ defmodule Mix.Tasks.Swagger do
:boolean -> %{"type" => "boolean"}
:string -> %{"type" => "string"}
:binary -> %{"type" => "string", "format" => "binary"}
:naive_datetime -> %{"type" => "string", "format" => "date-time"}
:date -> %{"type" => "string", "format" => "date"}
:time -> %{"type" => "string", "format" => "date-time"}
Ecto.DateTime -> %{"type" => "string", "format" => "date-time"}
Ecto.Date -> %{"type" => "string", "format" => "date"}
Ecto.Time -> %{"type" => "string", "format" => "date-time"}
Expand Down
8 changes: 4 additions & 4 deletions mix.exs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ defmodule SwaggerDoc.Mixfile do
[
app: :swaggerdoc,
version: @version,
elixir: "~> 1.0",
elixir: "~> 1.4",
build_embedded: Mix.env == :prod,
start_permanent: Mix.env == :prod,
deps: deps(),
Expand Down Expand Up @@ -43,12 +43,12 @@ defmodule SwaggerDoc.Mixfile do
# Type `mix help deps` for more examples and options
defp deps do
[
{:phoenix, "~> 1.2"},
{:ecto, "~> 2.0"},
{:phoenix, "~> 1.3"},
{:ecto, "~> 2.1"},
{:poison, "~> 2.0"},
{:ex_doc, "~> 0.8.4", only: :docs},
{:earmark, "~> 0.1.17", only: :docs},
{:meck, "~> 0.8.3", only: :test},
{:meck, "~> 0.8.4", only: :test},
]
end

Expand Down
22 changes: 11 additions & 11 deletions mix.lock
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
%{"decimal": {:hex, :decimal, "1.2.0", "462960fd71af282e570f7b477f6be56bf8968e68277d4d0b641a635269bf4b0d", [:mix], []},
"earmark": {:hex, :earmark, "0.1.17", "a2269e72ff85501bdb58c2de9edc0a9a17a4be2757883eed1f601b30494ed2bf", [:mix], []},
"ecto": {:hex, :ecto, "2.0.5", "7f4c79ac41ffba1a4c032b69d7045489f0069c256de606523c65d9f8188e502d", [:mix], [{:db_connection, "~> 1.0-rc.4", [hex: :db_connection, optional: true]}, {:decimal, "~> 1.1.2 or ~> 1.2", [hex: :decimal, optional: false]}, {:mariaex, "~> 0.7.7", [hex: :mariaex, optional: true]}, {:poison, "~> 1.5 or ~> 2.0", [hex: :poison, optional: true]}, {:poolboy, "~> 1.5", [hex: :poolboy, optional: false]}, {:postgrex, "~> 0.12.0", [hex: :postgrex, optional: true]}, {:sbroker, "~> 1.0-beta", [hex: :sbroker, optional: true]}]},
"ex_doc": {:hex, :ex_doc, "0.8.4", "c74a30b09627ff22a2bb7f75d3b75dec3aedb2bd434bb3009a73a40425c2315d", [:mix], [{:earmark, "~> 0.1.17 or ~> 0.2", [hex: :earmark, optional: true]}]},
"meck": {:hex, :meck, "0.8.3", "4628a1334c69610c5bd558b04dc78d723d8ec5445c123856de34c77f462b5ee5", [:rebar], []},
"mime": {:hex, :mime, "1.0.1", "05c393850524767d13a53627df71beeebb016205eb43bfbd92d14d24ec7a1b51", [:mix], []},
"phoenix": {:hex, :phoenix, "1.2.1", "6dc592249ab73c67575769765b66ad164ad25d83defa3492dc6ae269bd2a68ab", [:mix], [{:cowboy, "~> 1.0", [hex: :cowboy, optional: true]}, {:phoenix_pubsub, "~> 1.0", [hex: :phoenix_pubsub, optional: false]}, {:plug, "~> 1.1", [hex: :plug, optional: false]}, {:poison, "~> 1.5 or ~> 2.0", [hex: :poison, optional: false]}]},
"phoenix_pubsub": {:hex, :phoenix_pubsub, "1.0.1", "c10ddf6237007c804bf2b8f3c4d5b99009b42eca3a0dfac04ea2d8001186056a", [:mix], []},
"plug": {:hex, :plug, "1.2.2", "cfbda521b54c92ab8ddffb173fbaabed8d8fc94bec07cd9bb58a84c1c501b0bd", [:mix], [{:cowboy, "~> 1.0", [hex: :cowboy, optional: true]}, {:mime, "~> 1.0", [hex: :mime, optional: false]}]},
"poison": {:hex, :poison, "2.2.0", "4763b69a8a77bd77d26f477d196428b741261a761257ff1cf92753a0d4d24a63", [:mix], []},
"poolboy": {:hex, :poolboy, "1.5.1", "6b46163901cfd0a1b43d692657ed9d7e599853b3b21b95ae5ae0a777cf9b6ca8", [:rebar], []}}
%{"decimal": {:hex, :decimal, "1.4.0", "fac965ce71a46aab53d3a6ce45662806bdd708a4a95a65cde8a12eb0124a1333", [:mix], []},
"earmark": {:hex, :earmark, "0.1.19", "ffec54f520a11b711532c23d8a52b75a74c09697062d10613fa2dbdf8a9db36e", [:mix], []},
"ecto": {:hex, :ecto, "2.1.6", "29b45f393c2ecd99f83e418ea9b0a2af6078ecb30f401481abac8a473c490f84", [:mix], [{:db_connection, "~> 1.1", [hex: :db_connection, optional: true]}, {:decimal, "~> 1.2", [hex: :decimal, optional: false]}, {:mariaex, "~> 0.8.0", [hex: :mariaex, optional: true]}, {:poison, "~> 2.2 or ~> 3.0", [hex: :poison, optional: true]}, {:poolboy, "~> 1.5", [hex: :poolboy, optional: false]}, {:postgrex, "~> 0.13.0", [hex: :postgrex, optional: true]}, {:sbroker, "~> 1.0", [hex: :sbroker, optional: true]}]},
"ex_doc": {:hex, :ex_doc, "0.8.4", "c74a30b09627ff22a2bb7f75d3b75dec3aedb2bd434bb3009a73a40425c2315d", [], [{:earmark, "~> 0.1.17 or ~> 0.2", [hex: :earmark, optional: true]}]},
"meck": {:hex, :meck, "0.8.7", "ebad16ca23f685b07aed3bc011efff65fbaf28881a8adf925428ef5472d390ee", [:rebar3], []},
"mime": {:hex, :mime, "1.1.0", "01c1d6f4083d8aa5c7b8c246ade95139620ef8effb009edde934e0ec3b28090a", [:mix], []},
"phoenix": {:hex, :phoenix, "1.3.0", "1c01124caa1b4a7af46f2050ff11b267baa3edb441b45dbf243e979cd4c5891b", [:mix], [{:cowboy, "~> 1.0", [hex: :cowboy, optional: true]}, {:phoenix_pubsub, "~> 1.0", [hex: :phoenix_pubsub, optional: false]}, {:plug, "~> 1.3.3 or ~> 1.4", [hex: :plug, optional: false]}, {:poison, "~> 2.2 or ~> 3.0", [hex: :poison, optional: false]}]},
"phoenix_pubsub": {:hex, :phoenix_pubsub, "1.0.2", "bfa7fd52788b5eaa09cb51ff9fcad1d9edfeb68251add458523f839392f034c1", [:mix], []},
"plug": {:hex, :plug, "1.4.3", "236d77ce7bf3e3a2668dc0d32a9b6f1f9b1f05361019946aae49874904be4aed", [:mix], [{:cowboy, "~> 1.0.1 or ~> 1.1", [hex: :cowboy, optional: true]}, {:mime, "~> 1.0", [hex: :mime, optional: false]}]},
"poison": {:hex, :poison, "2.2.0", "4763b69a8a77bd77d26f477d196428b741261a761257ff1cf92753a0d4d24a63", [], []},
"poolboy": {:hex, :poolboy, "1.5.1", "6b46163901cfd0a1b43d692657ed9d7e599853b3b21b95ae5ae0a777cf9b6ca8", [], []}}
4 changes: 2 additions & 2 deletions test/mix/tasks/swagger_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -152,11 +152,11 @@ defmodule Mix.Tasks.Swagger.Tests do
# get_router tests

test "get_router - nil args" do
assert Swagger.get_router(nil) == Swaggerdoc.Router
assert Swagger.get_router(nil) == SwaggerdocWeb.Router
end

test "get_router - empty args" do
assert Swagger.get_router([]) == Swaggerdoc.Router
assert Swagger.get_router([]) == SwaggerdocWeb.Router
end

#==============================
Expand Down