I use the library to generate the goadesign microservice framework. When I describe a resource in this way

 var UnitMedia = MediaType ("application / json", func () {
     Attributes (func () {
         Attribute ("id", Integer, func () {
             Description ("ID")
             Example (12345)
         })
         Attribute ("name", String, func () {
             Description ("Title")
             Example ("set")
         })
     })

     View ("default", func () {
         Attribute ("id")
         Attribute ("name")
     })
 })

I get the copper type when I generate the goagen bootstrap frame

 type Unit struct {// ID id * int `form:" id, omitempty "json:" id, omitempty "xml:" id, omitempty "` // Name Name * string `form:" name, omitempty "json:" name, omitempty "xml:" name, omitempty "`} 

Where the fields of the ALL structure are pointers. Although in the example supplied by the framework it is not. I have not found any way to specify how to generate structures without pointer fields.

    1 answer 1

    Sorry, I did not carefully read the documentation, it is necessary when describing the media type, specify the Required () attributes. Pointers are generated only for optional attributes.