Skip to content

refactor(macros): use singular entity names for SortBy and Filters types#115

Merged
nicolasburtey merged 1 commit intomainfrom
refactor/singular-sort-filter-naming
Mar 26, 2026
Merged

refactor(macros): use singular entity names for SortBy and Filters types#115
nicolasburtey merged 1 commit intomainfrom
refactor/singular-sort-filter-naming

Conversation

@nicolasburtey
Copy link
Copy Markdown
Member

Summary

  • Stops pluralizing entity names when generating SortBy enums and Filters structs in the EsRepo derive macro
  • Customer now generates CustomerSortBy + CustomerFilters instead of CustomersSortBy + CustomersFilters
  • Aligns with GraphQL industry conventions (GitHub uses IssueOrder, Shopify uses ProductSortKeys, Apollo recommends singular)
  • Cursor types (CustomersCursor) remain plural as they represent collections

Changes

  • combo_cursor.rs: Remove pluralizer::pluralize in sort_by_name()
  • list_for_filters_fn.rs: Remove pluralizer::pluralize in FiltersStruct::ident()
  • Updated all tests and documentation

Breaking Change

This is a breaking change for downstream consumers — all references to *sSortBy and *sFilters types will need updating to singular form.

🤖 Generated with Claude Code

Stop pluralizing entity names when generating SortBy enums and Filters
structs. This aligns with GraphQL industry conventions (GitHub, Shopify,
Apollo) where type names use singular nouns.

Before: Customer -> CustomersSortBy, CustomersFilters
After:  Customer -> CustomerSortBy, CustomerFilters

Cursor types (e.g., CustomersCursor) remain plural as they represent
collections.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@nicolasburtey nicolasburtey force-pushed the refactor/singular-sort-filter-naming branch from d88be3a to 2cd43e9 Compare March 26, 2026 18:18
nicolasburtey added a commit to GaloyMoney/job that referenced this pull request Mar 26, 2026
Picks up singular naming for SortBy/Filters types generated by the
EsRepo derive macro (GaloyMoney/es-entity#115). No code changes needed
in job since it doesn't use these types.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@nicolasburtey nicolasburtey marked this pull request as ready for review March 26, 2026 18:36
@nicolasburtey nicolasburtey merged commit 5dcdc63 into main Mar 26, 2026
6 checks passed
nicolasburtey added a commit to GaloyMoney/job that referenced this pull request Mar 26, 2026
* chore(deps): bump es-entity to 0.10.32

Picks up singular naming for SortBy/Filters types generated by the
EsRepo derive macro (GaloyMoney/es-entity#115). No code changes needed
in job since it doesn't use these types.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* chore(deps): update Cargo.lock for es-entity 0.10.32

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant