Skip to content

Limit OpenAPI filter operators based on attribute/argument type #309

@nallwhy

Description

@nallwhy

Is your feature request related to a problem? Please describe.

In AshJsonApi.OpenApi.raw_filter_type/2, all of Ash.Filter.builtin_operators/0 are included when generating filter schemas, regardless of the attribute or argument type. This results in many irrelevant or inapplicable filters being included in the schema.

e.g. Filtering operators like contains, length, or ilike appear even for types where they don’t make sense (e.g., integer), which can be confusing or misleading in the generated API documentation.

Describe the solution you'd like

It would be great if the available filters could be limited based on the type of each attribute or argument. That way, only relevant operators would be included in the filter schema.

Describe alternatives you've considered

no

Express the feature either with a change to resource syntax, or with a change to the resource interface

I have no idea.

Additional context

For now, I’m proposing this change here, but it might actually require modifications in the ash library itself, depending on the desired approach.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions