-
Notifications
You must be signed in to change notification settings - Fork 3
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
Support for generic supertypes #19
Comments
Hey @brezinajn 👋 Apologies for the delay! We're looking into this together with @oas004 and wondering what the desired outcome was. Do you want By default, empty Kotlin interfaces generate GraphQL unions: union SomeGenericInterface = Query
type Query {
foo: Int!
} But it sounds like this is not the desired behaviour here? Did you just want the supertype ignored? |
In my optinion the supertype should be ignored. |
Thanks for the reply! Ignoring makes sense. The issue is that by default GraphQL has interfaces and so the processor maps Kotlin interfaces to GraphQL classes: Kotlin: sealed interface Node {
id: String
}
class User(
override val id: String
) : Node GraphQL: interface Node {
id: String!
}
type User implements Node {
id: String!
} We could ignore all non-sealed interfaces but I'm a bit wary this could come as surprising for someone new to the project and expecting an interface to be generated. What about introducting @GraphQLIgnore
interface SomeGenericInterface<T>
@GraphQLQuery
class Query: SomeGenericInterface<String>{
fun foo(): Int = TODO()
@GraphQLIgnore
fun internalFields(): Int = TODO()
}{ type Query {
foo: Int!
} Thoughts? |
This works fine:
This doesn't:
There should be no practical difference for the code generator between those two.
The text was updated successfully, but these errors were encountered: