Skip to content

Commit

Permalink
Handle timestamp types
Browse files Browse the repository at this point in the history
  • Loading branch information
madshargreave committed Dec 19, 2018
1 parent a72dd26 commit 607c4d5
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,4 @@ erl_crash.dump
# Ignore package tarball (built via "mix hex.build").
swagger_ecto-*.tar

.elixir_ls
8 changes: 6 additions & 2 deletions lib/swagger_ecto/helpers.ex
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,9 @@ defmodule SwaggerEcto.Helpers do
end)
end

defp property(schema, {:field, _, [field, type, _opts]}) do
defp property(schema, {:field, _, [field, raw_type, _opts]}) do
%{
field => PhoenixSwagger.Schema.type(%PhoenixSwagger.Schema{}, type)
field => PhoenixSwagger.Schema.type(%PhoenixSwagger.Schema{}, type(raw_type))
}
end

Expand All @@ -70,6 +70,10 @@ defmodule SwaggerEcto.Helpers do
}
end

defp type(:naive_datetime), do: :string
defp type(:date), do: :string
defp type(type), do: type

defp required(exprs) do
exprs
|> Enum.flat_map(fn expr ->
Expand Down
2 changes: 1 addition & 1 deletion mix.exs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ defmodule SwaggerEcto.MixProject do
def project do
[
app: :swagger_ecto,
version: "0.2.1",
version: "0.2.2",
elixir: "~> 1.7",
start_permanent: Mix.env() == :prod,
deps: deps(),
Expand Down

0 comments on commit 607c4d5

Please sign in to comment.