mirror of
				https://github.com/beego/bee.git
				synced 2025-10-31 17:33:26 +00:00 
			
		
		
		
	[g_docs] Abandon schema id
Signed-off-by: weiyang <weiyang.ones@gmail.com>
This commit is contained in:
		| @@ -69,7 +69,7 @@ func convertSpecDefinitions(specDefs spec.Definitions) (defs map[string]swagger. | |||||||
| 	return | 	return | ||||||
| } | } | ||||||
|  |  | ||||||
| func parseModel(pkg *ast.Package, typeStr string) (typeID string, err error) { | func parseModel(pkg *ast.Package, typeStr string) (typeTitle string, err error) { | ||||||
| 	if pkg == nil { | 	if pkg == nil { | ||||||
| 		panic("pkg can not be nil") | 		panic("pkg can not be nil") | ||||||
| 	} | 	} | ||||||
| @@ -77,7 +77,7 @@ func parseModel(pkg *ast.Package, typeStr string) (typeID string, err error) { | |||||||
| 	if err != nil { | 	if err != nil { | ||||||
| 		return | 		return | ||||||
| 	} | 	} | ||||||
| 	typeID = schema.ID | 	typeTitle = schema.Title | ||||||
| 	return | 	return | ||||||
| } | } | ||||||
|  |  | ||||||
| @@ -538,11 +538,11 @@ func parserComments(f *ast.FuncDecl, controllerName, pkgpath string) error { | |||||||
| 						schema.Type = typeFormat[0] | 						schema.Type = typeFormat[0] | ||||||
| 						schema.Format = typeFormat[1] | 						schema.Format = typeFormat[1] | ||||||
| 					} else { | 					} else { | ||||||
| 						typeID, err := parseModel(controllerPkg, schemaName) | 						typeTitle, err := parseModel(controllerPkg, schemaName) | ||||||
| 						if err != nil { | 						if err != nil { | ||||||
| 							beeLogger.Log.Fatalf("failed to parse model %s: %s", schemaName, err) | 							beeLogger.Log.Fatalf("failed to parse model %s: %s", schemaName, err) | ||||||
| 						} | 						} | ||||||
| 						schema.Ref = "#/definitions/" + typeID | 						schema.Ref = "#/definitions/" + typeTitle | ||||||
| 					} | 					} | ||||||
| 					if isArray { | 					if isArray { | ||||||
| 						rs.Schema = &swagger.Schema{ | 						rs.Schema = &swagger.Schema{ | ||||||
| @@ -592,12 +592,12 @@ func parserComments(f *ast.FuncDecl, controllerName, pkgpath string) error { | |||||||
| 				pp := strings.Split(p[2], ".") | 				pp := strings.Split(p[2], ".") | ||||||
| 				typ := pp[len(pp)-1] | 				typ := pp[len(pp)-1] | ||||||
| 				if len(pp) >= 2 { | 				if len(pp) >= 2 { | ||||||
| 					typeID, err := parseModel(controllerPkg, p[2]) | 					typeTitle, err := parseModel(controllerPkg, p[2]) | ||||||
| 					if err != nil { | 					if err != nil { | ||||||
| 						beeLogger.Log.Fatalf("failed to parse model %s: %s", p[2], err) | 						beeLogger.Log.Fatalf("failed to parse model %s: %s", p[2], err) | ||||||
| 					} | 					} | ||||||
| 					para.Schema = &swagger.Schema{ | 					para.Schema = &swagger.Schema{ | ||||||
| 						Ref: "#/definitions/" + typeID, | 						Ref: "#/definitions/" + typeTitle, | ||||||
| 					} | 					} | ||||||
| 				} else { | 				} else { | ||||||
| 					if typ == "auto" { | 					if typ == "auto" { | ||||||
| @@ -731,12 +731,12 @@ func setParamType(para *swagger.Parameter, typ string, pkgpath, controllerName s | |||||||
| 		paraType = typeFormat[0] | 		paraType = typeFormat[0] | ||||||
| 		paraFormat = typeFormat[1] | 		paraFormat = typeFormat[1] | ||||||
| 	} else { | 	} else { | ||||||
| 		typeID, err := parseModel(controllerPkg, typ) | 		typeTitle, err := parseModel(controllerPkg, typ) | ||||||
| 		if err != nil { | 		if err != nil { | ||||||
| 			beeLogger.Log.Fatalf("failed to parse model %s: %s", typ, err) | 			beeLogger.Log.Fatalf("failed to parse model %s: %s", typ, err) | ||||||
| 		} | 		} | ||||||
| 		para.Schema = &swagger.Schema{ | 		para.Schema = &swagger.Schema{ | ||||||
| 			Ref: "#/definitions/" + typeID, | 			Ref: "#/definitions/" + typeTitle, | ||||||
| 		} | 		} | ||||||
| 	} | 	} | ||||||
| 	if isArray { | 	if isArray { | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 weiyang
					weiyang