code: func TypeSchema(api *design.APIDefinition, t design.DataType) *JSONSchema {
  	s := NewJSONSchema()
  	switch actual := t.(type) {
  	case design.Primitive:
  		if name := actual.Name(); name != "any" {
  			s.Type = JSONType(actual.Name())
  		}
  		switch actual.Kind() {
  		case design.UUIDKind:
  			s.Format = "uuid"
  		case design.DateTimeKind:
  			s.Format = "date-time"
  		case design.NumberKind:
  			s.Format = "double"
  		case design.IntegerKind:
  			s.Format = "int64"
  		}
  	case *design.Array:
  		s.Type = JSONArray
  		s.Items = NewJSONSchema()
  		buildAttributeSchema(api, s.Items, actual.ElemType)
  	case design.Object:
  		s.Type = JSONObject
  		for n, at := range actual {
  			prop := NewJSONSchema()
  			buildAttributeSchema(api, prop, at)
  			s.Properties[n] = prop
  		}
  	case *design.Hash:
  		s.Type = JSONObject
  		s.AdditionalProperties = true
  	case *design.UserTypeDefinition:
  		s.Ref = TypeRef(api, actual)
  	case *design.MediaTypeDefinition:
  		// Use "default" view by default
  		s.Ref = MediaTypeRef(api, actual, design.DefaultView)
  	}
  	return s
  }
docs: // TypeSchema produces the JSON schema corresponding to the given data type.