diff --git a/mix.exs b/mix.exs index 26eb63b..9bc9699 100644 --- a/mix.exs +++ b/mix.exs @@ -55,7 +55,7 @@ defmodule PhoenixSwagger.Mixfile do defp deps do [ {:poison, "~> 2.2 or ~> 3.0"}, - {:ex_json_schema, "~> 0.5", optional: true}, + {:ex_json_schema, "~> 0.5.0", optional: true}, {:plug, "~> 1.4"}, {:ex_doc, "~> 0.18", only: :dev, runtime: false}, {:dialyxir, "~> 0.5", only: :dev, runtime: false} diff --git a/mix.lock b/mix.lock index 589fd6a..ac303db 100644 --- a/mix.lock +++ b/mix.lock @@ -2,7 +2,7 @@ "dialyxir": {:hex, :dialyxir, "0.5.1", "b331b091720fd93e878137add264bac4f644e1ddae07a70bf7062c7862c4b952", [:mix], [], "hexpm"}, "earmark": {:hex, :earmark, "1.1.1", "433136b7f2e99cde88b745b3a0cfc3fbc81fe58b918a09b40fce7f00db4d8187", [:mix], [], "hexpm"}, "ex_doc": {:hex, :ex_doc, "0.18.3", "f4b0e4a2ec6f333dccf761838a4b253d75e11f714b85ae271c9ae361367897b7", [:mix], [{:earmark, "~> 1.1", [hex: :earmark, repo: "hexpm", optional: false]}], "hexpm"}, - "ex_json_schema": {:hex, :ex_json_schema, "0.6.1", "b57c0588385b8262b80f19d33d9b9b71fcd60d247691abf2635b57a03ec0ad44", [:mix], [], "hexpm"}, + "ex_json_schema": {:hex, :ex_json_schema, "0.5.8", "9758444f560ebf5e1c5cb37d41a122707939f75136c7a79c4ff4ca6ad5283fb9", [:mix], [], "hexpm"}, "mime": {:hex, :mime, "1.2.0", "78adaa84832b3680de06f88f0997e3ead3b451a440d183d688085be2d709b534", [:mix], [], "hexpm"}, "plug": {:hex, :plug, "1.5.0", "224b25b4039bedc1eac149fb52ed456770b9678bbf0349cdd810460e1e09195b", [:mix], [{:cowboy, "~> 1.0.1 or ~> 1.1 or ~> 2.1", [hex: :cowboy, repo: "hexpm", optional: true]}, {:mime, "~> 1.0", [hex: :mime, repo: "hexpm", optional: false]}], "hexpm"}, "poison": {:hex, :poison, "3.1.0", "d9eb636610e096f86f25d9a46f35a9facac35609a7591b3be3326e99a0484665", [:mix], [], "hexpm"}, diff --git a/test/validator_test.exs b/test/validator_test.exs index 4849e05..d30610d 100644 --- a/test/validator_test.exs +++ b/test/validator_test.exs @@ -61,13 +61,22 @@ defmodule ValidatorTest do assert {:error, :resource_not_exists} = Validator.validate("/get/pets/id", %{"id" => "1"}) assert :ok = Validator.validate("/get/pets/{id}", %{"id" => 1}) assert {:error, :resource_not_exists} = Validator.validate("/pets", %{"id" => 1}) - assert {:error, "Required properties id, pet were not present.", "#"} = Validator.validate("/post/pets", %{}) + assert {:error, + [ + {"Required property id was not present.", "#"}, + {"Required property pet was not present.", "#"} + ], "/post/pets"} + = Validator.validate("/post/pets", %{}) assert {:error, [{"Type mismatch. Expected Integer but got String.", "#/id"}, {"Required property pet was not present.", "#"}], "/post/pets"} = Validator.validate("/post/pets", %{"id" => "wrong_id"}) assert {:error, "Required property pet was not present.", "#"} = Validator.validate("/post/pets", %{"id" => 1}) - assert {:error, "Required properties name, tag were not present.", "#/pet"} - = Validator.validate("/post/pets", %{"id" => 1, "pet" => %{}}) + assert {:error, + [ + {"Required property name was not present.", "#/pet"}, + {"Required property tag was not present.", "#/pet"} + ], "/post/pets"} + = Validator.validate("/post/pets", %{"id" => 1, "pet" => %{}}) assert {:error, "Required property tag was not present.", "#/pet"} = Validator.validate("/post/pets", %{"id" => 1, "pet" => %{"name" => "pet_name"}}) assert :ok = Validator.validate("/post/pets", %{"id" => 1, "pet" => %{"name" => "pet_name", "tag" => "pet_tag"}})