code: func DefaultMedia(val interface{}, viewName ...string) {
  	if r, ok := resourceDefinition(); ok {
  		if m, ok := val.(*design.MediaTypeDefinition); ok {
  			if m.UserTypeDefinition == nil {
  				dslengine.ReportError("invalid media type specification, media type is not initialized")
  			} else {
  				r.MediaType = m.Identifier
  				m.Resource = r
  			}
  		} else if identifier, ok := val.(string); ok {
  			r.MediaType = identifier
  		} else {
  			dslengine.ReportError("media type must be a string or a *design.MediaTypeDefinition, got %#v", val)
  			return
  		}
  		if len(viewName) == 1 {
  			r.DefaultViewName = viewName[0]
  		} else if len(viewName) > 1 {
  			dslengine.ReportError("too many arguments given to DefaultMedia")
  		}
  	}
  }
docs: // DefaultMedia can be used in: Resource
  //
  // DefaultMedia sets a resource default media type by identifier or by reference using a value
  // returned by MediaType:
  //
  //	var _ = Resource("bottle", func() {
  //		DefaultMedia(BottleMedia)
  //		// ...
  //	})
  //
  //	var _ = Resource("region", func() {
  //		DefaultMedia("vnd.goa.region")
  //		// ...
  //	})
  //
  // The default media type is used to build OK response definitions when no specific media type is
  // given in the Response function call. The default media type is also used to set the default
  // properties of attributes listed in action payloads and params. So if a media type defines an
  // attribute "name" with associated validations then simply calling Attribute("name") inside a
  // request Payload or Param defines the attribute with the same type and validations.