Manually specify POST request body in spring boot swaggerHow to configure port for a Spring Boot applicationHow to write swagger API that accepts XML in request bodySwagger Example Post Body From AnnotationsUnmarshalling query params into object using Swagger/Springfox and Spring BootSupporting two different request bodies at the same endpointHow to DRY when using Swagger UI and the ApiResponses annotations with Java Spring endpoints?Swagger-generated Spring controller recievs NULLs in the body parameter of POSTIs it possible to configure swagger and swaggerUI as separate module in multi module spring boot project?java swagger example String post bodyHow to create a custom POST request-body in SwaggerUI

Is it possible to split a vertex?

Found and corrected a mistake on someone's else paper -- praxis?

GDPR rights when subject dies; does family inherit subject rights?

Is there any reason why MCU changed the Snap to Blip

What's the point of having a RAID 1 configuration over incremental backups to a secondary drive?

Could you brine steak?

Did the Ottoman empire suppress the printing press?

Why would people still be chanting "Lock her up" at Trump rallies in 2019?

Yet another hash table in C

Should I include code in my research paper?

Through: how to use it with subtraction of functions?

How do native German speakers usually express skepticism (using even) about a premise?

Are there any sports for which the world's best player is female?

What is the correct parsing of お高くとまる?

Is this a reference to the film Alien in the novel 2010 Odyssey Two?

What are the indigenous English words for a prostitute?

Why different specifications for telescopes and binoculars?

Given a 32 bit number, what is an efficient way to scale each byte by a certain factor?

What is a "Lear Processor" and how did it work?

Write a function

A horrible Stockfish chess engine evaluation

Integer Lists of Noah

Is there a nice way to implement a conditional type with default fail case?

Is there a minimum field size for peah to apply?



Manually specify POST request body in spring boot swagger


How to configure port for a Spring Boot applicationHow to write swagger API that accepts XML in request bodySwagger Example Post Body From AnnotationsUnmarshalling query params into object using Swagger/Springfox and Spring BootSupporting two different request bodies at the same endpointHow to DRY when using Swagger UI and the ApiResponses annotations with Java Spring endpoints?Swagger-generated Spring controller recievs NULLs in the body parameter of POSTIs it possible to configure swagger and swaggerUI as separate module in multi module spring boot project?java swagger example String post bodyHow to create a custom POST request-body in SwaggerUI






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;








0















I wrote the piece of code below:



@PostMapping(path = "/process", produces = MediaType.APPLICATION_JSON_VALUE)
@ApiOperation(value = "Get process with given ID", produces = MediaType.APPLICATION_JSON_VALUE,
response = ProcessType.class)
public ResponseEntity<ProcessType> createProcessType(
@RequestBody
@DTO(ProcessTypeDto.class) ProcessType processType
)
log.info("POST called on /process");

ProcessType processTypeResult;
...
...



which works great. But my problem is with swagger. I made a custom annotation @DTO which automatically maps one class to another. But, swagger sees my ProcessType request body and shows examples in the UI of that class rather than ProcessTypeDto. If I delete what swagger shows and POST ProcessTypeDto the code works I would just like swagger to show ProcessTypeDto as the default example for this endpoint as it would break codegen.



Is there a way to manually specify what request body I would like from swaggers POV overriding what my@Requestbody is?










share|improve this question






















  • Do any of the Swagger annotations (github.com/swagger-api/swagger-core/wiki/Annotations-1.5.X) help? @ApiParam, @ApiImplicitParam?

    – Not a JD
    Mar 26 at 0:39

















0















I wrote the piece of code below:



@PostMapping(path = "/process", produces = MediaType.APPLICATION_JSON_VALUE)
@ApiOperation(value = "Get process with given ID", produces = MediaType.APPLICATION_JSON_VALUE,
response = ProcessType.class)
public ResponseEntity<ProcessType> createProcessType(
@RequestBody
@DTO(ProcessTypeDto.class) ProcessType processType
)
log.info("POST called on /process");

ProcessType processTypeResult;
...
...



