-
Notifications
You must be signed in to change notification settings - Fork 177
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
Question regarding schema generation with GraphQL-Interfaces #6
Comments
This is a fairly involved setup, so I'll have to analyze this in more depth, but at the first glance it seems auto discovery would work for you. Just add Does this satisfy your needs or did I misunderstand you? |
Ah. I've just tested your scenario. With I'll implement the support for Another option is to enable |
Yet a third option would be to implement your own It was an important design goal to keep graphql-spqr insanely extensible and customizable, so if there's a feature you're missing, the chances are you can easily add it yourself. |
Thanks for your effort! I tried out your second solution and it works. I kept Java-Implementations and Java-Interfaces in separate packages, enabled Now the only thing that raises a question mark, is that the automatically created |
If you're keeping the interfaces and implementations in separate packages, you don't need the And as for the In short, if you're not using interfaces/abstract types as input types, you don't care about the |
I have a problem similar to the one reported in this topic but I could not find a solution.
When executing the query the error occurs:
I'd like to know how I should proceed to work with complex object queries that have interface type attribute. Thanks in advance. |
@pmbdias I don't see anything obviously wrong in your code... I'd suggest you place a breakpoint in e.g. |
The difference is that the IdentificationCPF object is a concrete class and in the initial example of the post the ICat object is an interface.
|
I have got Java types with SPQR-Annotations the following manner:
With corresponding implementations of my interfaces which I have annotated with
@GraphQLIgnore()
.Having all this I create a schema with the
GraphQLSchemaGenerator
withNow, when I query
{ zoo { name, __typename } }
the library throws aGraphQLException
, telling me that it "Could not determine the exact type ofIAnimal
". However, when I add thegetBat()
-method to my Service class (and thus having every type of my schema referenced directly) -- everything works fine. Seemingly, the schema generator does not, at least when invoked with the default parameters, include all implemented interfaces automatically. The result of the query{ __type(name: "IAnimal") { name, possibleTypes { name } } }
,listing only
ICat
as possible type, adds to the suspicion.Now I'd like to know if there's a way to tell the generator to also include derived types even if only a base class is referenced in a service class.
Thanks in advance.
The text was updated successfully, but these errors were encountered: