Skip to content

Commit

Permalink
fix: body object without package name in param comments use default p…
Browse files Browse the repository at this point in the history
…ackage name (#591)
  • Loading branch information
sdghchj authored and easonlin404 committed Dec 29, 2019
1 parent bef48a6 commit 549622f
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions operation.go
Original file line number Diff line number Diff line change
Expand Up @@ -191,12 +191,18 @@ func (operation *Operation) ParseParamComment(commentLine string, astFile *ast.F
if IsPrimitiveType(refType) {
param.Schema.Items.Schema.Type = spec.StringOrArray{refType}
} else {
if !strings.Contains(refType, ".") {
refType = astFile.Name.String() + "." + refType
}
if err := operation.registerSchemaType(refType, astFile); err != nil {
return err
}
param.Schema.Items.Schema.Ref = spec.Ref{Ref: jsonreference.MustCreateRef("#/definitions/" + refType)}
}
case "object":
if !strings.Contains(refType, ".") {
refType = astFile.Name.String() + "." + refType
}
if err := operation.registerSchemaType(refType, astFile); err != nil {
return err
}
Expand Down

0 comments on commit 549622f

Please sign in to comment.