Swagger generated code now silently ignores invalid values for enumerated types
#4119 aperta il 3 nov 2016
Metriche repository
- Star
- (12.701 star)
- Metriche merge PR
- (Nessuna PR mergiata in 30 g)
Descrizione
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.