mirror of
				https://github.com/OpenAPITools/openapi-generator.git
				synced 2025-11-04 02:33:54 +00:00 
			
		
		
		
	Fix java rest client's ApiClient constructors to make sure objectMapper parameter is used in the client (#19667) (#19795)
This commit is contained in:
		
							parent
							
								
									7cf84e2daf
								
							
						
					
					
						commit
						a82475ed4e
					
				@ -87,29 +87,26 @@ public class ApiClient{{#jsr310}} extends JavaTimeFormatter{{/jsr310}} {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    public ApiClient() {
 | 
					    public ApiClient() {
 | 
				
			||||||
        this.dateFormat = createDefaultDateFormat();
 | 
					        this(null);
 | 
				
			||||||
        this.objectMapper = createDefaultObjectMapper(this.dateFormat);
 | 
					 | 
				
			||||||
        this.restClient = buildRestClient(this.objectMapper);
 | 
					 | 
				
			||||||
        this.init();
 | 
					 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    public ApiClient(RestClient restClient) {
 | 
					    public ApiClient(RestClient restClient) {
 | 
				
			||||||
        this(Optional.ofNullable(restClient).orElseGet(ApiClient::buildRestClient), createDefaultDateFormat());
 | 
					        this(restClient, createDefaultDateFormat());
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    public ApiClient(ObjectMapper mapper, DateFormat format) {
 | 
					    public ApiClient(ObjectMapper mapper, DateFormat format) {
 | 
				
			||||||
        this(buildRestClient(mapper.copy()), format);
 | 
					        this(null, mapper, format);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    public ApiClient(RestClient restClient, ObjectMapper mapper, DateFormat format) {
 | 
					    public ApiClient(RestClient restClient, ObjectMapper mapper, DateFormat format) {
 | 
				
			||||||
        this(Optional.ofNullable(restClient).orElseGet(() -> buildRestClient(mapper.copy())), format);
 | 
					        this.objectMapper = mapper.copy();
 | 
				
			||||||
 | 
					        this.restClient = Optional.ofNullable(restClient).orElseGet(() -> buildRestClient(this.objectMapper));
 | 
				
			||||||
 | 
					        this.dateFormat = format;
 | 
				
			||||||
 | 
					        this.init();
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    private ApiClient(RestClient restClient, DateFormat format) {
 | 
					    private ApiClient(RestClient restClient, DateFormat format) {
 | 
				
			||||||
        this.restClient = restClient;
 | 
					        this(restClient, createDefaultObjectMapper(format), format);
 | 
				
			||||||
        this.dateFormat = format;
 | 
					 | 
				
			||||||
        this.objectMapper = createDefaultObjectMapper(format);
 | 
					 | 
				
			||||||
        this.init();
 | 
					 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    public static DateFormat createDefaultDateFormat() {
 | 
					    public static DateFormat createDefaultDateFormat() {
 | 
				
			||||||
 | 
				
			|||||||
@ -84,29 +84,26 @@ public class ApiClient extends JavaTimeFormatter {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    public ApiClient() {
 | 
					    public ApiClient() {
 | 
				
			||||||
        this.dateFormat = createDefaultDateFormat();
 | 
					        this(null);
 | 
				
			||||||
        this.objectMapper = createDefaultObjectMapper(this.dateFormat);
 | 
					 | 
				
			||||||
        this.restClient = buildRestClient(this.objectMapper);
 | 
					 | 
				
			||||||
        this.init();
 | 
					 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    public ApiClient(RestClient restClient) {
 | 
					    public ApiClient(RestClient restClient) {
 | 
				
			||||||
        this(Optional.ofNullable(restClient).orElseGet(ApiClient::buildRestClient), createDefaultDateFormat());
 | 
					        this(restClient, createDefaultDateFormat());
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    public ApiClient(ObjectMapper mapper, DateFormat format) {
 | 
					    public ApiClient(ObjectMapper mapper, DateFormat format) {
 | 
				
			||||||
        this(buildRestClient(mapper.copy()), format);
 | 
					        this(null, mapper, format);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    public ApiClient(RestClient restClient, ObjectMapper mapper, DateFormat format) {
 | 
					    public ApiClient(RestClient restClient, ObjectMapper mapper, DateFormat format) {
 | 
				
			||||||
        this(Optional.ofNullable(restClient).orElseGet(() -> buildRestClient(mapper.copy())), format);
 | 
					        this.objectMapper = mapper.copy();
 | 
				
			||||||
 | 
					        this.restClient = Optional.ofNullable(restClient).orElseGet(() -> buildRestClient(this.objectMapper));
 | 
				
			||||||
 | 
					        this.dateFormat = format;
 | 
				
			||||||
 | 
					        this.init();
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    private ApiClient(RestClient restClient, DateFormat format) {
 | 
					    private ApiClient(RestClient restClient, DateFormat format) {
 | 
				
			||||||
        this.restClient = restClient;
 | 
					        this(restClient, createDefaultObjectMapper(format), format);
 | 
				
			||||||
        this.dateFormat = format;
 | 
					 | 
				
			||||||
        this.objectMapper = createDefaultObjectMapper(format);
 | 
					 | 
				
			||||||
        this.init();
 | 
					 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    public static DateFormat createDefaultDateFormat() {
 | 
					    public static DateFormat createDefaultDateFormat() {
 | 
				
			||||||
 | 
				
			|||||||
@ -84,29 +84,26 @@ public class ApiClient extends JavaTimeFormatter {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    public ApiClient() {
 | 
					    public ApiClient() {
 | 
				
			||||||
        this.dateFormat = createDefaultDateFormat();
 | 
					        this(null);
 | 
				
			||||||
        this.objectMapper = createDefaultObjectMapper(this.dateFormat);
 | 
					 | 
				
			||||||
        this.restClient = buildRestClient(this.objectMapper);
 | 
					 | 
				
			||||||
        this.init();
 | 
					 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    public ApiClient(RestClient restClient) {
 | 
					    public ApiClient(RestClient restClient) {
 | 
				
			||||||
        this(Optional.ofNullable(restClient).orElseGet(ApiClient::buildRestClient), createDefaultDateFormat());
 | 
					        this(restClient, createDefaultDateFormat());
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    public ApiClient(ObjectMapper mapper, DateFormat format) {
 | 
					    public ApiClient(ObjectMapper mapper, DateFormat format) {
 | 
				
			||||||
        this(buildRestClient(mapper.copy()), format);
 | 
					        this(null, mapper, format);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    public ApiClient(RestClient restClient, ObjectMapper mapper, DateFormat format) {
 | 
					    public ApiClient(RestClient restClient, ObjectMapper mapper, DateFormat format) {
 | 
				
			||||||
        this(Optional.ofNullable(restClient).orElseGet(() -> buildRestClient(mapper.copy())), format);
 | 
					        this.objectMapper = mapper.copy();
 | 
				
			||||||
 | 
					        this.restClient = Optional.ofNullable(restClient).orElseGet(() -> buildRestClient(this.objectMapper));
 | 
				
			||||||
 | 
					        this.dateFormat = format;
 | 
				
			||||||
 | 
					        this.init();
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    private ApiClient(RestClient restClient, DateFormat format) {
 | 
					    private ApiClient(RestClient restClient, DateFormat format) {
 | 
				
			||||||
        this.restClient = restClient;
 | 
					        this(restClient, createDefaultObjectMapper(format), format);
 | 
				
			||||||
        this.dateFormat = format;
 | 
					 | 
				
			||||||
        this.objectMapper = createDefaultObjectMapper(format);
 | 
					 | 
				
			||||||
        this.init();
 | 
					 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    public static DateFormat createDefaultDateFormat() {
 | 
					    public static DateFormat createDefaultDateFormat() {
 | 
				
			||||||
 | 
				
			|||||||
@ -84,29 +84,26 @@ public class ApiClient extends JavaTimeFormatter {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    public ApiClient() {
 | 
					    public ApiClient() {
 | 
				
			||||||
        this.dateFormat = createDefaultDateFormat();
 | 
					        this(null);
 | 
				
			||||||
        this.objectMapper = createDefaultObjectMapper(this.dateFormat);
 | 
					 | 
				
			||||||
        this.restClient = buildRestClient(this.objectMapper);
 | 
					 | 
				
			||||||
        this.init();
 | 
					 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    public ApiClient(RestClient restClient) {
 | 
					    public ApiClient(RestClient restClient) {
 | 
				
			||||||
        this(Optional.ofNullable(restClient).orElseGet(ApiClient::buildRestClient), createDefaultDateFormat());
 | 
					        this(restClient, createDefaultDateFormat());
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    public ApiClient(ObjectMapper mapper, DateFormat format) {
 | 
					    public ApiClient(ObjectMapper mapper, DateFormat format) {
 | 
				
			||||||
        this(buildRestClient(mapper.copy()), format);
 | 
					        this(null, mapper, format);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    public ApiClient(RestClient restClient, ObjectMapper mapper, DateFormat format) {
 | 
					    public ApiClient(RestClient restClient, ObjectMapper mapper, DateFormat format) {
 | 
				
			||||||
        this(Optional.ofNullable(restClient).orElseGet(() -> buildRestClient(mapper.copy())), format);
 | 
					        this.objectMapper = mapper.copy();
 | 
				
			||||||
 | 
					        this.restClient = Optional.ofNullable(restClient).orElseGet(() -> buildRestClient(this.objectMapper));
 | 
				
			||||||
 | 
					        this.dateFormat = format;
 | 
				
			||||||
 | 
					        this.init();
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    private ApiClient(RestClient restClient, DateFormat format) {
 | 
					    private ApiClient(RestClient restClient, DateFormat format) {
 | 
				
			||||||
        this.restClient = restClient;
 | 
					        this(restClient, createDefaultObjectMapper(format), format);
 | 
				
			||||||
        this.dateFormat = format;
 | 
					 | 
				
			||||||
        this.objectMapper = createDefaultObjectMapper(format);
 | 
					 | 
				
			||||||
        this.init();
 | 
					 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    public static DateFormat createDefaultDateFormat() {
 | 
					    public static DateFormat createDefaultDateFormat() {
 | 
				
			||||||
 | 
				
			|||||||
@ -85,29 +85,26 @@ public class ApiClient extends JavaTimeFormatter {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    public ApiClient() {
 | 
					    public ApiClient() {
 | 
				
			||||||
        this.dateFormat = createDefaultDateFormat();
 | 
					        this(null);
 | 
				
			||||||
        this.objectMapper = createDefaultObjectMapper(this.dateFormat);
 | 
					 | 
				
			||||||
        this.restClient = buildRestClient(this.objectMapper);
 | 
					 | 
				
			||||||
        this.init();
 | 
					 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    public ApiClient(RestClient restClient) {
 | 
					    public ApiClient(RestClient restClient) {
 | 
				
			||||||
        this(Optional.ofNullable(restClient).orElseGet(ApiClient::buildRestClient), createDefaultDateFormat());
 | 
					        this(restClient, createDefaultDateFormat());
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    public ApiClient(ObjectMapper mapper, DateFormat format) {
 | 
					    public ApiClient(ObjectMapper mapper, DateFormat format) {
 | 
				
			||||||
        this(buildRestClient(mapper.copy()), format);
 | 
					        this(null, mapper, format);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    public ApiClient(RestClient restClient, ObjectMapper mapper, DateFormat format) {
 | 
					    public ApiClient(RestClient restClient, ObjectMapper mapper, DateFormat format) {
 | 
				
			||||||
        this(Optional.ofNullable(restClient).orElseGet(() -> buildRestClient(mapper.copy())), format);
 | 
					        this.objectMapper = mapper.copy();
 | 
				
			||||||
 | 
					        this.restClient = Optional.ofNullable(restClient).orElseGet(() -> buildRestClient(this.objectMapper));
 | 
				
			||||||
 | 
					        this.dateFormat = format;
 | 
				
			||||||
 | 
					        this.init();
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    private ApiClient(RestClient restClient, DateFormat format) {
 | 
					    private ApiClient(RestClient restClient, DateFormat format) {
 | 
				
			||||||
        this.restClient = restClient;
 | 
					        this(restClient, createDefaultObjectMapper(format), format);
 | 
				
			||||||
        this.dateFormat = format;
 | 
					 | 
				
			||||||
        this.objectMapper = createDefaultObjectMapper(format);
 | 
					 | 
				
			||||||
        this.init();
 | 
					 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    public static DateFormat createDefaultDateFormat() {
 | 
					    public static DateFormat createDefaultDateFormat() {
 | 
				
			||||||
 | 
				
			|||||||
@ -85,29 +85,26 @@ public class ApiClient extends JavaTimeFormatter {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    public ApiClient() {
 | 
					    public ApiClient() {
 | 
				
			||||||
        this.dateFormat = createDefaultDateFormat();
 | 
					        this(null);
 | 
				
			||||||
        this.objectMapper = createDefaultObjectMapper(this.dateFormat);
 | 
					 | 
				
			||||||
        this.restClient = buildRestClient(this.objectMapper);
 | 
					 | 
				
			||||||
        this.init();
 | 
					 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    public ApiClient(RestClient restClient) {
 | 
					    public ApiClient(RestClient restClient) {
 | 
				
			||||||
        this(Optional.ofNullable(restClient).orElseGet(ApiClient::buildRestClient), createDefaultDateFormat());
 | 
					        this(restClient, createDefaultDateFormat());
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    public ApiClient(ObjectMapper mapper, DateFormat format) {
 | 
					    public ApiClient(ObjectMapper mapper, DateFormat format) {
 | 
				
			||||||
        this(buildRestClient(mapper.copy()), format);
 | 
					        this(null, mapper, format);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    public ApiClient(RestClient restClient, ObjectMapper mapper, DateFormat format) {
 | 
					    public ApiClient(RestClient restClient, ObjectMapper mapper, DateFormat format) {
 | 
				
			||||||
        this(Optional.ofNullable(restClient).orElseGet(() -> buildRestClient(mapper.copy())), format);
 | 
					        this.objectMapper = mapper.copy();
 | 
				
			||||||
 | 
					        this.restClient = Optional.ofNullable(restClient).orElseGet(() -> buildRestClient(this.objectMapper));
 | 
				
			||||||
 | 
					        this.dateFormat = format;
 | 
				
			||||||
 | 
					        this.init();
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    private ApiClient(RestClient restClient, DateFormat format) {
 | 
					    private ApiClient(RestClient restClient, DateFormat format) {
 | 
				
			||||||
        this.restClient = restClient;
 | 
					        this(restClient, createDefaultObjectMapper(format), format);
 | 
				
			||||||
        this.dateFormat = format;
 | 
					 | 
				
			||||||
        this.objectMapper = createDefaultObjectMapper(format);
 | 
					 | 
				
			||||||
        this.init();
 | 
					 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    public static DateFormat createDefaultDateFormat() {
 | 
					    public static DateFormat createDefaultDateFormat() {
 | 
				
			||||||
 | 
				
			|||||||
@ -85,29 +85,26 @@ public class ApiClient extends JavaTimeFormatter {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    public ApiClient() {
 | 
					    public ApiClient() {
 | 
				
			||||||
        this.dateFormat = createDefaultDateFormat();
 | 
					        this(null);
 | 
				
			||||||
        this.objectMapper = createDefaultObjectMapper(this.dateFormat);
 | 
					 | 
				
			||||||
        this.restClient = buildRestClient(this.objectMapper);
 | 
					 | 
				
			||||||
        this.init();
 | 
					 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    public ApiClient(RestClient restClient) {
 | 
					    public ApiClient(RestClient restClient) {
 | 
				
			||||||
        this(Optional.ofNullable(restClient).orElseGet(ApiClient::buildRestClient), createDefaultDateFormat());
 | 
					        this(restClient, createDefaultDateFormat());
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    public ApiClient(ObjectMapper mapper, DateFormat format) {
 | 
					    public ApiClient(ObjectMapper mapper, DateFormat format) {
 | 
				
			||||||
        this(buildRestClient(mapper.copy()), format);
 | 
					        this(null, mapper, format);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    public ApiClient(RestClient restClient, ObjectMapper mapper, DateFormat format) {
 | 
					    public ApiClient(RestClient restClient, ObjectMapper mapper, DateFormat format) {
 | 
				
			||||||
        this(Optional.ofNullable(restClient).orElseGet(() -> buildRestClient(mapper.copy())), format);
 | 
					        this.objectMapper = mapper.copy();
 | 
				
			||||||
 | 
					        this.restClient = Optional.ofNullable(restClient).orElseGet(() -> buildRestClient(this.objectMapper));
 | 
				
			||||||
 | 
					        this.dateFormat = format;
 | 
				
			||||||
 | 
					        this.init();
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    private ApiClient(RestClient restClient, DateFormat format) {
 | 
					    private ApiClient(RestClient restClient, DateFormat format) {
 | 
				
			||||||
        this.restClient = restClient;
 | 
					        this(restClient, createDefaultObjectMapper(format), format);
 | 
				
			||||||
        this.dateFormat = format;
 | 
					 | 
				
			||||||
        this.objectMapper = createDefaultObjectMapper(format);
 | 
					 | 
				
			||||||
        this.init();
 | 
					 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    public static DateFormat createDefaultDateFormat() {
 | 
					    public static DateFormat createDefaultDateFormat() {
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user