What feature are you missing?
Extend generated types in server/src/schema.graphql
How could this feature look like in detail? Tradeoffs?
Example in apollo: https://www.apollographql.com/docs/graphql-tools/generate-schema.html#extend-types
const typeDefs = [`
schema {
query: Query
}
type Query {
bars: [Bar]!
}
type Bar {
id
}
`, `
type Foo {
id: String!
}
extend type Query {
foos: [Foo]!
}
`]
I see no reason why this wouldn't work. Have you tried it?
Yes, i tried and it does not work. No errors, just no extends.
Can you share a minimal setup that showcases the unexpected behaviour?
@marktani
In prisma schema
`type Extended {
id: ID! @unique
field1: String
}
extend type Extended {
field2: String
}`
Expected Extended.field2 too, but got only
type Extended
implements Node {
id: ID!
field1: String
}
In src/schema.graphql it does not works too.
I am trying this, which does not work.
prisma.graphql
type Player implements Node {
id: ID!
firstName: String!
}
schema.graphql
# import Player from "./generated/prisma.graphql"
type Query {
players: [Player!]!
}
extend type Player {
signedByUser: Boolean
}
Query returns 400 error
query PlayersQuery {
players {
id
firstName
signedByUser
}
}
Running into the same issue:
# import Query, User from "./generated/prisma.graphql"
type Query {
me: User
}
extend type User {
authToken: String
}
Trying to add on authToken to the User type, but then when I try to grab it I get the message of Cannot query field "authToken" on type "User". Did you mean "{similar field here}"?
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
Still actual
This is a feature request to the respective GraphQL server library you're using, not to Prisma.
Please open a new feature request at the corresponding GitHub repository.
Thanks! 馃檶
@marktani, maybe I do not understand what? Prisma uses prisma-binding. Prisma-binding uses graphql-tools. Graphql-tools says it is working https://www.apollographql.com/docs/graphql-tools/generate-schema.html#extend-types
Why it does not working in prisma?
I sent similar issue a few days ago https://github.com/prisma/graphql-yoga/issues/430
This issue still happens. The extension of the type is not included in the generated graphql schema when running prisma generate
Most helpful comment
Running into the same issue:
Trying to add on
authTokento theUsertype, but then when I try to grab it I get the message ofCannot query field "authToken" on type "User". Did you mean "{similar field here}"?