Commit 4b0fbfe1 authored by mbohlool's avatar mbohlool

bugfix: form parameters should have type in OpenAPI spec

parent 161b4801
...@@ -495,7 +495,7 @@ func (o *openAPI) buildParameter(restParam restful.ParameterData, bodySample int ...@@ -495,7 +495,7 @@ func (o *openAPI) buildParameter(restParam restful.ParameterData, bodySample int
case restful.HeaderParameterKind: case restful.HeaderParameterKind:
ret.In = "header" ret.In = "header"
case restful.FormParameterKind: case restful.FormParameterKind:
ret.In = "form" ret.In = "formData"
default: default:
return ret, fmt.Errorf("unknown restful operation kind : %v", restParam.Kind) return ret, fmt.Errorf("unknown restful operation kind : %v", restParam.Kind)
} }
......
...@@ -187,6 +187,7 @@ func getConfig(fullMethods bool) (*openapi.Config, *restful.Container) { ...@@ -187,6 +187,7 @@ func getConfig(fullMethods bool) (*openapi.Config, *restful.Container) {
InfoProps: spec.InfoProps{ InfoProps: spec.InfoProps{
Title: "TestAPI", Title: "TestAPI",
Description: "Test API", Description: "Test API",
Version: "unversioned",
}, },
}, },
GetDefinitions: func(_ openapi.ReferenceCallback) map[string]openapi.OpenAPIDefinition { GetDefinitions: func(_ openapi.ReferenceCallback) map[string]openapi.OpenAPIDefinition {
...@@ -330,7 +331,7 @@ func getAdditionalTestParameters() []spec.Parameter { ...@@ -330,7 +331,7 @@ func getAdditionalTestParameters() []spec.Parameter {
ParamProps: spec.ParamProps{ ParamProps: spec.ParamProps{
Name: "fparam", Name: "fparam",
Description: "a test form parameter", Description: "a test form parameter",
In: "form", In: "formData",
}, },
SimpleSchema: spec.SimpleSchema{ SimpleSchema: spec.SimpleSchema{
Type: "number", Type: "number",
...@@ -432,6 +433,7 @@ func TestBuildSwaggerSpec(t *testing.T) { ...@@ -432,6 +433,7 @@ func TestBuildSwaggerSpec(t *testing.T) {
InfoProps: spec.InfoProps{ InfoProps: spec.InfoProps{
Title: "TestAPI", Title: "TestAPI",
Description: "Test API", Description: "Test API",
Version: "unversioned",
}, },
}, },
Swagger: "2.0", Swagger: "2.0",
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment