File tree Expand file tree Collapse file tree 2 files changed +18
-1
lines changed
lib/ash_json_api/json_schema Expand file tree Collapse file tree 2 files changed +18
-1
lines changed Original file line number Diff line number Diff line change @@ -675,7 +675,7 @@ defmodule AshJsonApi.JsonSchema do
675675 }
676676 }
677677
678- if route . type in [ :get , :related ] do
678+ if route . type in [ :get , :related ] or ( route . type == :route and route . method == :get ) do
679679 props
680680 |> add_route_properties ( resource , properties )
681681 |> add_read_arguments ( route , resource )
Original file line number Diff line number Diff line change @@ -141,4 +141,21 @@ defmodule Test.Acceptance.GenericActionIndexTest do
141141 assert String . contains? ( source_pointer , "query" ) ,
142142 "Expected source pointer '#{ source_pointer } ' to contain field name 'query'"
143143 end
144+
145+ test "generic GET actions include arguments as query parameters in JSON schema" do
146+ schema = AshJsonApi.JsonSchema . generate ( [ Domain ] )
147+
148+ assert % {
149+ "method" => "GET" ,
150+ "rel" => "route" ,
151+ "hrefSchema" => % {
152+ "properties" => properties ,
153+ "required" => required
154+ }
155+ } = Enum . find ( schema [ "links" ] , & ( & 1 [ "method" ] == "GET" and & 1 [ "rel" ] == "route" ) )
156+
157+ assert Map . has_key? ( properties , "query" )
158+ assert Map . has_key? ( properties , "category" )
159+ assert "query" in required
160+ end
144161end
You can’t perform that action at this time.
0 commit comments