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;
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
add a comment |
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
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
add a comment |
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
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
java spring spring-boot swagger swagger-ui
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
add a comment |
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
add a comment |
1 Answer
1
active
oldest
votes
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
welp unfortunate. Good to know, thanks :)
– Hayden Meloche
Mar 27 at 13:22
add a comment |
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
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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
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
welp unfortunate. Good to know, thanks :)
– Hayden Meloche
Mar 27 at 13:22
add a comment |
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
welp unfortunate. Good to know, thanks :)
– Hayden Meloche
Mar 27 at 13:22
add a comment |
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
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
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
add a comment |
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
add a comment |
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.
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.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
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
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