-
-
Notifications
You must be signed in to change notification settings - Fork 61
Open
Labels
Description
Describe the bug
When generating filter schemas using AshJsonApi.OpenApi.raw_filter_type/2
, filtering on embedded resources currently requires all attributes of the embedded struct to match. This means it’s not possible to query based on partial conditions (i.e., using at_path
) for specific fields within the embedded resource.
%{
"description" => "Filter results",
"properties" => %{
"bio" => %{
"additionalProperties" => false,
"properties" => %{
"eq" => %{
"additionalProperties" => false,
"properties" => %{
"birth" => %{
"anyOf" => [
%{
"description" => "Field included by default.",
"format" => "date",
"nullable" => true,
"type" => "string"
},
%{"type" => "null"}
]
},
"nationality" => %{
"anyOf" => [
%{
"description" => "Field included by default.",
"nullable" => true,
"type" => "string"
},
%{"type" => "null"}
]
}
},
"type" => "object"
}
}
}
}
}
To Reproduce
Run AshJsonApi.OpenApi.raw_filter_type/2
with any resource that has embedded resource.
Expected behavior
To allow multiple at_path
filters on an embedded resource, it seems necessary to pass a list of filters to Ash.Query.filter_input/2
. Therefore, the filter type should be wrapped in an array in the generated JSON schema to properly support this use case.
Runtime
- Elixir version: 1.18
- Erlang version: 27
- OS: mac
- Ash version: 3.5.1
- any related extension versions: AshJsonAPI 1.4.22
Additional context