swagger-api/swagger-codegen

Swagger generated code now silently ignores invalid values for enumerated types

Open

#4.119 aberto em 3 de nov. de 2016

Ver no GitHub
 (3 comments) (0 reactions) (0 assignees)HTML (5.474 forks)batch import
Client: JavaFeature: EnumServer: Javahelp wanted

Métricas do repositório

Stars
 (12.701 stars)
Métricas de merge de PR
 (Nenhuma PRs mesclada em 30d)

Description

Description

Swagger generated code now silently ignores invalid values for enumerated types.

We used to have 400 exception which was perfect: HTTP/1.1 400 Bad Request X-Powered-By: Servlet/3.0 Access-Control-Allow-Origin: * Access-Control-Allow-Methods: GET, POST, DELETE, PUT Access-Control-Allow-Headers: Content-Type Content-Length: 533 Content-Type: text/plain Content-Language: en-AU Connection: Close Date: Thu, 03 Nov 2016 05:38:45 GMT

The supplied JSON was not well formed: Can not construct instance of.....

Swagger-codegen version

2.2.2-SNAPSHOT

Command line used for generation

Java, Jersey 2, jaxrs

Steps to reproduce

that code is the issue I think. @JsonCreator public static XXXEnum fromValue(String text) { for (XXXEnum b : XXXEnum.values()) { if (String.valueOf(b.value).equals(text)) { return b; } } return null; }

Suggest a Fix

I think this is a key functionality that cannot be changed. Several projects relying on that validation Please revert the changes.

Guia do colaborador