-
-
Notifications
You must be signed in to change notification settings - Fork 7.6k
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
Tracking Issue - Some words are not handled well for Model names (Pluralization, ect) and reserved words #1198
Comments
Great question... It's complicated because we're going to follow the OpenCRUD specs and this case doesn't seem to be handled. I'm going to ask how we should deal with this case. |
I know, i already have the problem with Prisma (who manages the OpenCRUD docs) about this problem: prisma/prisma1#1772 |
@johannpinson Thank you for sharing the issue on Prisma. I think the OpenCRUD specs could evolve for fixing that kind of issues. I'm not sure that excluding words is the right way to solve it. How many words are concerned by it? |
@Aurelsicoko And in the OpenCRUD doc, it talks about using the java library Moreover, it looks like Strapi use the |
I understand but blocking words is not an optimal solution because as a workaround we can add the prefix |
Have the same problem. I get the following stack trace:
|
@MartinMuzatko Try to find another word for this model until we find a viable solution. |
Sure - already did. I just hate to abuse the english language @Aurelsicoko |
Any update on this seems News keyword cant still be used as content type name? |
@kret13 No update for now... You should find another name for the content type as a workaround ;) |
@kret13 - may I suggest that "news" isn't really a great name in general for a content type. "News Article" or "News Post" or "News Release" are more description and more user friendly. Consider that you may syndicate your news. You may have different content types for a News Snippet versus a News Article versus a News release. I do understand also just using "news" as this will have a specific meaning to you and your team. |
yah the sort of resulting solution to this is issue is wrecking havoc with the Graphql plugin and crashes Strapi. See issue #3695. |
what about pants or scissors? I think the idea here is that it should just handle anything thrown at it fine. I think the actual best solution here is a hybrid 'all' prefix, maybe it could be done only for words that result to a tantum, whether singularia or pluralaria. eg: team => teams, fish => allFish, news => allNews or just do the Golum way, sheep => sheepsies 🤣 |
It would be sufficient for me to be notified on content type creation, that this can't be pluralized properly ;) |
exactly! Then once told, if you choose to continue you are notified that its plural form will be "allNAME", sometimes you don't want to change or can't change it to anything else remember that. pants is a good example |
oh another thing is you can't define "newsArticle" as a content type, you can only do "newsarticle" as you can't specify caps in the name field, nor can you do "news_article". I don't know why exactly this is the case, but this deters your efforts and is super weird considering we need to specify such content types as "newsArticle". |
content type "news" dropped strapi)) Error: Field "Query.news" can only be defined once. |
same same solved by change to another name such as "post" |
Try with "series" had a 400 |
Just ran in the exactly same problem by trying to create a "News" collection. Did a bit research and ended up here. I think a more meaningful error message would definitely help. There are probably lots of people that ran into the same issue and ditched Strapi afterwards. |
Edited by @derrickmehaffy on 2021/03/29
This issue has been converted to a global tracking issue regarding certain english or other language words that fail to work when building models. There are various examples, and for the moment the workarounds mean excluding these words from use and doing things like:
news
=>newsItem
ectInformations
What is the current behavior?
When I create a new content type with a name which have the same plural version, the API generate will loop into a 500
Steps to reproduce the problem
What is the expected behavior?
The problem is that some english words have a specific plural behavior (like child/children) or have the same orthograph
As example : https://github.com/atteo/evo-inflector/blob/master/src/main/java/org/atteo/evo/inflector/English.java#L131
Suggested solutions
Best solution:
Disallow to use "words" which can have an different plural/single mode (ex: fish, news, etc.)
Another solution is to add a flag "all" in front, a.k.a "allFish" (but it add a 2nd behavior so i don't think it's the best solution
The text was updated successfully, but these errors were encountered: