12345678910111213141516171819202122232425262728293031323334 |
- package swag
-
- import "fmt"
-
- // CheckSchemaType TODO: NEEDS COMMENT INFO
- func CheckSchemaType(typeName string) {
- switch typeName {
- case "string", "number", "integer", "boolean", "array", "object":
-
- default:
- panic(fmt.Errorf("%s is not basic types", typeName))
- }
- }
-
- // TransToValidSchemeType indicates type will transfer golang basic type to swagger supported type.
- func TransToValidSchemeType(typeName string) string {
- switch typeName {
- case "uint", "int", "uint8", "int8", "uint16", "int16", "byte":
- return "integer"
- case "uint32", "int32", "rune":
- return "integer"
- case "uint64", "int64":
- return "integer"
- case "float32", "float64":
- return "number"
- case "bool":
- return "boolean"
- case "string":
- return "string"
- default:
- return typeName // to support user defined types
- }
- }
|