Pluralization Is Not `name + s`: A Code Generator Maintenance Rule
One of the smallest code generator shortcuts creates one of the most persistent API defects:
plural = name + "s"
It works for order, which makes it look harmless. Then it produces order_statuss, categorys,
persons, childs, and inventorys.
During TeaQL's six-language acceptance work, we found this assumption in Python and Go query
templates and in a Rust diagnostic. The generated code compiled often enough for the mistake to
survive until an entity ending in status exposed it.
The rule belongs above the templates
TeaQL now treats plural names as generator metadata. Templates consume a centralized plural name
and only transform its casing for the target language. They may not append s or es themselves.
That rule covers more than query entry points. It also applies to relation collections, sample-data methods, documentation examples, AI-assist prompts and diagnostics. Otherwise the generated API and the instructions used to call it eventually disagree.
An inflection library is a component, not the contract
A library can handle common suffix rules but still choose a technically defensible word that is
wrong for the public API. In our tests, the inflector returned persons; the TeaQL collection
contract requires people.
The centralized policy therefore includes conventional irregular mappings and compound suffix replacement:
| Singular | Required plural |
|---|---|
order_status | order_statuses |
category | categories |
person | people |
sales_person | sales_people |
child | children |
inventory | inventory |
Regeneration is the compatibility strategy
We did not retain wrong names as aliases. Generated APIs are cheap to regenerate, while every compatibility alias becomes a permanent maintenance and documentation cost.
The regression suite now generates regular, suffix-changing, irregular, compound and uncountable fixtures. It checks the current Java, Rust, Go, Python, .NET and TypeScript output instead of testing the pluralizer in isolation.
The lesson is broader than English grammar: templates should render reviewed naming decisions, not make linguistic decisions independently.
