dgs-codegen
dgs-codegen copied to clipboard
Adding custom suffix to generated types
With DGS codegen, I want the schema types to correspond my Model entity types.
For example let's assume that I have a query in my schema:
type Dog {
name: String!
}
My generated type will be <generated_types_package>.Dog.java
In most cases, I will have another class for my model object. <model_type_package>.Dog.java
What happens in this case that in my DataFetcher I need to declare explicitly on the type package prefix, which makes the code pretty hard to read.
My suggestion is to add a custom suffix to any schema generated type (not input)
<model_type_package>.Dog.java --> <model_type_package>.DogGQL.java
I can see that being hard to use. We can looking into improving that in the future. Feel free to open a PR if you would like to have that available sooner.
@srinivasankavitha Thank you for your response. I will check out that, Since I am using maven I will need another PR for the maven plugin to support such kind of config.
+1, I'm going to name my entities <Name>Entity but would still like this to avoid potential conflicts and to match that kind of class naming convention
Ah ok, we don't maintain or own the maven plugin. That is more community maintained.
On Tue, Jun 7, 2022 at 12:59 PM maory @.***> wrote:
@srinivasankavitha https://github.com/srinivasankavitha Thank you for your response. I will check out that, Since I am using maven I will need another PR for the maven plugin to support such kind of config.
— Reply to this email directly, view it on GitHub https://github.com/Netflix/dgs-codegen/issues/389#issuecomment-1149106144, or unsubscribe https://github.com/notifications/unsubscribe-auth/AJ5JPXLCKNBEH6FXTUTKFSLVN6SZZANCNFSM5YDGP4WA . You are receiving this because you were mentioned.Message ID: @.***>
I'm using gradle, just FYI