Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handle singular and plural word collision in content type naming for GraphQL schema exports #6093

Closed
1 of 2 tasks
jwerle opened this issue May 6, 2020 · 6 comments
Closed
1 of 2 tasks
Labels
status: duplicate Is a duplicate of another issue

Comments

@jwerle
Copy link

jwerle commented May 6, 2020

  • I have created an RFC on the Strapi RFC Repo
  • I have checked for existing RFCs before creating this discussion topic

Describe the topic
Handle "uncountable" words in content type naming so singular and plural forms do not collide.

Your suggestions for this topic
Check for the collision of a singular word and a plural word and append an s (or something) to the plural form of the word.

An example would be the word audio becoming audios where naturally both the singular and plural form of the word audio is audio

Additional context
related: #3471 (comment)

@jwerle
Copy link
Author

jwerle commented May 6, 2020

Maybe something like:

if (singularName === pluralName) {
  pluralName += 's'
}

here: https://github.com/strapi/strapi/blob/master/packages/strapi-plugin-graphql/services/type-definitions.js#L337

@jwerle
Copy link
Author

jwerle commented May 6, 2020

perhaps it could be possible in the model settings to override the singular and plural forms of a model too

@jwerle
Copy link
Author

jwerle commented May 6, 2020

A work around, if anyone lands on this issue, is to name an uncountable/irregular word in a forced plural form like audios which creates the odd Audios type

@lauriejim
Copy link
Contributor

Hello! Can you please check this issue.
#1198

@lauriejim lauriejim added the status: duplicate Is a duplicate of another issue label May 13, 2020
@lauriejim
Copy link
Contributor

And thank you for this workaround

@jwerle
Copy link
Author

jwerle commented May 13, 2020

@lauriejim thanks for the response! Hopefully something like plurals/pluralize#150 gets merged in so downstream could modify the state of that module to help here (like remove an uncountable word for edge cases like audio or series)

btw.. Looking forward to strapi@3 !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: duplicate Is a duplicate of another issue
Projects
None yet
Development

No branches or pull requests

2 participants