graphql-spqr
graphql-spqr copied to clipboard
To write GraphQL types and field's argument description without changing name.
To write GraphQL types and field's argument description without changing name. Add @GraphQLArgument name default as empty string.
before:
@GraphQLArgument(name="", description="arg1 description") String arg1
after:
@GraphQLArgument(description="arg1 description") String arg1
BTW, GraphQLQuery, Mutation, Subscription has default value as empty string. https://github.com/leangen/graphql-spqr/blob/master/src/main/java/io/leangen/graphql/annotations/GraphQLQuery.java#L17
I think it's better to make the same correction to GraphQLArgument for consistency.
BTW, GraphQLQuery, Mutation, Subscription has default value as empty string. https://github.com/leangen/graphql-spqr/blob/master/src/main/java/io/leangen/graphql/annotations/GraphQLQuery.java#L17
I think it's better to make the same correction to GraphQLArgument for consistency.
The reason for this inconsistency is Java will normally lose argument names (unless you tell the compiler to reserve them), where as the method names are always kept. So method-level annotations always have a safe default, whereas parameter annotation normally don't, so the mandatory name in @GraphQLArgument
was meant to encourage the users not to ignore this.
But I agree that it can also also be annoying, e.g. when you know you have parameter names preserved and want to add descriptions. So I agree with you and will merge your PR.