Skip to content

Commit

Permalink
fix: change the condition for checking custom arrayType (#590)
Browse files Browse the repository at this point in the history
  • Loading branch information
sdghchj authored and easonlin404 committed Dec 25, 2019
1 parent 10630b9 commit 73e3f31
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions parser.go
Expand Up @@ -862,7 +862,7 @@ func (parser *Parser) parseStructField(pkgName string, field *ast.Field) (map[st

structField, err := parser.parseField(field)
if err != nil {
return properties, nil, nil
return properties, nil, err
}
if structField.name == "" {
return properties, nil, nil
Expand Down Expand Up @@ -1187,6 +1187,9 @@ func (parser *Parser) parseField(field *ast.Field) (*structField, error) {
if len(parts) >= 2 {
if newSchemaType == "array" {
newArrayType = parts[1]
if err := CheckSchemaType(newArrayType); err != nil {
return nil, err
}
} else if newSchemaType == "primitive" {
newSchemaType = parts[1]
newArrayType = parts[1]
Expand All @@ -1196,9 +1199,7 @@ func (parser *Parser) parseField(field *ast.Field) (*structField, error) {
if err := CheckSchemaType(newSchemaType); err != nil {
return nil, err
}
if err := CheckSchemaType(newArrayType); err != nil {
return nil, err
}

structField.schemaType = newSchemaType
structField.arrayType = newArrayType
}
Expand Down

0 comments on commit 73e3f31

Please sign in to comment.