stephenh / dtonator

code generator for creating DTOs and mapping to domain objects
Other
14 stars 5 forks source link

Will be able to add lombok annotations to the generated DTOs? #11

Open yongqxu opened 5 years ago

yongqxu commented 5 years ago

We use lombok extensively, i wish those auto generated DTOs can include some lombok annotations such as @Data, @AllArgsConstructor, @NoArgsConstructor, @Builder, etc.If i have manually add them, i wish i just need to add once, next time auto generated DTOs will not overwrite my manually update DTO class.

stephenh commented 5 years ago

Yes, dtonator should be able to do that:

https://github.com/stephenh/dtonator/blob/28e96842f14c1c23fff1c2e0a0f199ddc3a874e4/dtonator/src/main/java/com/bizo/dtonator/config/DtoConfig.java#L84

Probably something like:

EmployeeDto:
  domain: Employee
  annotations: org.whatever.DaTa

If you want the same annotations on every single DTO, it'd make sense to have a list of common annotations at the top of the yaml file that would be applied to all DTOs, but dtonator doesn't support that currently. It'd be a pretty trivial change though if you'd like to submit a PR.