Skip to content
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

Version 5.7.0 seems to break customAnnotationsMapping for fields in input types #1055

Closed
dsilva opened this issue Mar 22, 2023 · 5 comments
Closed
Assignees
Labels
bug Something isn't working
Milestone

Comments

@dsilva
Copy link

dsilva commented Mar 22, 2023

Issue Description

Version 5.7.0 is omitting the annotations configured in customAnnotationsMapping for fields in input types.

Steps to Reproduce

Repro at https://github.com/dsilva/repro-graphql-java-codegen-missing-annotations

  1. Clone the repo
  2. Run ./gradlew graphqlCodegen
  3. Look at build/generated/ReproInput.java

Expected Result

The output up to version 5.6.0 was

    @javax.validation.constraints.NotNull
    @com.fasterxml.jackson.annotation.JsonProperty("reproField")
    private java.util.List<String> reproField;

Actual Result

The output with version 5.7.0 of the gradle plugin includes this:

    @javax.validation.constraints.NotNull
    private java.util.List<String> reproField;

Your Environment and Setup

  • graphql-java-codegen version: 5.7.0
  • Build tool: Gradle
  • Mapping Config: E.g.:
tasks.named<io.github.kobylynskyi.graphql.codegen.gradle.GraphQLCodegenGradleTask>("graphqlCodegen").configure {
  graphqlSchemaPaths = listOf(
    "$projectDir/schema.graphqls"
  )
  outputDir = File("$buildDir/generated")

  customAnnotationsMapping = mutableMapOf(
    Pair("ReproInput.reproField", listOf("""@com.fasterxml.jackson.annotation.JsonProperty("reproField")"""))
  )

  generatedAnnotation = "javax.annotation.Generated"
}
@kobylynskyi
Copy link
Owner

@dsilva thanks for reporting this!
Looks like only Gradle plugin was impacted.
I've fixed it in #1056.
Will release 5.7.1 shortly today.
Sorry for the inconveniences.

@kobylynskyi
Copy link
Owner

5.7.1 was released.

@dsilva
Copy link
Author

dsilva commented Mar 23, 2023

By the way, should those annotations land on the field or on the getter? If a Jackson annotation lands on the field, I think it ends up writing json with two keys (one for the getter, another for the field).

@dsilva
Copy link
Author

dsilva commented Mar 23, 2023

5.7.1 was released.

Thank you -- that was quick!

@kobylynskyi
Copy link
Owner

By the way, should those annotations land on the field or on the getter? If a Jackson annotation lands on the field, I think it ends up writing json with two keys (one for the getter, another for the field).

In my projects we use just field-level annotation and it is sufficient. We don't add Jackson annotation to getters.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants