Overide existing type #1870
-
Hello there, I'm new on Vendure. I would like to edit a type that is automatically generated. In my case, I would like to make all fields of "RegisterCustomerInput" mandatory Thank you for your help. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
Answered in Slack, but posting here so it is also public: It is possible to extend existing types using the GraphQL extend keyword, as described here. However, it's not possible to change an existing field. A solution to your use-case could be to define a custom mutation, which allows you to specify exactly what the input should be. You can then override the existing registerCustomerAccount mutation with a custom resolver implementation that throws an error, so that people can only use your new custom mutation to register an account. |
Beta Was this translation helpful? Give feedback.
Answered in Slack, but posting here so it is also public:
It is possible to extend existing types using the GraphQL extend keyword, as described here. However, it's not possible to change an existing field.
A solution to your use-case could be to define a custom mutation, which allows you to specify exactly what the input should be. You can then override the existing registerCustomerAccount mutation with a custom resolver implementation that throws an error, so that people can only use your new custom mutation to register an account.