phoenixnap / springmvc-raml-plugin

Spring MVC - RAML Spec Synchroniser Plugin. A Maven plugin designed to Generate Server & Client code in Spring from a RAML API descriptor and conversely, a RAML API document from the SpringMVC Server implementation.
Apache License 2.0
136 stars 84 forks source link

@PathVariable with wrong parameter name #220

Closed JavaChr1s closed 6 years ago

JavaChr1s commented 6 years ago

My raml file generates the following controller method using your plugin: @RequestMapping(value = "/{productId}", method = RequestMethod.GET) public ResponseEntity<Product> getProductById( @PathVariable(name = "productId") String productID) { return this.productControllerDelegate.getProductById(productID); }

Unfortunately the parameter of PathVariable is named value instead of name, so it should be @RequestMapping(value = "/{productId}", method = RequestMethod.GET) public ResponseEntity<Product> getProductById( @PathVariable(value= "productId") String productID) { return this.productControllerDelegate.getProductById(productID); } or even better @RequestMapping(value = "/{productId}", method = RequestMethod.GET) public ResponseEntity<Product> getProductById( @PathVariable("productId") String productID) { return this.productControllerDelegate.getProductById(productID); }

Otherwise it is not compilable.

stojsavljevic commented 6 years ago

Hi @JavaChr1s

Thanks for reaching us.

The problem is with your version of Spring - name is valid attribute but it's introduced in 4.3.3. That's why it doesn't compile for you. But since name is just an alias for value I guess we can switch to value to keep compatibility with older Spring versions.

JavaChr1s commented 6 years ago

Hi @stojsavljevic ,

thanks for your response. That would be great. Can you make any estimation when this change will be available?

stojsavljevic commented 6 years ago

I guess somewhere next week.