question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Question/Bug: Path-Parameter should be specified as required when @RequestMapping has multiple paths.

See original GitHub issue

Springfox Swagger version 2.9.2

when Request Mapping has multiple paths like this.

 @ApiOperation(value = "Creates a client application")
 @RequestMapping(method = POST,
        value = {
            "path1",
            "path2/{optionalSamplePathParam}/path"
        },
        produces = APPLICATION_JSON_VALUE)
public Response someControllerMethod(@PathVariable optionalSamplePathParam, @RequestBody someObject)
{
//some code within ApiOperation
}

Swagger UI though shows 2 different listing for each of the path, it still shows SamplePathParam in listing of “path1” where it is not applicable, It should ideally not show that at all.

What is the solution or work-around for this?

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:6 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
dilipkrishcommented, Aug 28, 2018

No there isnt unfortunately. Not to say that it wont be fixed, but at the moment that is the level of support that we have for multiple request mapping paths

0reactions
stale[bot]commented, Oct 9, 2020

This issue has been automatically closed because it has not had recent activity. Please re-open a new issue if this is still an issue.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to use multiple @RequestMapping annotations in spring?
@RequestMapping has a String[] value parameter, so you should be able to specify multiple values like this: @RequestMapping(value={"", "/" ...
Read more >
Spring @RequestMapping - Baeldung
Multiple @PathVariable. A more complex URI may need to map multiple parts of the URI to multiple values: @RequestMapping(value ...
Read more >
Spring MVC @RequestMapping Annotation Example with ...
RequestMapping annotation is used to map web requests onto specific handler classes and/or handler methods. Spring @RequestMapping @RequestParam ...
Read more >
Using the Spring @RequestMapping Annotation - DZone
You can have multiple request mappings for a method. For that add one @RequestMapping annotation with a list of values.
Read more >
RequestMapping and @PathVariable Annotations - Code by ...
This annotation can be applied at the class or method level. It maps a specific request path or pattern onto a controller. If...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found