-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
How to add the json request body in swagger ui (for java code, possibly using annotations)? #1383
Comments
Which version of swagger-core do you use? |
I'm using |
Hi if you can, please update to 1.5.3 (yes, no M1 suffix). |
Hmm I was using swagger-core from |
OK, please update your signature with an annotation:
I believe that'll do it. |
is |
It was the predecessor to the io.swagger project. |
I'm using dropwizard-swagger package to work with dropwizard. This package seems to be using |
Got it. Then you can keep the current dependency and sumply add the @ApiParam annotation and all should be fine. There is probably an update to dropwizard swagger, or you can follow the sample in the swagger-samples project. |
👍 I will try and update this ticket later. Thanks |
great, let me know @wakandan |
@fehguy I confirm that in 1.5.3 the form for post body shows up with the use of |
great news, thanks for following up! And yes, perhaps you can reference the PR here for others |
@fehguy federecio/dropwizard-swagger#67 That pr would require this one as well (to resolve version conflicting) federecio/dropwizard-junit#7 |
Slightly off topic, but how would one annotate the method for a purely Servlet project (for input which is a JSON body/model)? Thanks! |
We see only paramType = "query" and GET. Is there any POST sample? Is this https://github.com/swagger-api/swagger-samples/blob/master/java/java-servlet/src/main/java/io/swagger/sample/servlet/SampleServlet.java the right sample? |
Just change those to the values you need. You can use any of the HTTP verbs supported by the spec, same goes for paramType. |
Could you give some example? We don't quite get it and would not like to guess. Thanks! |
Sure, you can use something along the lines of |
If I use @ApiOperation over a servlet doPost Method then the generated JSON file also attaches doPost in the end. Expected URL: "/v1/document/doc1/" Generated JSON file has URL "/v2/document/us_1098/doPost". Why is it attaching function name in the end? |
I had the same problem. I added the annotation |
@diguage u saved my life friend ! <3 |
I had to do this to add a description to the response-body for OpenAPI Specification 3:
|
I'm writing a dropwizard app. I want to have something similar to this
but what I'm having is only this (it doesn't have the json request body text form)
my annotations are like these
How do I make it work like the first picture? Thanks.
The text was updated successfully, but these errors were encountered: