Netflix / dgs-codegen

Apache License 2.0
177 stars 92 forks source link

generateJava fails with `Not a valid name: package` #659

Closed rahulsom closed 4 months ago

rahulsom commented 4 months ago

This is similar to https://github.com/Netflix/dgs-codegen/issues/216

I've got a field called package in my schema.

type SecurityVulnerability {
  # skipped
  package: SecurityAdvisoryPackage!
  # skipped
}

It causes the plugin to trip up

> Task :github-graphql-client:generateJava FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':github-graphql-client:generateJava'.
> not a valid name: package

This is my build.gradle

apply plugin: 'com.netflix.dgs.codegen'

generateJava {
    schemaPaths = ["${projectDir}/src/main/resources/ghes-3.11.graphqls"]
    packageName = "com.netflix.graphql.client.generated"
    generateClientv2 = true
}
congotej commented 4 months ago

Hi @rahulsom! What version of codegen are you on? And can you please share an exact schema that is complete, as I am unable to reproduce the issue on my end?

rahulsom commented 4 months ago

./gradlew buildEnvironment reports my version as being the latest.

com.netflix.graphql.dgs.codegen:graphql-dgs-codegen-gradle:latest.release -> 6.1.5

The schema I'm using is https://docs.github.com/public/ghes-3.11/schema.docs-enterprise.graphql

congotej commented 4 months ago

Thanks @rahulsom! I created this test: https://github.com/Netflix/dgs-codegen/compare/master...issue-659-package-keyword-test and it is passing. Since your schema is highly nested, would you mind trying to repro the issue in that test?

rahulsom commented 4 months ago

I'm not able to reproduce the failure in the test. I went back to my repo and tried again, and now I'm not able to reproduce it there either. Thanks for looking at this. And sorry for the false issue.