Closed dpalmmna closed 1 year ago
Hello,
I'm surprised and annoyed that, with all the integration tests I have, this bug is possible.
I could repeat this issue with the pom you provided. And yes, the dependencies for each custom scalar is mandatory. A workaround is to add the dependency to the plugin, like this:
<plugin>
<groupId>com.graphql-java-generator</groupId>
<artifactId>graphql-maven-plugin</artifactId>
<version>1.18.10</version>
<executions>
<execution>
<goals>
<goal>generateClientCode</goal>
</goals>
</execution>
</executions>
<configuration>
<packageName>fr.cs.maps.mission.mus.database</packageName>
<customScalars>
<customScalar>
<graphQLTypeName>timestamp</graphQLTypeName>
<javaType>java.time.LocalDateTime</javaType>
<graphQLScalarTypeStaticField>
fr.cs.maps.database.customscalars.MAPSGraphQLScalarType.LocalDateTime
</graphQLScalarTypeStaticField>
</customScalar>
<customScalar>
<graphQLTypeName>geometry</graphQLTypeName>
<javaType>org.locationtech.jts.geom.Geometry</javaType>
<graphQLScalarTypeStaticField>
fr.cs.maps.database.customscalars.MAPSGraphQLScalarType.Geometry
</graphQLScalarTypeStaticField>
</customScalar>
<customScalar>
<graphQLTypeName>geography</graphQLTypeName>
<javaType>org.locationtech.jts.geom.Geometry</javaType>
<graphQLScalarTypeStaticField>
fr.cs.maps.database.customscalars.MAPSGraphQLScalarType.Geography
</graphQLScalarTypeStaticField>
</customScalar>
<customScalar>
<graphQLTypeName>float8</graphQLTypeName>
<javaType>java.lang.Double</javaType>
<graphQLScalarTypeStaticField>graphql.Scalars.GraphQLFloat</graphQLScalarTypeStaticField>
</customScalar>
<customScalar>
<graphQLTypeName>bytea</graphQLTypeName>
<javaType>java.lang.String</javaType>
<graphQLScalarTypeStaticField>graphql.Scalars.GraphQLString</graphQLScalarTypeStaticField>
</customScalar>
</customScalars>
<!-- The parameters below change the 1.x default behavior to respect the future 2.x behavior -->
<copyRuntimeSources>false</copyRuntimeSources>
<generateDeprecatedRequestResponse>false</generateDeprecatedRequestResponse>
<separateUtilityClasses>true</separateUtilityClasses>
<skipGenerationIfSchemaHasNotChanged>false</skipGenerationIfSchemaHasNotChanged>
</configuration>
<dependencies>
<dependency>
<groupId>org.locationtech.jts</groupId>
<artifactId>jts-core</artifactId>
<version>1.15.1</version>
</dependency>
</dependencies>
</plugin>
I didn't check all the scalars you've defined, so perhaps other dependencies must be added for your all project to work.
It will be solved in a next version. Etienne
Adding the dependency worked. Thxs. This is an acceptable solution.
Hello,
The correction for this issue has been released the 2.3 version. I'll see to add it into the 1.x version
While attempting to upgrade from 1.18.9 to 1.18.10 the generation now fails on custom scalars.
The code that causes errors is
The method exists with message Could not find the package for the class 'org.locationtech.jts.geom.Geometry', due to: org.locationtech.jts.geom.Geometry.
The pom.xml configuration is :
How to allow the generation with this new code, using types from external libraries?