Hello,

I have found out, that the response does not contain null for enums values, 
but it contains the name of the enum constant (value in upper case) instead 
of the string defined for the enum constant (lower case). And the client 
side code (also generated) tries to find the enum constant matching the 
enum string (the client side expects the lower case string). For sure, I 
could change the enum constants into lower case.  But I hope it is only a 
quick and dirty workaround and there exists other possibilities.

Am Freitag, 8. September 2017 16:40:22 UTC+2 schrieb Philipp:
>
> Hello at all,
>
> I have a *swagger.yaml* where I also define some enums, like this:
>
> type: object
>     properties:
>       id:
>         type: integer
>       status:
>         type: string
>         enum:
>           - started
>           - finished
>
>
> With that definiiton I generate server code for JAX RS and the Swagger 
> enum is generated as a Java enum:
>
> public enum StatusEnum {
>     STARTED("started"),
>     FINISHED("finished")
>
>     private String value;
>
>     StatusEnum(String value) {
>         this.value = value;
>     }
>
>     @Override
>     public String toString() {
>         return String.valueOf(value);
>     }
> }
>
>
> But when I use such an enum the field *status* in the response object is 
> always null. What is the problem? Do I have to "configure" something that 
> Swagger/JAX RS knows what to do with the enum value? Why it is not done by 
> the generator?
>
> I have also another question which could be the same. During generation I 
> use the option *--type-mappings Date=MyDate*. How Swagger/JAX RS knows 
> how to handle *MyDate*? In the generated code I can't find anything about 
> it. Only in the generated api and model classes there is *MyDate* instaed 
> of *Date*. But that's it. And it does not work also.
>
> Kind regards.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Swagger" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to