func()

in tpgtools/type.go [56:90]


func (t Type) String() string {
	switch t.typ.Type {
	case "boolean":
		return SchemaTypeBool
	case "string":
		return SchemaTypeString
	case "integer":
		return SchemaTypeInt
	case "number":
		if t.typ.Format == "double" {
			return SchemaTypeFloat
		}
		return "unknown number type"
	case "object":
		if t.typ.AdditionalProperties != nil {
			if v := t.typ.AdditionalProperties.Type; v == "string" {
				return SchemaTypeMap
			} else {
				// Complex maps are handled as sets with an extra value for the
				// name of the object
				return SchemaTypeSet
			}
		}
		return SchemaTypeList
	case "array":
		if t.typ.Extension["x-dcl-list-type"] == "set" {
			return SchemaTypeSet
		}
		return SchemaTypeList
	case "":
		return "<nil>"
	default:
		return fmt.Sprintf("undefined type: %s", t.typ)
	}
}