Context/Problem:
I'm facing an issue with auto generated update & creat method for an input type.
The input type "AuthPayload" returns an user object + auth token.
this type "AuthPayload" will never be updated or created nor read by any graphql client. It lives only as payload, therefore no auto generated methods from neo4j-graphql-js.
Question:
Is there a way to prevent neo4j-graphql-js from generating update,create resolvers for a type.
Maybe something like this:
@IGNORE
type AuthPayload {
user: User!
token: String!
}
subset of my schema.graphql
type Mutation {
login(data: LoginUserInput!): AuthPayload!
}
input LoginUserInput {
email: String!
password: String!
}
type AuthPayload {
user: User!
token: String!
}
error response within graphql gui:
{
"error": {
"errors": [
{
"message": "The type of Mutation.UpdateAuthPayload(user:) must be Input Type but got: User!.\n\nThe type of Mutation.DeleteAuthPayload(user:) must be Input Type but got: User!.\n\nThe type of _AuthPayloadInput.user must be Input Type but got: User!.",
"extensions": {
"code": "GRAPHQL_VALIDATION_FAILED",
"exception": {
"stacktrace": [
"Error: The type of Mutation.UpdateAuthPayload(user:) must be Input Type but got: User!.",
"",
"The type of Mutation.DeleteAuthPayload(user:) must be Input Type but got: User!.",
Hi @benpetsch - not currently, but @michaeldgraham is currently working on a feature that will add support for this.
It will not be directive based, but instead an optional configuration object will be passed to makeAugmentedSchema or augmentSchema specificying which types should have auto-generated queries and mutations.
@johnymontana thanks for the fast support. Do you know the "estimated time of arrival" for that feature?
@benpetsch we've now added an optional config parameter for augmentSchema and makeAugmentedSchema that can be used to specify generated mutations and queries.
To exclude specific types from the schema augmentation process:
import { makeAugmentedSchema } from "neo4j-graphql-js";
const schema = makeAugmentedSchema({
typeDefs,
config: {
query: {
exclude: ["AuthPayload"]
},
mutation: {
exclude: ["AuthPayload"]
}
}
});
Most helpful comment
@johnymontana thanks for the fast support. Do you know the "estimated time of arrival" for that feature?