-
-
Notifications
You must be signed in to change notification settings - Fork 129
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
feat(inflection): Pluggable inflector, smart-comment overridable #199
Conversation
This file contains 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
This was referenced Mar 23, 2018
22 tasks
22 tasks
Whoops sorry @omit I'll watch out for it in the future! |
Previously this query would return lots of `null` because no columns were explicitly requested ```graphql { allPostEmojis(first: 5) { nodes { nodeId } } } ```
-- rebased on latest master -- |
One checkbox left unchecked; we can add support for that later. |
This was referenced Apr 13, 2018
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 replaces the old inflector interface with one that's pluggable. It also changes the inflector interface so that it's sent objects rather than strings; these objects contain more information so a) fewer params are required to be passed to inflectors, b) inflectors can use more information to make decisions - e.g. they can use smart comments!
comment on table post is E'@name message';
comment on column my_schema.my_table.my_column is E'@name alternativeColumnName';
comment on constraint thread_author_id_fkey on thread is E'@foreignFieldName threads\n@fieldName author';
comment on constraint person_pkey on person is E'@fieldName findPersonById';
comment on function person_full_name(person) is E'@fieldName name';
comment on function search_posts(text) is E'@name returnPostsMatching';
comment on function authenticate(text, text) is E'@name login';
comment on function authenticate(text, text) is E'@name login\n@resultFieldName token';
comment on type flibble is E'@name flamble';
E.g. the following SQL makes the changes shown in the
I should do this in a separate PR really, but oh well 🤷♂️
The following enables you to selectively omit things from the GraphQL API. This is not intended for implementing permissions (you should do that using GRANTs and RLS), it's for removing things from your API that you don't need - for example you most likely wouldn't want to expose a
ts_vector
column to GraphQL land even though you have read permissions to it for search. You can use this to turn off certain mutations for certain fields, however you should back these up with database permissions. Repeat: this is not intended for implementing permissions!We currently support the following for table
foo
, columnfoo.bar
and functionqux
:createFoo
mutationbar
is not available oncreateFoo
mutationupdateFoo
orupdateFooBy*
mutationsbar
is not available onupdateFoo
mutationsdeleteFoo
ordeleteFooBy*
mutationscondition
argument forallFoos
/foosBy...
allFoos
/etc bybar
orderBy
argument forallFoos
/etcBAR_ASC
orBAR_DESC
allFoos
queryfoosBy...
fieldsallFoos
querycomment on table foo is E'@omit list';
createFoo*
mutationcomment on table foo is E'@omit create';
updateFoo*
mutationcomment on table foo is E'@omit update';
deleteFoo*
mutationcomment on table foo is E'@omit delete';
comment on table foo is E'@omit';
node
interfaceExample of why this shouldn't be used for permissions: could use orderBy to derive the range of the value of a column.