OneOf: Union Attributes in Goa
Goa v3.7.0: Union Attributes in Goa Goa v3.7.0 adds the ability to define union attributes in the Goa DSL. Union attributes enumerate multiple potential attribute values for a single type attribute. Union attributes are defined using the new OneOf function. OneOf may be used wherever Attribute or Field can be used, for example: var Dog = Type("Dog", func() { Description("Dogs are cool") Field(1, "Name") Field(2, "Breed") Required("Name", "Breed") }) var Cat = Type("Cat", func() { Description("Cats are cool too") Field(1, "Name") Field(2, "Age", Int) Required("Name", "Age") }) var PetOwner = Type("PetOwner", func() { Description("A pet owner") OneOf("pet", func() { Description("The owner's pet") Field(1, "dog", Dog) Field(2, "cat", Cat) }) }) Union attributes are generated as Go interfaces that implement a private method.