Skip to content

Generate both interface and type from abstract class #220

@StarF666

Description

@StarF666

I'm currently still playing around with graphql-kotlin. Biggest "issue" currently for me is that I'm using abstract classes in my model to implement base classes for some entity types (using hibernate to access database). When using the generator this generates a schema where I cannot query for a base type and then use the "...on SomeType" syntax to handle the subclasses. I would have to write interfaces mirroring the abstract classes properties which would mean repeating my code.

I thought about changing the generator so it will generate a type AND interface from an abstract kotlin class. But I was not able to dig deep enough into the generators code to archieve this. It is easy to generate an interface instead of a type but not two (interface and type).

I don't know if this would break any rules or conventions of GraphQL. I really like what I discovered so far but GraphQL seems to be a bit limited with inheritance. I could manually write the interfaces but that would mean double source of truth.

Maybe I'm missing something but would the solution of generating both interface and type be a feasible solution?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions