mirror of
https://github.com/OpenAPITools/openapi-generator.git
synced 2025-12-03 08:46:55 +00:00
[BUG] [Java] Remove deprecation and serial warnings in ApiException.java and JSON.java (#17716)
* Add serialVersionUID to Java apiException.mustache templates * Use 'enable()' and 'disable()' methods to handle object mapper features in JSON.mustache for the "native" Java generator instead of the deprecated 'configure()' * Update samples
This commit is contained in:
committed by
GitHub
parent
0a0428b89c
commit
a092bbd83b
@@ -17,6 +17,8 @@ import java.net.http.HttpHeaders;
|
||||
|
||||
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen")
|
||||
public class ApiException extends Exception {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private int code = 0;
|
||||
private HttpHeaders responseHeaders = null;
|
||||
private String responseBody = null;
|
||||
|
||||
@@ -20,9 +20,9 @@ public class JSON {
|
||||
public JSON() {
|
||||
mapper = JsonMapper.builder()
|
||||
.serializationInclusion(JsonInclude.Include.NON_NULL)
|
||||
.configure(MapperFeature.ALLOW_COERCION_OF_SCALARS, false)
|
||||
.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, true)
|
||||
.configure(DeserializationFeature.FAIL_ON_INVALID_SUBTYPE, true)
|
||||
.disable(MapperFeature.ALLOW_COERCION_OF_SCALARS)
|
||||
.enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES)
|
||||
.enable(DeserializationFeature.FAIL_ON_INVALID_SUBTYPE)
|
||||
.disable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS)
|
||||
.enable(SerializationFeature.WRITE_ENUMS_USING_TO_STRING)
|
||||
.enable(DeserializationFeature.READ_ENUMS_USING_TO_STRING)
|
||||
|
||||
Reference in New Issue
Block a user