Add query parameter support for read actions#15
Merged
mikehostetler merged 4 commits intomainfrom Apr 1, 2026
Merged
Conversation
Add query parameter support to generated Jido read actions: - JidoAction struct: query_params? (default: true), max_page_size fields - AllActions struct: read_query_params? (default: true), read_max_page_size - DSL: new options for action and all_actions entities - Transformer: propagates new fields for read actions - Generator: appends filter/sort/limit/offset/load params to read schemas via new build_query_params_schema/1 helper - Tests: 7 new tests covering schema generation and opt-out behavior - Updated existing tests to reflect new default query param presence
Update the :read case in the generated action's execute_action/4 to: - Split query params (filter/sort/limit/offset/load) from action args before passing to Ash.Query.for_read - Apply query opts via individual Ash.Query functions using Enum.reduce - Use filter_input/sort_input (safe variants) for security - Enforce max_page_size by clamping limit values Helper functions added inside the quoted block: - split_query_params/2: separates query params from action params - enforce_max_page_size/2: caps limit to configured max - apply_query_opts/2: applies each query option to the Ash query Also makes test User attributes public (required for filter_input). 13 new runtime integration tests covering: - Filter: equality, greater_than, in, multiple conditions (AND) - Sort: ascending, descending - Pagination: limit, offset, combined - Combined: filter + sort + limit - max_page_size enforcement (clamp + within bounds) - Backward compat: empty params
Add Query Parameters section to README.md with: - Available parameters overview (filter, sort, limit, offset, load) - Usage example - Security note (filter_input/sort_input safe variants) - Configuration examples (query_params?, max_page_size) - Updated action options and all_actions options tables - Removed 'pagination or query-layer magic' from 'What It Does Not Do' Add Querying and Filtering section to guides/getting-started.md with: - Filter syntax (equality, operators, multiple conditions, IN) - Sort syntax (keyword list and string formats) - Pagination (limit + offset) - Dynamic relationship loading - Combined example - Configuration reference
This was referenced Apr 1, 2026
Contributor
|
Hooray! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Validation
Supersedes #5, #7, and #11 for issue #4.