Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
vendor
glide.lock
goas.exe
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -107,10 +107,10 @@ goas --module-path . --main-file-path ./cmd/xxx/main.go --output oas.json

### Response
```
@Success {stauts} {jsonType} {goType} {description}
@Success {status} {jsonType} {goType} {description}
@Success 200 object UsersResponse "UsersResponse JSON"

@Failure {stauts} {jsonType} {goType} {description}
@Failure {status} {jsonType} {goType} {description}
@Failure 400 object ErrorResponse "ErrorResponse JSON"
```
- {status}: The HTTP status code.
Expand Down
1 change: 1 addition & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,5 @@ require (
github.com/mikunalpha/go-module v0.0.0-20190521120234-12aa2dc244ca
github.com/urfave/cli v1.20.0
github.com/uudashr/go-module v0.0.0-20180827225833-c0ca9c3a4966 // indirect
gopkg.in/urfave/cli.v1 v1.20.0
)
2 changes: 2 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,5 @@ github.com/urfave/cli v1.20.0 h1:fDqGv3UG/4jbVl/QkFwEdddtEDjh/5Ov6X+0B/3bPaw=
github.com/urfave/cli v1.20.0/go.mod h1:70zkFmudgCuE/ngEzBv17Jvp/497gISqfk5gWijbERA=
github.com/uudashr/go-module v0.0.0-20180827225833-c0ca9c3a4966 h1:7dS/ZO0dIwrtj/FGTt9I6urVpx7LEHzucegv4ORYK3M=
github.com/uudashr/go-module v0.0.0-20180827225833-c0ca9c3a4966/go.mod h1:P6Nk1sQWL6jcdBIxnLVlqCsOl0arao7gg7sPoM6gx4A=
gopkg.in/urfave/cli.v1 v1.20.0 h1:NdAVW6RYxDif9DhDHaAortIu956m2c0v+09AZBPTbE0=
gopkg.in/urfave/cli.v1 v1.20.0/go.mod h1:vuBzUtMdQeixQj8LVd+/98pzhxNGQoyuPBlsXHOQNO0=
2 changes: 1 addition & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"log"
"os"

"github.com/urfave/cli"
"gopkg.in/urfave/cli.v1"
)

var version = "v1.0.0"
Expand Down
12 changes: 11 additions & 1 deletion parser.go
Original file line number Diff line number Diff line change
Expand Up @@ -887,7 +887,17 @@ func (p *parser) parseSchemaObject(pkgPath, pkgName, typeName string) (*SchemaOb
if len(typeNameParts) == 1 {
typeSpec, exist = p.getTypeSpec(pkgPath, pkgName, typeName)
if !exist {
log.Fatalf("Can not find definition of %s ast.TypeSpec. Current package %s", typeName, pkgName)
for _, value := range p.KnownNamePkg {
typeSpec, exist = p.getTypeSpec(value.Path, value.Name, typeName)
if exist {
pkgPath = value.Path
pkgName = value.Name
break
}
}
if !exist {
log.Fatalf("Can not find definition of %s ast.TypeSpec. Current package %s", typeName, pkgName)
}
}
schemaObject.PkgName = pkgName
schemaObject.ID = genSchemeaObjectID(pkgName, typeName)
Expand Down