Closed EugenMayer closed 2 years ago
The type mapping is used to specify the graphql type (as defined in the schema) to map to corresponding Java type. In the example you provided, "ApplesKindsDTO" is not in your schema?
Note that codegen generates POJOs based on the types in the graphQL schema, so you will need that.
thank you @srinivasankavitha for re-approving that we mis-understood codegen and actually had to learn that we need to integrate a code 2 schema library for types in our project in addition to DGS, since DGS is schema 2 code.
Thank you for helping out!
Since we are new to the codegen project (not to DGS itself) i'am trying to first state my motivation (not that it is an issue of expectations here).
My motivation is, that i have Java Types (mostly DTO's and Enums) which are used outside of GraphQL / DGS too, thus those are defined in the java project itself. That said, i want to use those types in GraphQL without redefining them (especially an issue for enums). So basically, generated graphql types from java types (dry DTOs and Enums).
For that we expected that using
typeMapping
would import / declare a java type for graphql, so for example for Enums it will create aEnumTypeDefinition
which is then used by the graphql validator.This seems not to work right now.
Steps to reproduce
And now the java types
And the enum
Finally we configure those types to be mapped
Now when just running/smoke testing the application, the DGS validation will fail with