Skip to content

[Java] Directive on ARGUMENT_DEFINITION is not propagated to generated mutation interface #602

@jpact

Description

@jpact

[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']
    ]
}

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions