Page MenuHomePhorge

No OneTemporary

Size
1 KB
Referenced Files
None
Subscribers
None
diff --git a/lib/open_api_spex/test/assertions.ex b/lib/open_api_spex/test/assertions.ex
index b2a4444..c59d59c 100644
--- a/lib/open_api_spex/test/assertions.ex
+++ b/lib/open_api_spex/test/assertions.ex
@@ -1,25 +1,26 @@
defmodule OpenApiSpex.Test.Assertions do
@moduledoc """
Defines helpers for testing API responses and examples against API spec schemas.
"""
alias OpenApiSpex.OpenApi
import ExUnit.Assertions
@dialyzer {:no_match, assert_schema: 3}
@doc """
Asserts that `value` conforms to the schema with title `schema_title` in `api_spec`.
"""
- @spec assert_schema(map, String.t, OpenApi.t) :: :ok | no_return
+ @spec assert_schema(map, String.t, OpenApi.t) :: map | no_return
def assert_schema(value = %{}, schema_title, api_spec = %OpenApi{}) do
schemas = api_spec.components.schemas
schema = schemas[schema_title]
if !schema do
flunk("Schema: #{schema_title} not found in #{inspect(Map.keys(schemas))}")
end
_ = assert {:ok, data} = OpenApiSpex.cast(api_spec, schema, value)
_ = assert :ok = OpenApiSpex.validate(api_spec, schema, data)
- :ok
+
+ data
end
end
\ No newline at end of file

File Metadata

Mime Type
text/x-diff
Expires
Sat, Nov 23, 10:08 AM (21 h, 48 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
38941
Default Alt Text
(1 KB)

Event Timeline