-
Notifications
You must be signed in to change notification settings - Fork 183
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
GraphQL-Interfaces error with SPQR-Annotations #282
Comments
What does your schema generator look like? I currently have the follow and it seems to work for me (though our code base is different). Hope this helps.
|
You have a rather complicated and confusing setup here, as you sometimes use classes and sometimes interfaces as concrete implementations. Still, there's nothing strictly wrong with it, it's just difficult to untangle the expected behavior. Now, where it gets strange is As you see, this is super-convoluted... your best option is to simply disable And I'm investigating fixing the only direct interfaces issue, so that should be dealt with soon as well. |
@Kirintale The current default |
Ah cool. I'll try to remove it and see what happens. Thank you. |
@pmbdias I've pushed a commit fixing the bug I explained above (where only direct interfaces would be taken into account). Now all interfaces should be mapped as expected. @Kirintale As a result of addressing the bug discussed here, the default |
@kaqqao Thank you for your interest in helping me. |
@kaqqao I posted on github a project for you to better understand the problem I described in the post above. https://github.com/pmbdias/graphql |
This is almost certainly a classloading issue. Do you have 2 SPQR jars on your classpath? E.g. once in your EAR and once in your WAR? I've seen this happen before. The annotation would be loaded twice, by different classloaders, so they wouldn't be equal to each other when compared. |
I can neither figure out how to start the web application that the |
The reported problem was not the existence of 2 SPQR jars on my classpath. But it was classloading problem. You have any indication of java client for consumption of queries and graphql mutations? I am looking for a client so that other applications can consume my graphql application. Do you have any sugestion? |
In EAR packages, multiple classloaders are used to load different deployment units. And if the packaging isn't done exactly right, you can end up in your situation where a class (the As for the client, I'm not aware of anything particularly good. Apollo Android is maybe the easiest to use. There's also AmericanExpress' Nodes GraphQL client but I've personally never a use-case matching theirs. |
@kaqqao I have one more difficulty now regarding mutation. I don't know passing complex parameter which has interface type attribute. How to define in mutation what is the implementation of the interface I want to pass.
I have the Person object that has two attributes: name and identification. But the identification attribute is type IdentificationIf which has two implementations IdentificationCPF and IdentificationCNPJ. I need to call a mutation passing the Person object but I don't know how to enter the identification due to the type being an Interface. |
Try |
E.g. given the interface IdentificacaoIf, if two implementation types are discovered IdentificacaoCPF and IdentificacaoCNPJ I understand that this way there is no way for graphql to know which object it needs to instantiate. But I don't know how to indicate the concrete object in the mutation. |
I have exactly the same problem here and have no idea how to solve it.
This works. But its typ is BuildingChild and I want to set s2 too which is not possible. |
I have got Java types with SPQR-Annotations the following manner:
When executing the query in spqr 0.9.6 the error occurs:
The Dog type does not appear in the list of possible types.
The query that does not return the Dog type works correctly, but the query that has the Dog object occurs the unknown type error.
In the spqr 0.9.9:
Here the Dog type does appear in the list of possible types.
But the ICat, IBat, and ICow types are returned as null and the Dog type is returned the data correctly.
So there is a different behavior in spqr versions.
Any idea what might be happening?
The text was updated successfully, but these errors were encountered: