Skip to content

Commit

Permalink
fix: unnecessary type field in parameter body schema
Browse files Browse the repository at this point in the history
  • Loading branch information
ubogdan authored and easonlin404 committed Oct 19, 2019
1 parent 008c37b commit 6567f07
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 7 deletions.
4 changes: 2 additions & 2 deletions operation.go
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ func (operation *Operation) ParseParamComment(commentLine string, astFile *ast.F
SchemaProps: spec.SchemaProps{},
},
}
// Arrau of Primitive or Object
// Array of Primitive or Object
if IsPrimitiveType(refType) {
param.Schema.Items.Schema.Type = spec.StringOrArray{refType}
} else {
Expand All @@ -199,7 +199,7 @@ func (operation *Operation) ParseParamComment(commentLine string, astFile *ast.F
if err := operation.registerSchemaType(refType, astFile); err != nil {
return err
}
param.Schema.Type = spec.StringOrArray{objectType}
param.Schema.Type = []string{}
param.Schema.Ref = spec.Ref{
Ref: jsonreference.MustCreateRef("#/definitions/" + refType),
}
Expand Down
1 change: 0 additions & 1 deletion operation_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -468,7 +468,6 @@ func TestParseParamCommentByBodyType(t *testing.T) {
"in": "body",
"required": true,
"schema": {
"type": "object",
"$ref": "#/definitions/model.OrderRow"
}
}
Expand Down
4 changes: 0 additions & 4 deletions parser_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -378,7 +378,6 @@ func TestParseSimpleApi1(t *testing.T) {
"in": "body",
"required": true,
"schema": {
"type": "object",
"$ref": "#/definitions/web.Pet"
}
}
Expand Down Expand Up @@ -1006,7 +1005,6 @@ func TestParseSimpleApi_ForSnakecase(t *testing.T) {
"in": "body",
"required": true,
"schema": {
"type": "object",
"$ref": "#/definitions/web.Pet"
}
}
Expand Down Expand Up @@ -1490,7 +1488,6 @@ func TestParseSimpleApi_ForLowerCamelcase(t *testing.T) {
"in": "body",
"required": true,
"schema": {
"type": "object",
"$ref": "#/definitions/web.Pet"
}
}
Expand Down Expand Up @@ -2046,7 +2043,6 @@ func TestParseModelNotUnderRoot(t *testing.T) {
"in": "body",
"required": true,
"schema": {
"type": "object",
"$ref": "#/definitions/data.Foo"
}
}
Expand Down

0 comments on commit 6567f07

Please sign in to comment.