ContributionsMost RecentMost LikesSolutionsRe: How to suppress requestBody generation in OpenAPI spec using swagger-maven-plugin OK. Any plans to add Servlet support to the 2.x version as that capability apparently got dropped from 1.x to 2.x? Given it was already implemented before, I'm hoping it wouldn't be that hard. But I could be very wrong on that. Re: How to suppress requestBody generation in OpenAPI spec using swagger-maven-plugin A question related to your comment: ""plain" servlets are not supported in 2.x version of swagger-core, as they are in 1.x version." Is 1.x of swagger-core going to be updated so you can (optionally?) use it on plain servlets to generate a openapi v3.0 compatible spec? I see that the 1.x branch is still being maintained. Given that it is, seems like having the ability to generate a 3.0 compatible spec in that branch would be desireable. Esp. for someone like me trying to generate openapi docs for old code. Re: How to suppress requestBody generation in OpenAPI spec using swagger-maven-plugin This solution suppresses requestBody generation, but only if you specify @Parameter(hidden = true) for both the request and response parameters. Re: How to suppress requestBody generation in OpenAPI spec using swagger-maven-plugin OK. That worked. It never occurred to me that I would have to 'hide' the response parameter in order to suppress generation of a requestBody, but after hiding that parameter too, the requestBody was not being generated anymore. Thanks for your help. Re: How to suppress requestBody generation in OpenAPI spec using swagger-maven-plugin I'm trying to suppress the entire requireBody, not just the 'request' parameter. Using: @Parameter(hidden = true) HttpServletRequest request , doesn't work. As it generates this: requestBody: content: '*/*': schema: type: object properties: status: type: integer format: int32 headerNames: type: array items: type: string writer: type: object contentType: LOTS more ... The closest thing I can come up with is adding this to the @Operation block: requestBody = @RequestBody( required = false, content = @Content( )) But it still generates this: requestBody: content: '*/*': {} And I need it to omit the requestBody element entirely. What do you suggest at this point? Re: How to suppress requestBody generation in OpenAPI spec using swagger-maven-plugin In the case of a normal GET request there is NO requestBody at all. I see how you can create a custom requestBody, per your comment: "you can add annotations (swagger-core 2.x ones) to specify parameters, request bodies and responses yourself defining exactly what you need (see swagger-core wiki and swagger-samples branch `2.0`)". But I see no way to completely suppress it. That's what I'm asking, how do you use swagger-core 2.0 annotations to completely supporess the requestBody. If there isn't any way to do that, maybe create a new feature request? swagger-core annotations required to specify HTTP requestBody form parameters? This is related to my other question today: https://community.smartbear.com/t5/Swagger-Open-Source-Tools/How-to-suppress-requestBody-generation-in-OpenAPI-spec-using/m-p/203314#M1192. I’m trying to now figure out how to use swagger-core annotations to specify requestBody form parameters. What I want to generate is described here: https://swagger.io/docs/specification/describing-request-body/ in the section “Form Data”. I specifically want to generate the .yaml described in the box under: “In OpenAPI 3.0, form data is modelled using a type: object schema where the object properties represent the form fields:” Here is my relevant swagger-core annotated code: @Path("/Test00020") public class Test00020 extends HttpServlet { @Override @POST @Operation ( summary = "Ask something, get something back.", requestBody = @RequestBody( description = "Form POST parameters in request body", required = true, content = @Content( schema = @Schema(implementation = Object.class, name = "Test00020" )))) @Consumes(MediaType.APPLICATION_FORM_URLENCODED) @Produces(MediaType.TEXT_HTML) public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { ... which results in this .yaml: paths: /Test00020: post: summary: Ask something, get something back. operationId: doPost requestBody: description: Form POST parameters in request body content: application/x-www-form-urlencoded: schema: type: object. <-- Good up to here, but properties: block missing (see below) required: true responses: default: description: default response content: text/html: {} This is pretty close, but it is missing the parameter name and type param properties in the request body schema: properties: Test00020: # <!--- form field name type: string I couldn’t find any example of how to actually do this, and my trial and error got me this far. The name = "Test00020" element of the Content Schema is being ignored. Any clue how I fix my annotations to get it to work properly? How to suppress requestBody generation in OpenAPI spec using swagger-maven-plugin I'm using the swagger-maven-plugin in a Java application with an old school servlet implementation. I'm trying to follow the examples here: https://github.com/swagger-api/swagger-samples/, but unfortunately this one: https://github.com/swagger-api/swagger-samples/blob/master/java/java-servlet/src/main/java/io/swagger/sample/servlet/SampleServlet.java which is the closest match, uses the 1.x version of swagger.core, not 2.x. I found other examples that sort of work (see what I did below), except that it generates an almost 950 line requestBody element in the openapi.yaml doc for this endpoint. Why does it do that? Is there a way to suppress that? Below is the maven import and the code snippet: <groupId>io.swagger.core.v3</groupId> <artifactId>swagger-maven-plugin</artifactId> <version>2.1.2</version> The code with annotations is: @Path("/Test00020") public class Test00020 extends HttpServlet { @Override @GET @Operation ( summary = "Ask something, get something back.", parameters = { @Parameter(in = ParameterIn.QUERY, name="TestParam00020", required = true ) } ) public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { ... Thanks, Dave Solved