Naming generated types to avoid duplicate names in model/domain layer. #20
-
First of all, awesome to opensource the DGS framework 👏 As I read the framework is used extensively at Netflix and I assume the codegen as well. What I have done in other GraphQL (or REST) projects is to suffix these GraphQL or REST data objects with e.g. This to avoid duplicate names with the application's model/domain class As the DGS codegen does not allow suffixing the generated type names, I wonder how this is implemented in a more real application? Just use the same name in model layer and GraphQL layer, and use fully qualified class names? It is trivial to do but I wonder what the experience is at Netflix regarding this. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 3 replies
-
We have a broad variety of use cases; some teams getting data from gRPC services, some loading from a relational database, some other data store, or using some sort of mapper, etc.. Because of this variety we haven't seen an issue with the naming in a consistent way. I think when names overlap the FQN is used. That doesn't mean we can't add a feature to solve this better. I think it makes sense to add a prefix/postfix setting to codegen. It does seem like a fairly common issue. |
Beta Was this translation helpful? Give feedback.
We have a broad variety of use cases; some teams getting data from gRPC services, some loading from a relational database, some other data store, or using some sort of mapper, etc..
Because of this variety we haven't seen an issue with the naming in a consistent way. I think when names overlap the FQN is used.
That doesn't mean we can't add a feature to solve this better. I think it makes sense to add a prefix/postfix setting to codegen. It does seem like a fairly common issue.