Closed ErtugrulSener closed 11 months ago
Oh.. is this a duplicate of https://github.com/leangen/graphql-spqr/issues/224?
I think what works is:
@GraphQLQuery(description='this is a cool description')
... but to be honest: this is not obvious.
I would do the following thing:
Did I forgot something?
This has been suggested before, but the reason I decided not to do anything about is straight forward: all fields are queries and all queries are fields. There is nothing special about top-level fields/queries in GraphQL. They are merely fields of the root types (that are themselves just regular types). And this isn't only an implementation detail, but a rather important aspect of GraphQL's design that I believe should not be obscured behind Java-specific, or worse yet SPQR-specific terminology. In other words: I want the users to think in GraphQL terms, and not Java terms, as it is the GraphQL schema you're designing, after all. Java is merely the language we use instead of SDL :)
And yes, you got it right — you can place @GraphQLQuery
to any output field anywhere :)
This has been suggested before, but the reason I decided not to do anything about is straight forward: all fields are queries and all queries are fields. There is nothing special about top-level fields/queries in GraphQL. They are merely fields of the root types (that are themselves just regular types). And this isn't only an implementation detail, but a rather important aspect of GraphQL's design that I believe should not be obscured behind Java-specific, or worse yet SPQR-specific terminology. In other words: I want the users to think in GraphQL terms, and not Java terms, as it is the GraphQL schema you're designing, after all. Java is merely the language we use instead of SDL :)
Okay, I agree with that and I understand the reasoning behind your decision of naming. But something like that should be in a rich documentation about the "framework" SPQR.
Is there any plan on going for a documentation like DGS has? https://netflix.github.io/dgs/getting-started/ Or spring graphql? https://docs.spring.io/spring-graphql/docs/current/reference/html/
If not, is it time to start writing some? I would start with really basic use cases and you could go along with the more advanced stuff, if you like to. Maybe you could bootstrap a project for that and care about the "integration" to refer to it on the README's and we could contribute to it.
To be honest, any help with documentation would be the best contribution this project could receive. If you decide to write anything, I'll publish it on GitHub pages...
I know that there is @GraphQLInputField to set the description on input fields (which doesn't work btw. but that's another issue). We can use the annotation on fields also, like:
This results in (I am using it as an input and return type in my API):
Is there any way for me to set a description on the field of the type, something like @GraphQLField? What I need is the following:
I don't need to change the input field.