Skip to content
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

Spring RequestMapping "path" variable is ignored #162

Closed
ST-DDT opened this issue Oct 24, 2015 · 1 comment
Closed

Spring RequestMapping "path" variable is ignored #162

ST-DDT opened this issue Oct 24, 2015 · 1 comment
Assignees
Labels
bug
Milestone

Comments

@ST-DDT
Copy link

@ST-DDT ST-DDT commented Oct 24, 2015

Spring's RequestMapping anntoation has an alias for value called path that don't get picked up by the documentation generator.

missingpath

@RequestMapping(path = "/register")
public String register() {
    [...]
}

@RequestMapping(path = "/register.do", method = RequestMethod.POST)
public ModelAndView register(...) {
    [...]
}

But it will be shown correctly if I use the value attribute for the mapping.

@RequestMapping(value = "/register")
public String register() {
    [...]
}

@RequestMapping(value = "/register.do", method = RequestMethod.POST)
public ModelAndView register(...) {
    [...]
}

However I prefer using path as it say more about what the param is describing. This becomes more important if you have more attributes on the annotation. The path value is also easier to read during code reviews or when showing the code to other people that might not have that much experience with spring.

@RequestMapping(path = "/version", method = RequestMethod.GET, 
        consumes = {MediaType.APPLICATION_JSON_VALUE, MediaType.APPLICATION_XML_VALUE, ...},
        produces = {MediaType.APPLICATION_JSON_VALUE, MediaType.APPLICATION_XML_VALUE, ...},
        name="Version validation", headers="ext: *")

I use

  • Spring: 4.2.2.RELEASE
<dependency>
    <groupId>org.springframework</groupId>
    <artifactId>spring-webmvc</artifactId>
    <version>4.2.2.RELEASE</version>
    <!-- The Apache Software License, Version 2.0 -->
</dependency>
  • JsonDoc: 1.2.9
<dependency>
    <groupId>org.jsondoc</groupId>
    <artifactId>jsondoc-springmvc</artifactId>
    <version>1.2.9</version>
    <!-- MIT License -->
</dependency>

PS: Thanks for your nice tool + work.

@fabiomaffioletti
Copy link
Owner

@fabiomaffioletti fabiomaffioletti commented Nov 21, 2015

See #171

@fabiomaffioletti fabiomaffioletti added this to the 1.2.12 milestone Apr 14, 2016
@fabiomaffioletti fabiomaffioletti self-assigned this Apr 14, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants
You can’t perform that action at this time.