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
Milestone

Comments

@ST-DDT
Copy link

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

See #171

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants