@graphile-contrib/pg-simplify-inflector
Advanced tools
Changelog
v6.1.0
@listSuffix
smart tagPreviously there was no easy way to override pgOmitListSuffix
on a per-entity
basis. With the @listSuffix
tag you can selectively control naming of both
collection types:
create table companies (id serial primary key);
comment on table companies is E'@listSuffix omit';
By default (pgOmitListSuffix = null
and simpleCollections = 'both'
) this
produces:
- allCompanies(
+ companiesConnection(
- allCompaniesList(
+ companies(
Changelog
v6.0.0
Previously we fed the entire table/etc name into pluralize
but this causes
issues for special cases, for example while pluralize('genus')
correctly gives
genera
, pluralize('old_genus')
would give old_genus
which is not correct.
Now we segment on underscores/capitals and only pluralize the final segment, so we're more likely to get the correct result.
This affects everywhere in your entire GraphQL schema where pluralize/singularize is used.
foreign key (organization_id, team_id, goal_uuid) references goals
Now named better:
- goalByOrganizationIdAndTeamIdAndGoalUuid: Goal
+ organizationTeamGoal: Goal
This was a bug (or, really, an omission) in v5.
For this table:
create table mascots (
id serial primary key,
company_id int unique not null references companies,
name text not null
);
Previously we had the plural relationship simplified:
- mascotsByCompanyId(
+ mascots(
But the singular was not. This update changes the singular too:
- mascotByCompanyId: Mascot
+ mascot: Mascot
Changelog
v5.0.0-beta.0
More advanced guesses at field names for reverse relations. Ability to omit list suffix, simplify patch names, turn on/off simplifying of the 'all' from 'allUsers', ability to change the 'ById' primary key fields to not have that suffix and instead have the node ID fetchers have a suffix.
Changelog
v2.0.0
Breaking change: single relation names based on a single key are now named after
the key rather than the target table so long as the key is of the form foo_id
,
foo_uuid
.
create table posts (
id serial primary key,
author_id int not null references users,
body text not null
);
type Post {
nodeId: ID!
id: Int!
authorId: Int!
- user: User
+ author: User
body: String!
}