Skip to content

Commit

Permalink
Fix java rest client's ApiClient constructors to make sure objectMapp…
Browse files Browse the repository at this point in the history
…er parameter is used in the client (OpenAPITools#19667)
  • Loading branch information
CaptainAye committed Oct 7, 2024
1 parent 2f73582 commit 71eaa08
Show file tree
Hide file tree
Showing 8 changed files with 58 additions and 79 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -87,29 +87,26 @@ public class ApiClient{{#jsr310}} extends JavaTimeFormatter{{/jsr310}} {


public ApiClient() {
this.dateFormat = createDefaultDateFormat();
this.objectMapper = createDefaultObjectMapper(this.dateFormat);
this.restClient = buildRestClient(this.objectMapper);
this.init();
this(null);
}

public ApiClient(RestClient restClient) {
this(Optional.ofNullable(restClient).orElseGet(ApiClient::buildRestClient), createDefaultDateFormat());
this(restClient, createDefaultDateFormat());
}

public ApiClient(ObjectMapper mapper, DateFormat format) {
this(buildRestClient(mapper.copy()), format);
this(null, mapper, 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) {
this.restClient = restClient;
this.dateFormat = format;
this.objectMapper = createDefaultObjectMapper(format);
this.init();
this(restClient, createDefaultObjectMapper(format), format);
}

public static DateFormat createDefaultDateFormat() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,29 +84,26 @@ private String collectionToString(Collection<?> collection) {


public ApiClient() {
this.dateFormat = createDefaultDateFormat();
this.objectMapper = createDefaultObjectMapper(this.dateFormat);
this.restClient = buildRestClient(this.objectMapper);
this.init();
this(null);
}

public ApiClient(RestClient restClient) {
this(Optional.ofNullable(restClient).orElseGet(ApiClient::buildRestClient), createDefaultDateFormat());
this(restClient, createDefaultDateFormat());
}

public ApiClient(ObjectMapper mapper, DateFormat format) {
this(buildRestClient(mapper.copy()), format);
this(null, mapper, 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) {
this.restClient = restClient;
this.dateFormat = format;
this.objectMapper = createDefaultObjectMapper(format);
this.init();
this(restClient, createDefaultObjectMapper(format), format);
}

public static DateFormat createDefaultDateFormat() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,29 +84,26 @@ private String collectionToString(Collection<?> collection) {


public ApiClient() {
this.dateFormat = createDefaultDateFormat();
this.objectMapper = createDefaultObjectMapper(this.dateFormat);
this.restClient = buildRestClient(this.objectMapper);
this.init();
this(null);
}

public ApiClient(RestClient restClient) {
this(Optional.ofNullable(restClient).orElseGet(ApiClient::buildRestClient), createDefaultDateFormat());
this(restClient, createDefaultDateFormat());
}

public ApiClient(ObjectMapper mapper, DateFormat format) {
this(buildRestClient(mapper.copy()), format);
this(null, mapper, 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) {
this.restClient = restClient;
this.dateFormat = format;
this.objectMapper = createDefaultObjectMapper(format);
this.init();
this(restClient, createDefaultObjectMapper(format), format);
}

public static DateFormat createDefaultDateFormat() {
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -84,29 +84,26 @@ private String collectionToString(Collection<?> collection) {


public ApiClient() {
this.dateFormat = createDefaultDateFormat();
this.objectMapper = createDefaultObjectMapper(this.dateFormat);
this.restClient = buildRestClient(this.objectMapper);
this.init();
this(null);
}

public ApiClient(RestClient restClient) {
this(Optional.ofNullable(restClient).orElseGet(ApiClient::buildRestClient), createDefaultDateFormat());
this(restClient, createDefaultDateFormat());
}

public ApiClient(ObjectMapper mapper, DateFormat format) {
this(buildRestClient(mapper.copy()), format);
this(null, mapper, 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) {
this.restClient = restClient;
this.dateFormat = format;
this.objectMapper = createDefaultObjectMapper(format);
this.init();
this(restClient, createDefaultObjectMapper(format), format);
}

public static DateFormat createDefaultDateFormat() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,29 +85,26 @@ private String collectionToString(Collection<?> collection) {


public ApiClient() {
this.dateFormat = createDefaultDateFormat();
this.objectMapper = createDefaultObjectMapper(this.dateFormat);
this.restClient = buildRestClient(this.objectMapper);
this.init();
this(null);
}

public ApiClient(RestClient restClient) {
this(Optional.ofNullable(restClient).orElseGet(ApiClient::buildRestClient), createDefaultDateFormat());
this(restClient, createDefaultDateFormat());
}

public ApiClient(ObjectMapper mapper, DateFormat format) {
this(buildRestClient(mapper.copy()), format);
this(null, mapper, 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) {
this.restClient = restClient;
this.dateFormat = format;
this.objectMapper = createDefaultObjectMapper(format);
this.init();
this(restClient, createDefaultObjectMapper(format), format);
}

public static DateFormat createDefaultDateFormat() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,29 +85,26 @@ private String collectionToString(Collection<?> collection) {


public ApiClient() {
this.dateFormat = createDefaultDateFormat();
this.objectMapper = createDefaultObjectMapper(this.dateFormat);
this.restClient = buildRestClient(this.objectMapper);
this.init();
this(null);
}

public ApiClient(RestClient restClient) {
this(Optional.ofNullable(restClient).orElseGet(ApiClient::buildRestClient), createDefaultDateFormat());
this(restClient, createDefaultDateFormat());
}

public ApiClient(ObjectMapper mapper, DateFormat format) {
this(buildRestClient(mapper.copy()), format);
this(null, mapper, 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) {
this.restClient = restClient;
this.dateFormat = format;
this.objectMapper = createDefaultObjectMapper(format);
this.init();
this(restClient, createDefaultObjectMapper(format), format);
}

public static DateFormat createDefaultDateFormat() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,29 +85,26 @@ private String collectionToString(Collection<?> collection) {


public ApiClient() {
this.dateFormat = createDefaultDateFormat();
this.objectMapper = createDefaultObjectMapper(this.dateFormat);
this.restClient = buildRestClient(this.objectMapper);
this.init();
this(null);
}

public ApiClient(RestClient restClient) {
this(Optional.ofNullable(restClient).orElseGet(ApiClient::buildRestClient), createDefaultDateFormat());
this(restClient, createDefaultDateFormat());
}

public ApiClient(ObjectMapper mapper, DateFormat format) {
this(buildRestClient(mapper.copy()), format);
this(null, mapper, 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) {
this.restClient = restClient;
this.dateFormat = format;
this.objectMapper = createDefaultObjectMapper(format);
this.init();
this(restClient, createDefaultObjectMapper(format), format);
}

public static DateFormat createDefaultDateFormat() {
Expand Down

0 comments on commit 71eaa08

Please sign in to comment.