Anatomy of a enum µSpec #
The µType specs are regular yaml files.
The “enum-object” contains 4 fields. The fields enum
, values
are mandatory, the field target
and alias
are optional.
You can have as many enum definitions per file as you want. It makes sense that you put enums in a file, that belongs togehter.
It is not possible to mix enums and types in the same µSpec file at the moment.
File: muspec/sample.enums.yaml
|
|
As you can see, the Corpus enum’s first constant maps to zero: every enum definition must contain a constant that maps to zero as its first element. This is because for the compatibility with protobuf.
The enum definition line #
|
|
It is a good practice to give a good description.
Values #
In the “values-object”, you define the values of the enum.
|
|
Alias #
Alias is a boolean field to define if you want to allow aliases.
Target #
In the field target, you can define the target proto file for the enum definition.