-
Notifications
You must be signed in to change notification settings - Fork 6k
Open
Description
I want to generate enum with integer values assigned.
Swift:
enum Weather: Int {
case Sunny = 1
case Cloudy = 2
case Rainy = 3
}
Java:
public enum Weather {
Sunny(1),
Cloudy(2),
Rainy(3);
private final int type;
private Weather(final int price) {
this.type = type;
}
public type getType() {
return type;
}
}
But I couldn't figure out how to do this.
In the Swagger 2.0 specs, it references JSON Schema specs for enum
.
It says any type can be used, but it seems like type
needs to be string
for generating enums. Like this:
definitions:
weather:
type: object
required:
- type
properties:
type:
type: string
enum:
- Sunny
- Cloudy
- Rainy
If I change type
to integer
, no enum is generated, and it will be a plain integer property.
Firstly, I couldn't find how to assign integers to enum items using Swagger specs.
Are there any plans or workarounds to support this kind of enum?
rcazangi, anujkumar-df, mbedded, taxpon, Romanchuk and 14 more