diff --git a/lib/oasis/parser.ex b/lib/oasis/parser.ex index 2ecd7a1..58abfe7 100644 --- a/lib/oasis/parser.ex +++ b/lib/oasis/parser.ex @@ -8,12 +8,10 @@ defmodule Oasis.Parser do def parse(%{"type" => "null"}, nil), do: nil def parse(%{"type" => "array"} = type, value) when is_list(value) do - # post request body as :urlencoded or :multipart do_parse_array(type, value) end def parse(%{"type" => "object"} = type, value) when is_map(value) do - # post request body as :urlencoded or :multipart do_parse_object(type, value) end diff --git a/test/integration_test.exs b/test/integration_test.exs index 97bcf25..1da96a8 100644 --- a/test/integration_test.exs +++ b/test/integration_test.exs @@ -498,6 +498,12 @@ defmodule Oasis.IntegrationTest do start_supervised!({Finch, name: TestFinch}) headers = [{"content-type", "application/json"}] + body = "[{\"id2\":1,\"name2\":\"hello\"}]" + + assert {:ok, response} = Finch.build(:post, "#{url}/test_post_json", headers, body) |> Finch.request(TestFinch) + assert response.status == 400 and + response.body == "Find body parameter `body_request` with error: Required properties id, name were not present." + body = "[{\"id\":1,\"name\":\"hello\"}]" assert {:ok, response} = Finch.build(:post, "#{url}/test_post_json", headers, body) |> Finch.request(TestFinch) diff --git a/test/support/gen/plug/pre_test_post_json.ex b/test/support/gen/plug/pre_test_post_json.ex index 312af25..08470c9 100644 --- a/test/support/gen/plug/pre_test_post_json.ex +++ b/test/support/gen/plug/pre_test_post_json.ex @@ -22,7 +22,8 @@ defmodule Oasis.Gen.Plug.PreTestPostJSON do "properties" => %{ "id" => %{"type" => "integer"}, "name" => %{"type" => "string"} - } + }, + "required" => ["id", "name"], }, "type" => "array" }