Skip to content

Commit 10878f6

Browse files
committed
fix: ensure action inputs are sorted
1 parent 9a48f9d commit 10878f6

1 file changed

Lines changed: 11 additions & 7 deletions

File tree

lib/ash_json_api/json_schema/open_api.ex

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1686,15 +1686,19 @@ if Code.ensure_loaded?(OpenApiSpex) do
16861686

16871687
{query_params, _unused_schema} =
16881688
if route.method == :get do
1689-
Enum.flat_map(Ash.Resource.Info.action_inputs(resource, route.action), fn input ->
1690-
with true <- is_atom(input),
1691-
arg when not is_nil(arg) <-
1692-
Enum.find(action.arguments, &(&1.name == input)) ||
1693-
Ash.Resource.Info.attribute(resource, input) do
1689+
resource
1690+
|> Ash.Resource.Info.action_inputs(route.action)
1691+
|> Enum.filter(&is_atom/1)
1692+
|> Enum.sort()
1693+
|> Enum.flat_map(fn input ->
1694+
arg =
1695+
Enum.find(action.arguments, &(&1.name == input)) ||
1696+
Ash.Resource.Info.attribute(resource, input)
1697+
1698+
if arg do
16941699
[arg]
16951700
else
1696-
_ ->
1697-
[]
1701+
[]
16981702
end
16991703
end)
17001704
else

0 commit comments

Comments
 (0)