@@ -773,7 +773,7 @@ func TestOperation_ParseParamCommentV3(t *testing.T) {
773773
774774 t .Run ("integer" , func (t * testing.T ) {
775775 t .Parallel ()
776- for _ , paramType := range []string {"header" , "path" , "query" , "formData" } {
776+ for _ , paramType := range []string {"header" , "path" , "query" } {
777777 t .Run (paramType , func (t * testing.T ) {
778778 o := NewOperationV3 (New ())
779779 err := o .ParseComment (`@Param some_id ` + paramType + ` int true "Some ID"` , nil )
@@ -808,7 +808,7 @@ func TestOperation_ParseParamCommentV3(t *testing.T) {
808808
809809 t .Run ("string" , func (t * testing.T ) {
810810 t .Parallel ()
811- for _ , paramType := range []string {"header" , "path" , "query" , "formData" } {
811+ for _ , paramType := range []string {"header" , "path" , "query" } {
812812 t .Run (paramType , func (t * testing.T ) {
813813 o := NewOperationV3 (New ())
814814 err := o .ParseComment (`@Param some_string ` + paramType + ` string true "Some String"` , nil )
@@ -842,7 +842,7 @@ func TestOperation_ParseParamCommentV3(t *testing.T) {
842842
843843 t .Run ("object" , func (t * testing.T ) {
844844 t .Parallel ()
845- for _ , paramType := range []string {"header" , "path" , "query" , "formData" } {
845+ for _ , paramType := range []string {"header" , "path" , "query" } {
846846 t .Run (paramType , func (t * testing.T ) {
847847 assert .Error (t ,
848848 NewOperationV3 (New ()).
@@ -1108,18 +1108,17 @@ func TestParseParamCommentByFormDataTypeV3(t *testing.T) {
11081108 err := operation .ParseComment (comment , nil )
11091109 assert .NoError (t , err )
11101110
1111- assert .Len (t , operation .Parameters , 1 )
1111+ assert .Len (t , operation .Parameters , 0 )
1112+ assert .NotNil (t , operation .RequestBody )
11121113
1113- parameters := operation .Operation .Parameters
1114- assert .NotNil (t , parameters )
1114+ requestBody := operation .RequestBody
1115+ assert .True (t , requestBody .Spec .Spec .Required )
1116+ assert .Equal (t , "this is a test file" , requestBody .Spec .Spec .Description )
1117+ assert .NotNil (t , requestBody )
11151118
1116- parameterSpec := parameters [0 ].Spec .Spec
1117- assert .NotNil (t , parameterSpec )
1118- assert .Equal (t , "this is a test file" , parameterSpec .Description )
1119- assert .Equal (t , "file" , parameterSpec .Name )
1120- assert .True (t , parameterSpec .Required )
1121- assert .Equal (t , "formData" , parameterSpec .In )
1122- assert .Equal (t , typeFile , parameterSpec .Schema .Spec .Type )
1119+ requestBodySpec := requestBody .Spec .Spec
1120+ assert .NotNil (t , requestBodySpec )
1121+ assert .Equal (t , typeFile , requestBodySpec .Content ["application/x-www-form-urlencoded" ].Spec .Schema .Spec .Type )
11231122}
11241123
11251124func TestParseParamCommentByFormDataTypeUint64V3 (t * testing.T ) {
@@ -1131,18 +1130,15 @@ func TestParseParamCommentByFormDataTypeUint64V3(t *testing.T) {
11311130 err := operation .ParseComment (comment , nil )
11321131 assert .NoError (t , err )
11331132
1134- assert .Len (t , operation .Parameters , 1 )
1133+ assert .Len (t , operation .Parameters , 0 )
11351134
1136- parameters := operation .Operation .Parameters
1137- assert .NotNil (t , parameters )
1135+ requestBody := operation .RequestBody
1136+ assert .NotNil (t , requestBody )
1137+ assert .Equal (t , "this is a test file" , requestBody .Spec .Spec .Description )
11381138
1139- parameterSpec := parameters [0 ].Spec .Spec
1140- assert .NotNil (t , parameterSpec )
1141- assert .Equal (t , "this is a test file" , parameterSpec .Description )
1142- assert .Equal (t , "file" , parameterSpec .Name )
1143- assert .True (t , parameterSpec .Required )
1144- assert .Equal (t , "formData" , parameterSpec .In )
1145- assert .Equal (t , typeInteger , parameterSpec .Schema .Spec .Type )
1139+ requestBodySpec := requestBody .Spec .Spec .Content ["application/x-www-form-urlencoded" ].Spec
1140+ assert .NotNil (t , requestBodySpec )
1141+ assert .Equal (t , typeInteger , requestBodySpec .Schema .Spec .Type )
11461142}
11471143
11481144func TestParseParamCommentByNotSupportedTypeV3 (t * testing.T ) {
0 commit comments