-
Notifications
You must be signed in to change notification settings - Fork 9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Body empty and required ignored in POST of simple Boolean #566
Comments
You might instead want the answer from http://localhost:8080//api-docs/default/test to debug |
While there may still be a bug in Swagger-UI, there's also a bug with swagger-springmvc. The name of the field has to be "body" if it is a body parameter. You should probably open an issue on that on swagger-springmvc. Another problem is that you say the operation consumes |
I will file one at swagger-springmvc then, What do you mean by it cant represent boolean? |
You can represent booleans, but they have to be within a structure.
{
"myProperty" : true
} That's a valid json. |
Ok Thanks, didn't think of that. |
As for the required, if you look at the swagger specification you attached, you'll see it says the body parameter is @ApiParam(value = "The value of the boolean to set", required = true) and see if the output changes. |
Thanks again |
When posting just a Boolean in the body, there is no body sent, it is empty! Also the check is not done before sending as it is required (by default), no need to select value in the correct dropdown.
We are running latest UI code and swagger-springmvc 0.8.8
Example code for the service:
import com.wordnik.swagger.annotations.*;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import javax.servlet.http.HttpServletResponse;
@Api(value = "Test",
description = "Set an boolean value",
position = 1)
@RestController
public class BooleanController {
}
The text was updated successfully, but these errors were encountered: