-
-
Notifications
You must be signed in to change notification settings - Fork 810
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
transformSchema: remove input fields by name. #1058
Comments
+1, Tried FilterByTypes and FilterRootFields couldn't make it work. |
As a temporary workaround, I created a rough schema-generator for this. It is very basic, but we have used it successfully for about a month now, doing most of what we need in a very dynamic way. It is of course not an ideal solution. https://github.com/runar-indico/graphql-schema-transformer |
Moving to v5.1, reopening to move any relevant discussion here. |
This is not as simple as changing the input objects, because you also have to provide a mechanism for setting default values for non optional input values |
@yaacovCR Should I open a separate issue to deal with query and mutation arguments? |
I think it would all be part of same transformer, so can be tracked together |
See #1551 which allows filtering and renaming input fields but does not yet address fully the issue of modifying the arguments. Please comment there on desired approach. |
#1551 has been improved to allow setting default values for filtered input fields at schema generation time or at delegation time.. |
Try out the new FilterInputObjectFields transform from #1551:
Usage as follows:
|
Should be available in latest release, needs docs |
Let's close this for now because we already need work for most of transforms :) |
In my current schema, I have some about 15-ish types like this:
all of them having a
createdBy
-reference to the user. The complete schema is then generated, with queries, mutations and all. However, we don't want users to be able to specifycreatedBy
when they are doing mutaitons, as we get that information from authentication-information.We have tried to remove overy instance of
createdBy
from the generated input-types, but this is fast turning into a chore.After looking at transformSchema, we see that it could possibly be used for this. However, I find it a bit difficult to know exactly how I should transform. I could not find this information in the documentation. What fields in the schema would be input?
Basically, I'd like to remove every field of type
input
that has the namecreatedBy
.The text was updated successfully, but these errors were encountered: