code: func attributeFromRef(name string, ref design.DataType) *design.AttributeDefinition {
  	if ref == nil {
  		return nil
  	}
  	switch t := ref.(type) {
  	case *design.UserTypeDefinition:
  		if t.DSLFunc != nil {
  			dsl := t.DSLFunc
  			t.DSLFunc = nil
  			dslengine.Execute(dsl, t.AttributeDefinition)
  		}
  		if att, ok := t.ToObject()[name]; ok {
  			return design.DupAtt(att)
  		}
  	case *design.MediaTypeDefinition:
  		if t.DSLFunc != nil {
  			dsl := t.DSLFunc
  			t.DSLFunc = nil
  			dslengine.Execute(dsl, t)
  		}
  		if att, ok := t.ToObject()[name]; ok {
  			return design.DupAtt(att)
  		}
  	case design.Object:
  		if att, ok := t[name]; ok {
  			return design.DupAtt(att)
  		}
  	}
  	return nil
  }
docs: // attributeFromRef returns a base attribute given a reference data type.
  // It takes care of running the DSL on the reference type if it hasn't run yet.