CUE Code Generation



Translating CUE to type (class or struct) is a challenging problem generally.

It really can’t capture all of the nuances in the vanilla form. We need to do something more complex.

The Hof Method

Some helpful links

Once first-example is done, several production versions of the concepts therein will be made into hofmods

With CUE

There are also ways to generate types without hof

  • one could do essentially the same thing hof is doing in pure CUE, though less sophisticated
  • If you are willing to write Go, you can walk the AST and/or cue.Value to do some things. Attributes would make this more interesting.
  • hof leaves more to the data model schema + generator, so it can be more flexible without modifying the tool. This should also be composable. I plan to have an example of that in the first-example/using-a-database or maybe another section

There are also discussion and issues on CUE GitHub.

TODO, respond to

2022 Hofstadter, Inc