Get singular and plural model names from jsonSchema#61
Open
aurium wants to merge 1 commit intoVincit:masterfrom
Open
Get singular and plural model names from jsonSchema#61aurium wants to merge 1 commit intoVincit:masterfrom
aurium wants to merge 1 commit intoVincit:masterfrom
Conversation
This is similar to `listFieldName` and `fieldName` from `graphQLBuilder().model()`'s extra parameter. It can simple replace `listFieldName` and `fieldName` if you can add `collectiveName` and `singleName` to your models's jsonSchema. The benefit is: * Center the model description; * Produce the correct single type name in the result graphQL schema; * Share the model identification with oder modules in the app.
|
I ran into a problem when the name of the table is "users" and I have to write userss (double s) i think this is a useful PR. |
|
Any thought on when this will be merged? I've run in to this issue now as well. |
|
Please merge 🙏 |
|
@sbabushkin could you check this PR please? :) |
jcarty
reviewed
Jan 7, 2020
| const listFieldName = modelData.opt.listFieldName || (`${defaultFieldName}s`); | ||
| const schema = modelData.modelClass.jsonSchema; | ||
| const singleFieldName = schema.singleName || modelData.opt.fieldName || defaultFieldName; | ||
| const listFieldName = schema.collectiveName || modelData.opt.listFieldName || (`${defaultFieldName}s`); |
There was a problem hiding this comment.
Suggested change
| const listFieldName = schema.collectiveName || modelData.opt.listFieldName || (`${defaultFieldName}s`); | |
| const listFieldName = schema.collectiveName || modelData.opt.listFieldName || (`${singleFieldName}s`); |
|
Bump! I've encountered this in my project as well. Would be great to get this merged in :) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This is similar to
listFieldNameandfieldNamefromgraphQLBuilder().model()'s extra parameter.It can simple replace
listFieldNameandfieldNameif you can addcollectiveNameandsingleNameto your models's jsonSchema.The benefit is: