http urls monitor.

schema.go 802B

12345678910111213141516171819202122232425262728293031323334
  1. package swag
  2. import "fmt"
  3. // CheckSchemaType TODO: NEEDS COMMENT INFO
  4. func CheckSchemaType(typeName string) {
  5. switch typeName {
  6. case "string", "number", "integer", "boolean", "array", "object":
  7. default:
  8. panic(fmt.Errorf("%s is not basic types", typeName))
  9. }
  10. }
  11. // TransToValidSchemeType indicates type will transfer golang basic type to swagger supported type.
  12. func TransToValidSchemeType(typeName string) string {
  13. switch typeName {
  14. case "uint", "int", "uint8", "int8", "uint16", "int16", "byte":
  15. return "integer"
  16. case "uint32", "int32", "rune":
  17. return "integer"
  18. case "uint64", "int64":
  19. return "integer"
  20. case "float32", "float64":
  21. return "number"
  22. case "bool":
  23. return "boolean"
  24. case "string":
  25. return "string"
  26. default:
  27. return typeName // to support user defined types
  28. }
  29. }