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

Query parameter enums are generated as Strings #292

Closed stojsavljevic closed 5 years ago

stojsavljevic commented 5 years ago

raml like this:

#%RAML 1.0
title: Query parameter enums are generated as Strings #291

/bus:
  get:
    queryParameters:
      brandName:
        type: string
        enum: [Volvo, Scania]

will generated method where brandName is a String. BrandName enum will be generated but not referenced.

If brandName is a data type enum will be referenced as it should be.

stojsavljevic commented 5 years ago

It seems that enum as @RequestParam is not handled well in Spring. E.g. if enum contains 2 constants like this:

public enum Test{
   A("a"), B("b")
   ...
}

request param value will have to match to constant name instead of constant value (in this example request param value has to be upper case). Some binder has to be added to controller but this is too cumbersome to support.

stojsavljevic commented 5 years ago

Despite limitation explained above I'll fix: