Forum Discussion
frantuma
Staff
6 years agoAs mentioned in my reply to your other question, swagger-core 2.x reader targets JAX-RS and its implementations: a typical APPLICATION_FORM_URLENCODED endpoint would be implemented e.g. in Jersey like this one processed as this test
However your approach is almost right (using @RequestBody with @Content and @Schema) but adding schema properties via annotation is not (yet) supported. You have 2 options
1. create a class representing your schema with properties, and use that in the `implementation` field, like:
class Test00020RequestBody {
public String Test00020;
}
@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 =Test00020RequestBody.class))))
@Consumes(MediaType.APPLICATION_FORM_URLENCODED)
@Produces(MediaType.TEXT_HTML)
public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { ...
or use a filter to programmatically define exactly what you need