which works great. But my problem is with swagger. I made a custom annotation @DTO which automatically maps one class to another. But, swagger sees my ProcessType request body and shows examples in the UI of that class rather than ProcessTypeDto. If I delete what swagger shows and POST ProcessTypeDto the code works I would just like swagger to show ProcessTypeDto as the default example for this endpoint as it would break codegen.



Is there a way to manually specify what request body I would like from swaggers POV overriding what my@Requestbody is?










share|improve this question






















  • Do any of the Swagger annotations (github.com/swagger-api/swagger-core/wiki/Annotations-1.5.X) help? @ApiParam, @ApiImplicitParam?

    – Not a JD
    Mar 26 at 0:39













0












0








0








I wrote the piece of code below:



@PostMapping(path = "/process", produces = MediaType.APPLICATION_JSON_VALUE)
@ApiOperation(value = "Get process with given ID", produces = MediaType.APPLICATION_JSON_VALUE,
response = ProcessType.class)
public ResponseEntity<ProcessType> createProcessType(
@RequestBody
@DTO(ProcessTypeDto.class) ProcessType processType
)
log.info("POST called on /process");

ProcessType processTypeResult;
...
...



which works great. But my problem is with swagger. I made a custom annotation @DTO which automatically maps one class to another. But, swagger sees my ProcessType request body and shows examples in the UI of that class rather than ProcessTypeDto. If I delete what swagger shows and POST ProcessTypeDto the code works I would just like swagger to show ProcessTypeDto as the default example for this endpoint as it would break codegen.



Is there a way to manually specify what request body I would like from swaggers POV overriding what my@Requestbody is?










share|improve this question














I wrote the piece of code below:



@PostMapping(path = "/process", produces = MediaType.APPLICATION_JSON_VALUE)
@ApiOperation(value = "Get process with given ID", produces = MediaType.APPLICATION_JSON_VALUE,
response = ProcessType.class)
public ResponseEntity<ProcessType> createProcessType(
@RequestBody
@DTO(ProcessTypeDto.class) ProcessType processType
)
log.info("POST called on /process");

ProcessType processTypeResult;
...
...



which works great. But my problem is with swagger. I made a custom annotation @DTO which automatically maps one class to another. But, swagger sees my ProcessType request body and shows examples in the UI of that class rather than ProcessTypeDto. If I delete what swagger shows and POST ProcessTypeDto the code works I would just like swagger to show ProcessTypeDto as the default example for this endpoint as it would break codegen.



Is there a way to manually specify what request body I would like from swaggers POV overriding what my@Requestbody is?







java spring spring-boot swagger swagger-ui






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Mar 26 at 0:32









Hayden MelocheHayden Meloche

851 silver badge6 bronze badges




851 silver badge6 bronze badges












  • Do any of the Swagger annotations (github.com/swagger-api/swagger-core/wiki/Annotations-1.5.X) help? @ApiParam, @ApiImplicitParam?

    – Not a JD
    Mar 26 at 0:39

















  • Do any of the Swagger annotations (github.com/swagger-api/swagger-core/wiki/Annotations-1.5.X) help? @ApiParam, @ApiImplicitParam?

    – Not a JD
    Mar 26 at 0:39
















Do any of the Swagger annotations (github.com/swagger-api/swagger-core/wiki/Annotations-1.5.X) help? @ApiParam, @ApiImplicitParam?

– Not a JD
Mar 26 at 0:39





Do any of the Swagger annotations (github.com/swagger-api/swagger-core/wiki/Annotations-1.5.X) help? @ApiParam, @ApiImplicitParam?

– Not a JD
Mar 26 at 0:39












1 Answer
1






active

oldest

votes


















1














looks like you are not lucky so far, it will be released in version 2.0



here is what you are lookin for https://github.com/swagger-api/swagger-core/wiki/Swagger-2.X---Annotations#requestbody



or at least you can start using a release candidate
https://mvnrepository.com/artifact/io.swagger/swagger-core






share|improve this answer























  • welp unfortunate. Good to know, thanks :)

    – Hayden Meloche
    Mar 27 at 13:22










Your Answer






StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");

StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);













draft saved

draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55348260%2fmanually-specify-post-request-body-in-spring-boot-swagger%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown

























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes









1














looks like you are not lucky so far, it will be released in version 2.0



here is what you are lookin for https://github.com/swagger-api/swagger-core/wiki/Swagger-2.X---Annotations#requestbody



or at least you can start using a release candidate
https://mvnrepository.com/artifact/io.swagger/swagger-core






share|improve this answer























  • welp unfortunate. Good to know, thanks :)

    – Hayden Meloche
    Mar 27 at 13:22















1














looks like you are not lucky so far, it will be released in version 2.0



here is what you are lookin for https://github.com/swagger-api/swagger-core/wiki/Swagger-2.X---Annotations#requestbody



or at least you can start using a release candidate
https://mvnrepository.com/artifact/io.swagger/swagger-core






share|improve this answer























  • welp unfortunate. Good to know, thanks :)

    – Hayden Meloche
    Mar 27 at 13:22













1












1








1







looks like you are not lucky so far, it will be released in version 2.0



here is what you are lookin for https://github.com/swagger-api/swagger-core/wiki/Swagger-2.X---Annotations#requestbody



or at least you can start using a release candidate
https://mvnrepository.com/artifact/io.swagger/swagger-core






share|improve this answer













looks like you are not lucky so far, it will be released in version 2.0



here is what you are lookin for https://github.com/swagger-api/swagger-core/wiki/Swagger-2.X---Annotations#requestbody



or at least you can start using a release candidate
https://mvnrepository.com/artifact/io.swagger/swagger-core







share|improve this answer












share|improve this answer



share|improve this answer










answered Mar 26 at 4:12









IevgenIevgen

7074 silver badges11 bronze badges




7074 silver badges11 bronze badges












  • welp unfortunate. Good to know, thanks :)

    – Hayden Meloche
    Mar 27 at 13:22

















  • welp unfortunate. Good to know, thanks :)

    – Hayden Meloche
    Mar 27 at 13:22
















welp unfortunate. Good to know, thanks :)

– Hayden Meloche
Mar 27 at 13:22





welp unfortunate. Good to know, thanks :)

– Hayden Meloche
Mar 27 at 13:22








Got a question that you can’t ask on public Stack Overflow? Learn more about sharing private information with Stack Overflow for Teams.







Got a question that you can’t ask on public Stack Overflow? Learn more about sharing private information with Stack Overflow for Teams.



















draft saved

draft discarded
















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid …


  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55348260%2fmanually-specify-post-request-body-in-spring-boot-swagger%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

How to preserve electronics (computers, tablets and phones) for hundreds of years Announcing the arrival of Valued Associate #679: Cesar Manara Planned maintenance scheduled April 23, 2019 at 23:30 UTC (7:30pm US/Eastern) The network's official Twitter account is up and running again. What content…How might modern humans leave a message for 50,000 years?How would an aquatic race develop computers?How do we make computers care for human life?Keeping supplies for 1000 yearsWhat will cell phones become in 100 years?What body armor protects against a laser?Could a society attain 1800s technology if limited to using copper and bronze?Electricity power (magic) and electronicsScavenging metal resources in post-apocalypse after 100 yearsWhy would precursors create devices that can survive and still work after hundreds of years?

155 수학 과학 기타 둘러보기 메뉴eh추가해eh문서를 완성해

Convert JSON to MapSimplest way to convert a string representing JSON array into Java array List of key value pairsHow to take String JSON values into HashMapConvert a JSON String to a HashMapCreating BSON object from JSON stringJSONObject - How to get a value ?Better Map ConstructorReading JSON from Url javaUpdate columns if input values are not null otherwise ignore and keep the existing values of column in databaseHow to store object represented as Json string into Couchbase Lite?Go JSON into MapHow do I efficiently iterate over each entry in a Java Map?Sort a Map<Key, Value> by valuesHow to round a number to n decimal places in JavaCan comments be used in JSON?How do I read / convert an InputStream into a String in Java?How can I pretty-print JSON in a shell script?What is the correct JSON content type?How can I deserialize JSON to a simple Dictionary<string,string> in ASP.NET?Why does Google prepend while(1); to their JSON responses?Parse JSON in JavaScript?