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

Kamusi Yaliyomo Aina za kamusi | Muundo wa kamusi | Faida za kamusi | Dhima ya picha katika kamusi | Marejeo | Tazama pia | Viungo vya nje | UrambazajiKuhusu kamusiGo-SwahiliWiki-KamusiKamusi ya Kiswahili na Kiingerezakuihariri na kuongeza habari

Swift 4 - func physicsWorld not invoked on collision? The Next CEO of Stack OverflowHow to call Objective-C code from Swift#ifdef replacement in the Swift language@selector() in Swift?#pragma mark in Swift?Swift for loop: for index, element in array?dispatch_after - GCD in Swift?Swift Beta performance: sorting arraysSplit a String into an array in Swift?The use of Swift 3 @objc inference in Swift 4 mode is deprecated?How to optimize UITableViewCell, because my UITableView lags

Access current req object everywhere in Node.js ExpressWhy are global variables considered bad practice? (node.js)Using req & res across functionsHow do I get the path to the current script with Node.js?What is Node.js' Connect, Express and “middleware”?Node.js w/ express error handling in callbackHow to access the GET parameters after “?” in Express?Modify Node.js req object parametersAccess “app” variable inside of ExpressJS/ConnectJS middleware?Node.js Express app - request objectAngular Http Module considered middleware?Session variables in ExpressJSAdd properties to the req object in expressjs with Typescript