Closed techpavan closed 5 years ago
Hi @techpavan
so you have Bus
object defined like this:
type: object
properties:
metadata:
type: array
items:
enum: [ac, multi-axle, reading-light, sleeper]
why don't you define separate enum object like this:
MyEnum:
type: string
enum: [ac, multi-axle, reading-light, sleeper]
and use it like this in Bus
declaration:
type: object
properties:
metadata:
type: array
items: MyEnum
That way you'll get MyEnum.java
generated.
I can set some default name in case like yours. But defining separate enum is better way forward IMHO.
DefaultEnum
is default name that will be set in situations like this.
Haven't tested it, but I sense a problem. When multiple such enums exist, I guess all of them will co-exist in the same DefaultEnum
class as it is happening in String
. Is it so? Any workarounds?
The fix was only regarding enum name.
Implementing this kind of check would be cumbersome and we wouldn't get much. Just define separate data types in raml and there will be no problems like this.
Sure, will account that. Its definitely cumbersome if the plugin tries to come up with its own names, but if RAML supports some metadata (like we have displayName for methods) and plugin can take a hint using that, it would be cleaner.
I have a project where RAML defines some parameters that accept a string array whose values are confined in an enum. When code is generated for this API, it generates a class String.java which adds confusion during development.
Below is the link to reproducer. https://github.com/techpavan/springmvc-raml-plugin-issues/tree/master/1