Skip to content
This repository has been archived by the owner on Sep 2, 2022. It is now read-only.

Configure plural names of models #48

Closed
schickling opened this issue Dec 14, 2016 · 12 comments
Closed

Configure plural names of models #48

schickling opened this issue Dec 14, 2016 · 12 comments

Comments

@schickling
Copy link
Member

schickling commented Dec 14, 2016

In some cases it might be needed to provide a custom plural name of a model.

Here is how it could be configured in the datamodel:

type Person @plural(name: "People") {
  name: String!
}
@JustasPolis
Copy link

Hello, I'll add that it needs fixing, "Todo" becomes "Todoes" :).

@jvbianchi
Copy link

This is also important for localized model names

@alistairholt
Copy link

We're using GraphCMS which uses Prisma and this looks really bad in the interface. "WhatWeDoes", "HomepageIntroes" etc.

@rcy
Copy link

rcy commented Aug 19, 2018

I ran into this today with a model Person that generates the query persons, but I would prefer people.

Is there a third party inflection library being used?

@dgdosen
Copy link

dgdosen commented Dec 18, 2018

I ran into this today - model Todo that generates todoes :)

@alistairholt
Copy link

TBH I don't see why an external pluralisation library isn't being used. No doubt these problems have been solved countless times already. https://yarnpkg.com/en/package/pluralize, for example, with 17.8m downloads in the last 30 days:

pluralize('Todo') // Todos
pluralize('Person') // People
pluralize('WhatWeDo') // WhatWeDos
pluralize('HomepageIntro') // HomepageIntros

@stale
Copy link

stale bot commented Mar 6, 2019

This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 10 days if no further activity occurs. Thank you for your contributions.

@stale stale bot added the status/stale Marked as state by the GitHub stalebot label Mar 6, 2019
@pantharshit00 pantharshit00 added kind/feature and removed status/stale Marked as state by the GitHub stalebot labels Mar 6, 2019
@cassiopagnoncelli
Copy link

Same problem here.

Postgraphile is a nice reference on how to solve this issue.

@biels
Copy link

biels commented Mar 18, 2019

Has this been solved? If not, which library or mechanism is being used by prisma to pluralize?

@pbassut
Copy link

pbassut commented Jul 17, 2019

Any updates?

@cassiopagnoncelli
Copy link

cassiopagnoncelli commented Jul 20, 2019

They know the issue and acknowledge most of the code in the wild is untested. Amending this issue would render a breaking change.

What I would recommend is having your own set of model names overwriting the ones Prisma creates.

@vidz1979
Copy link

Hey people, any updates on this?

@janpio janpio closed this as completed Sep 1, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests