Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions lib/open_api_spex/cast/all_of.ex
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ defmodule OpenApiSpex.Cast.AllOf do

def cast(ctx), do: cast_all_of(ctx, nil)

defp cast_all_of(%{schema: %{allOf: [%Schema{} = schema | remaining]}} = ctx, acc) do
defp cast_all_of(%Cast{schema: %{allOf: [%Schema{} = schema | remaining]}} = ctx, acc) do
relaxed_schema = %{schema | "x-struct": nil}
new_ctx = put_in(ctx.schema.allOf, remaining)

Expand All @@ -23,7 +23,7 @@ defmodule OpenApiSpex.Cast.AllOf do

{:error, errors} ->
Cast.error(
%Cast{ctx | errors: ctx.errors ++ errors},
%{ctx | errors: ctx.errors ++ errors},
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For posterity, the warning is:

    typing violation found at:
    │
 26 │           %Cast{ctx | errors: ctx.errors ++ errors},
    │           ~
    │
    └─ lib/open_api_spex/cast/all_of.ex:26:11: OpenApiSpex.Cast.AllOf.cast_all_of/2

{:all_of, to_string(relaxed_schema.title || relaxed_schema.type)}
)
end
Expand Down
4 changes: 2 additions & 2 deletions lib/open_api_spex/cast/any_of.ex
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ defmodule OpenApiSpex.Cast.AnyOf do
end

defp cast_any_of(
%{schema: %{anyOf: [%Schema{} = schema | remaining]}} = ctx,
%Cast{schema: %{anyOf: [%Schema{} = schema | remaining]}} = ctx,
failed_schemas,
acc
) do
Expand All @@ -32,7 +32,7 @@ defmodule OpenApiSpex.Cast.AnyOf do

{:error, errors} ->
cast_any_of(
%Cast{new_ctx | errors: new_ctx.errors ++ errors},
%{new_ctx | errors: new_ctx.errors ++ errors},
[schema | failed_schemas],
acc
)
Expand Down
4 changes: 2 additions & 2 deletions lib/open_api_spex/cast/one_of.ex
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ defmodule OpenApiSpex.Cast.OneOf do
error(ctx, [], [])
end

def cast(%{schema: %{type: _, oneOf: schemas}} = ctx) do
def cast(%Cast{schema: %{type: _, oneOf: schemas}} = ctx) do
castable_schemas =
Enum.reduce(schemas, {ctx, [], []}, fn schema, {ctx, results, error_schemas} ->
schema = OpenApiSpex.resolve_schema(schema, ctx.schemas)
Expand All @@ -19,7 +19,7 @@ defmodule OpenApiSpex.Cast.OneOf do
{ctx, [{:ok, value, schema} | results], error_schemas}
else
{:error, errors} ->
{%Cast{ctx | errors: ctx.errors ++ errors}, results, [schema | error_schemas]}
{%{ctx | errors: ctx.errors ++ errors}, results, [schema | error_schemas]}
end
end)

Expand Down
Loading