Skip to content

Commit 1519adf

Browse files
authored
fix: type warnings Elixir 1.19 (#693)
Thanks @davydog187 !
1 parent 32a7af0 commit 1519adf

3 files changed

Lines changed: 6 additions & 6 deletions

File tree

lib/open_api_spex/cast/all_of.ex

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ defmodule OpenApiSpex.Cast.AllOf do
66

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

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

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

2424
{:error, errors} ->
2525
Cast.error(
26-
%Cast{ctx | errors: ctx.errors ++ errors},
26+
%{ctx | errors: ctx.errors ++ errors},
2727
{:all_of, to_string(relaxed_schema.title || relaxed_schema.type)}
2828
)
2929
end

lib/open_api_spex/cast/any_of.ex

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ defmodule OpenApiSpex.Cast.AnyOf do
1212
end
1313

1414
defp cast_any_of(
15-
%{schema: %{anyOf: [%Schema{} = schema | remaining]}} = ctx,
15+
%Cast{schema: %{anyOf: [%Schema{} = schema | remaining]}} = ctx,
1616
failed_schemas,
1717
acc
1818
) do
@@ -32,7 +32,7 @@ defmodule OpenApiSpex.Cast.AnyOf do
3232

3333
{:error, errors} ->
3434
cast_any_of(
35-
%Cast{new_ctx | errors: new_ctx.errors ++ errors},
35+
%{new_ctx | errors: new_ctx.errors ++ errors},
3636
[schema | failed_schemas],
3737
acc
3838
)

lib/open_api_spex/cast/one_of.ex

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ defmodule OpenApiSpex.Cast.OneOf do
88
error(ctx, [], [])
99
end
1010

11-
def cast(%{schema: %{type: _, oneOf: schemas}} = ctx) do
11+
def cast(%Cast{schema: %{type: _, oneOf: schemas}} = ctx) do
1212
castable_schemas =
1313
Enum.reduce(schemas, {ctx, [], []}, fn schema, {ctx, results, error_schemas} ->
1414
schema = OpenApiSpex.resolve_schema(schema, ctx.schemas)
@@ -19,7 +19,7 @@ defmodule OpenApiSpex.Cast.OneOf do
1919
{ctx, [{:ok, value, schema} | results], error_schemas}
2020
else
2121
{:error, errors} ->
22-
{%Cast{ctx | errors: ctx.errors ++ errors}, results, [schema | error_schemas]}
22+
{%{ctx | errors: ctx.errors ++ errors}, results, [schema | error_schemas]}
2323
end
2424
end)
2525

0 commit comments

Comments
 (0)