master v1.5.5
Kevin Wan 1 year ago committed by GitHub
parent cb3ffc76a3
commit 14fcbd7658
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -58,7 +58,7 @@ func TestFormat(t *testing.T) {
assert.Nil(t, err) assert.Nil(t, err)
assert.Equal(t, formattedStr, r) assert.Equal(t, formattedStr, r)
_, err = apiFormat(notFormattedStr, false) _, err = apiFormat(notFormattedStr, false)
assert.Errorf(t, err, " line 7:13 can not found declaration 'Student' in context") assert.Errorf(t, err, " line 7:13 can not find declaration 'Student' in context")
} }
func Test_apiFormatReader_issue1721(t *testing.T) { func Test_apiFormatReader_issue1721(t *testing.T) {

@ -420,7 +420,7 @@ func (p *Parser) checkServices(apiItem *Api, types map[string]TypeExpr, linePref
_, ok := types[structName] _, ok := types[structName]
if !ok { if !ok {
return fmt.Errorf("%s line %d:%d can not found declaration '%s' in context", return fmt.Errorf("%s line %d:%d can not find declaration '%s' in context",
linePrefix, route.Reply.Name.Expr().Line(), route.Reply.Name.Expr().Column(), structName) linePrefix, route.Reply.Name.Expr().Line(), route.Reply.Name.Expr().Column(), structName)
} }
} }
@ -433,7 +433,7 @@ func (p *Parser) checkRequestBody(route *Route, types map[string]TypeExpr, lineP
if route.Req != nil && route.Req.Name.IsNotNil() && route.Req.Name.Expr().IsNotNil() { if route.Req != nil && route.Req.Name.IsNotNil() && route.Req.Name.Expr().IsNotNil() {
_, ok := types[route.Req.Name.Expr().Text()] _, ok := types[route.Req.Name.Expr().Text()]
if !ok { if !ok {
return fmt.Errorf("%s line %d:%d can not found declaration '%s' in context", return fmt.Errorf("%s line %d:%d can not find declaration '%s' in context",
linePrefix, route.Req.Name.Expr().Line(), route.Req.Name.Expr().Column(), route.Req.Name.Expr().Text()) linePrefix, route.Req.Name.Expr().Line(), route.Req.Name.Expr().Column(), route.Req.Name.Expr().Text())
} }
} }
@ -470,7 +470,7 @@ func (p *Parser) checkType(linePrefix string, types map[string]TypeExpr, expr Da
} }
_, ok := types[name] _, ok := types[name]
if !ok { if !ok {
return fmt.Errorf("%s line %d:%d can not found declaration '%s' in context", return fmt.Errorf("%s line %d:%d can not find declaration '%s' in context",
linePrefix, v.Literal.Line(), v.Literal.Column(), name) linePrefix, v.Literal.Line(), v.Literal.Column(), name)
} }
@ -481,7 +481,7 @@ func (p *Parser) checkType(linePrefix string, types map[string]TypeExpr, expr Da
} }
_, ok := types[name] _, ok := types[name]
if !ok { if !ok {
return fmt.Errorf("%s line %d:%d can not found declaration '%s' in context", return fmt.Errorf("%s line %d:%d can not find declaration '%s' in context",
linePrefix, v.Name.Line(), v.Name.Column(), name) linePrefix, v.Name.Line(), v.Name.Column(), name)
} }
case *Map: case *Map:

Loading…
Cancel
Save