validate operators for join and custom fields
woylie opened this issue · comments
The field type of normal schema fields can be determined with the Ecto schema reflection functions. For join and custom fields, this is not possible, which is why currently, all operators are accepted for those fields.
@derive {
Flop.Schema,
join_fields: [pet_species: [binding: :pets, field: :species, ecto_type: :string]],
custom_fields: [
inserted_at_date: [filter: {CustomFilters, :date_filter, [source: :inserted_at]}, ecto_type: :date]
]
}
- add
ecto_type
option to join fields - add
ecto_type
option to custom fields - determine Flop field type in
Flop.Filter.allowed_operators/2
and retrieve Ecto field type from option, if applicable