[Java] Directive on ARGUMENT_DEFINITION is not propagated to generated mutation interface
See original GitHub issue[Java] Custom directive for ARGUMENT_DEFINITION is not propagated to generated Java interface
Issue Description
Hello team,
I’m trying to declare a custom directive that is mapped to Java annotation. However, when applied to mutation’s argument it is not propagated to the generated Java’s interface method. Is there some important detail that I’m missing?
Thank you!
Steps to Reproduce
schema.graphql
directive @valid on ARGUMENT_DEFINITION
input SampleInput {
name: String
}
type Mutation {
sampleAction(input: SampleInput! @valid): String!
}
Expected Result
The generated method sampleAction
has a parameter input
annotated with @javax.validation.Valid
.
public interface SampleActionMutationResolver extends graphql.kickstart.tools.GraphQLMutationResolver {
@javax.validation.constraints.NotNull
String sampleAction(@javax.validation.Valid SampleInput input);
}
Actual Result
The generated method sampleAction
has a parameter input
without @javax.validation.Valid
annotation.
public interface SampleActionMutationResolver extends graphql.kickstart.tools.GraphQLMutationResolver {
@javax.validation.constraints.NotNull
String sampleAction(SampleInput input);
}
Your Environment and Setup
- graphql-java-codegen version: 4.1.5
- com.graphql-java-kickstart version: 11.0.0
- Build tool: Gradle 6.8
- Mapping Config:
graphqlCodegen {
generateApis = true
generateApisWithThrowsException = false
parentInterfaces {
queryResolver = "graphql.kickstart.tools.GraphQLQueryResolver"
mutationResolver = "graphql.kickstart.tools.GraphQLMutationResolver"
subscriptionResolver = "graphql.kickstart.tools.GraphQLSubscriptionResolver"
resolver = "graphql.kickstart.tools.GraphQLResolver<{{TYPE}}>"
}
directiveAnnotationsMapping = [
'valid': ['javax.validation.Valid']
]
}
Issue Analytics
- State:
- Created 3 years ago
- Comments:5 (3 by maintainers)
Top Results From Across the Web
How to add a non-schema directive? · Issue #246 - GitHub
I am supposed to be able to define a directive like this: directive ... ... to add a non-schema directive (I.E. for a...
Read more >GraphQL specification
A document may contain operations (queries, mutations, and subscriptions) as well as fragments, a common unit of composition allowing for query reuse. A...
Read more >GraphQL
A schema is defined in terms of the types and directives it supports as well as the root operation types for each kind...
Read more >Graphql no resolver definied for interface/union - java
1 Answer 1 · how did you compile this line? if (javaObject instanceof Car) { how this CAR class is generated? · It's...
Read more >Spring for GraphQL Documentation
A DataFetcher and other components invoked by GraphQL Java may not always execute on the same thread as the Spring MVC handler, for...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@enttq, Thanks for the contribution! I will soon release your changes as part of 4.1.6.
I tested the NotNull annotation in Scala and it seems to be useless. kotlin doesn’t need the NotNull annotation ,so I didn’t test