-
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
How to scan for custom annotation generation? #456
Comments
I think you're confusing GraphQL SPQR with Spring GraphQL. While these 2 can be made to work together, you won't be getting any benefit from doing so, and neither is aware of the other. SPQR doesn't understand With all that said, you could make a composite annotation that acts as both generator
.withResolverBuilders(new CustomResolverBuilder())
.withInputFieldBuilders(new CustomInputFieldBuilder()) There's a lot you could reuse from the existing implementations, so your customizations should be pretty simple. I can help you further in doing so if you get stuck. But. Before you attempt any of that, make triple sure this is really what you want to do, because it seems you currently have wrong expectations from SPQR. So please first get a cleaner understanding of what each tool in your toolchain does for you. SPQR Spring Boot starter is intended to be used by itself (e.g. using SPQR's annotations), and not to be mixed with Spring GraphQL's schema mapping features, as they work drastically differently on the conceptual level. |
I envision using spring-graphq as a code-first-schema approach. So I want to borrow the power of sqpr to generate schema, because spring-graphql must have a definition of grpahql.schema. Since we have some other services that still need to be implemented using resetful (some hardware systems, we don't have the ability to modify it) |
But why not use SPQR Spring starter directly? |
The annotations in spqr don't exist in a separate package. My overall project is a microservice. I don't use graphql in microservices but dubbo (an RPC protocol), and when my POJO needs to use sqpr's annotations I need to bring it in all my projects. So instead of using sqpr, I'm currently using spring-graphql in gateway and publishing both graphql and restful api with custom annotations |
Ok, it's easy enough to configure SPQR to scan for your custom annotations. I'd make an example, but I'm traveling and don't have a computer with me. I'll be back in a couple of days. In the meantime, look at |
Thank you for your reply, I will try this way. |
any updates? |
I'm using
spring-graphql
and have aHttpAction
annotation defined in the project to implement bothhttp
andgraphql
functionality, I currently want to scan theHttpAction
annotation to generateschema.graphqls
viagraphql-spqr
What should I do to generate graphql schema for the type of the method tagged with
@HttpAction
?The text was updated successfully, but these errors were encountered: