mirror of
https://github.com/beego/bee.git
synced 2024-12-22 10:00:50 +00:00
commit
9dc796dc1e
@ -57,7 +57,7 @@ Prints the current Bee, Beego and Go version alongside the platform information.
|
||||
}
|
||||
var outputFormat string
|
||||
|
||||
const version = "1.9.0"
|
||||
const version = "1.9.1"
|
||||
|
||||
func init() {
|
||||
fs := flag.NewFlagSet("version", flag.ContinueOnError)
|
||||
|
@ -44,6 +44,7 @@ const (
|
||||
axml = "application/xml"
|
||||
aplain = "text/plain"
|
||||
ahtml = "text/html"
|
||||
aform = "multipart/form-data"
|
||||
)
|
||||
|
||||
var pkgCache map[string]struct{} //pkg:controller:function:comments comments: key:value
|
||||
@ -52,7 +53,7 @@ var importlist map[string]string
|
||||
var controllerList map[string]map[string]*swagger.Item //controllername Paths items
|
||||
var modelsList map[string]map[string]swagger.Schema
|
||||
var rootapi swagger.Swagger
|
||||
var astPkgs map[string]*ast.Package
|
||||
var astPkgs []*ast.Package
|
||||
|
||||
// refer to builtin.go
|
||||
var basicTypes = map[string]string{
|
||||
@ -89,7 +90,7 @@ func init() {
|
||||
importlist = make(map[string]string)
|
||||
controllerList = make(map[string]map[string]*swagger.Item)
|
||||
modelsList = make(map[string]map[string]swagger.Schema)
|
||||
astPkgs = map[string]*ast.Package{}
|
||||
astPkgs = make([]*ast.Package, 0)
|
||||
}
|
||||
|
||||
func ParsePackagesFromDir(dirpath string) {
|
||||
@ -136,8 +137,8 @@ func parsePackageFromDir(path string) error {
|
||||
return err
|
||||
}
|
||||
|
||||
for k, v := range folderPkgs {
|
||||
astPkgs[k] = v
|
||||
for _, v := range folderPkgs {
|
||||
astPkgs = append(astPkgs, v)
|
||||
}
|
||||
|
||||
return nil
|
||||
@ -675,6 +676,8 @@ func parserComments(f *ast.FuncDecl, controllerName, pkgpath string) error {
|
||||
case "html":
|
||||
opts.Consumes = append(opts.Consumes, ahtml)
|
||||
opts.Produces = append(opts.Produces, ahtml)
|
||||
case "form":
|
||||
opts.Consumes = append(opts.Consumes, aform)
|
||||
}
|
||||
}
|
||||
} else if strings.HasPrefix(t, "@Security") {
|
||||
@ -860,14 +863,16 @@ func getModel(str string) (objectname string, m swagger.Schema, realTypes []stri
|
||||
packageName := ""
|
||||
m.Type = "object"
|
||||
for _, pkg := range astPkgs {
|
||||
for _, fl := range pkg.Files {
|
||||
for k, d := range fl.Scope.Objects {
|
||||
if d.Kind == ast.Typ {
|
||||
if k != objectname {
|
||||
continue
|
||||
if strs[0] == pkg.Name {
|
||||
for _, fl := range pkg.Files {
|
||||
for k, d := range fl.Scope.Objects {
|
||||
if d.Kind == ast.Typ {
|
||||
if k != objectname {
|
||||
continue
|
||||
}
|
||||
packageName = pkg.Name
|
||||
parseObject(d, k, &m, &realTypes, astPkgs, pkg.Name)
|
||||
}
|
||||
packageName = pkg.Name
|
||||
parseObject(d, k, &m, &realTypes, astPkgs, pkg.Name)
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -885,7 +890,7 @@ func getModel(str string) (objectname string, m swagger.Schema, realTypes []stri
|
||||
return
|
||||
}
|
||||
|
||||
func parseObject(d *ast.Object, k string, m *swagger.Schema, realTypes *[]string, astPkgs map[string]*ast.Package, packageName string) {
|
||||
func parseObject(d *ast.Object, k string, m *swagger.Schema, realTypes *[]string, astPkgs []*ast.Package, packageName string) {
|
||||
ts, ok := d.Decl.(*ast.TypeSpec)
|
||||
if !ok {
|
||||
beeLogger.Log.Fatalf("Unknown type without TypeSec: %v\n", d)
|
||||
|
2
vendor/github.com/astaxie/beego/swagger/swagger.go
generated
vendored
2
vendor/github.com/astaxie/beego/swagger/swagger.go
generated
vendored
@ -141,7 +141,7 @@ type Propertie struct {
|
||||
|
||||
// Response as they are returned from executing this operation.
|
||||
type Response struct {
|
||||
Description string `json:"description,omitempty" yaml:"description,omitempty"`
|
||||
Description string `json:"description" yaml:"description"`
|
||||
Schema *Schema `json:"schema,omitempty" yaml:"schema,omitempty"`
|
||||
Ref string `json:"$ref,omitempty" yaml:"$ref,omitempty"`
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user