Skip to content

Commit

Permalink
ex_json_schema dependency update
Browse files Browse the repository at this point in the history
  • Loading branch information
adropofilm committed Jun 6, 2019
1 parent 15a08ff commit f4e1cb6
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 5 deletions.
2 changes: 1 addition & 1 deletion mix.exs
Original file line number Diff line number Diff line change
Expand Up @@ -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}
Expand Down
2 changes: 1 addition & 1 deletion mix.lock
Original file line number Diff line number Diff line change
Expand Up @@ -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"},
Expand Down
15 changes: 12 additions & 3 deletions test/validator_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -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"}})
Expand Down

0 comments on commit f4e1cb6

Please sign in to comment.