mirror of
				https://github.com/beego/bee.git
				synced 2025-10-31 02:13:23 +00:00 
			
		
		
		
	required description
This commit is contained in:
		
							
								
								
									
										14
									
								
								g_docs.go
									
									
									
									
									
								
							
							
						
						
									
										14
									
								
								g_docs.go
									
									
									
									
									
								
							| @@ -535,14 +535,22 @@ func getModel(str string) (pkgpath, objectname string, m swagger.Model, realType | |||||||
| 							// if the tag contains json tag, set the name to the left most json tag | 							// if the tag contains json tag, set the name to the left most json tag | ||||||
| 							var name = field.Names[0].Name | 							var name = field.Names[0].Name | ||||||
| 							if field.Tag != nil { | 							if field.Tag != nil { | ||||||
| 								mp.Description = strings.Trim(field.Tag.Value, "`") | 								stag := reflect.StructTag(strings.Trim(field.Tag.Value, "`")) | ||||||
| 								stag := reflect.StructTag(mp.Description) |  | ||||||
| 								if tag := stag.Get("json"); tag != "" { | 								if tag := stag.Get("json"); tag != "" { | ||||||
| 									name = tag | 									name = tag | ||||||
| 								} | 								} | ||||||
| 								if beedoc := stag.Get("beedoc"); beedoc == "required" { | 								if thrifttag := stag.Get("thrift"); thrifttag != "" { | ||||||
|  | 									ts := strings.Split(thrifttag, ",") | ||||||
|  | 									if ts[0] != "" { | ||||||
|  | 										name = ts[0] | ||||||
|  | 									} | ||||||
|  | 								} | ||||||
|  | 								if required := stag.Get("required"); required != "" { | ||||||
| 									m.Required = append(m.Required, name) | 									m.Required = append(m.Required, name) | ||||||
| 								} | 								} | ||||||
|  | 								if desc := stag.Get("description"); desc != "" { | ||||||
|  | 									mp.Description = desc | ||||||
|  | 								} | ||||||
| 							} | 							} | ||||||
| 							m.Properties[name] = mp | 							m.Properties[name] = mp | ||||||
| 						} | 						} | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 astaxie
					astaxie