Daml codegen for data types only

Hi, if I have a Daml project which contains only data types (no templates), can I run codegen on it? I’ve tried doing this (for java codegen), but the output does not include any classes for the data types (Daml records) I’ve defined. If I add a template in, then it creates a java class for the template, but it ignores any of my data types (unless of course I add them as fields on the template).

The Java codegen only generates code for types that are referenced from some template. So if you have data types not referenced from anywhere it won’t generate code for them. There is not currently any way to change that.

It’s probably worth pointing out that “referenced” includes being referenced from another package. So if you have one package that only contains data types but the datatypes are referenced from a template in a different package you can run the codegen for the DAR containing both and code for the datatype will be generated.