Not quite sure what you're trying to do, but you are aware you can change the value Nim enums serialize to like this right? type MajorType* = enum mtPositiveInteger = 0 mtNegativeInteger = 1 mtBinaryString = 2 mtUnicodeString = 3 mtArray = 4 mtMap = 5 mtSemantic = 6 mtSpecial = 7 Run
That being said those are the values this particular enum would have for these fields anyways. So you could simply not specify them. Again, not entirely sure what you're trying to do, so this might not apply, but thought I'd mention it just in case. Oh, and the code-generator should be possible to write as a macro ;)