Prepare the file for download from the response.
+ * + * @param response a {@link java.net.http.HttpResponse} object. + * @return a {@link java.io.File} object. + * @throws java.io.IOException if any. + */ + private File prepareDownloadFile(HttpResponsePrepare the file for download from the response.
+ * + * @param response a {@link java.net.http.HttpResponse} object. + * @return a {@link java.io.File} object. + * @throws java.io.IOException if any. + */ + private File prepareDownloadFile(HttpResponse+ * The default implementation throws {@link RuntimeException}. To use custom exception + * types, implement this interface and pass the instance to + * {@link ApiClient#setExceptionProvider(ExceptionProvider)}. + *
+ *{@code
+ * apiClient.setExceptionProvider(new ExceptionProvider() {
+ * public RuntimeException bearerAuthException() {
+ * return new MyAuthException("No Bearer authentication configured!");
+ * }
+ * });
+ * }
+ */
+@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT")
+public interface ExceptionProvider {
+
+ /** Returns an exception indicating that no Bearer authentication is configured. */
+ default RuntimeException bearerAuthException() {
+ return new RuntimeException("No Bearer authentication configured!");
+ }
+
+ /** Returns an exception indicating that no HTTP basic authentication is configured. */
+ default RuntimeException httpBasicAuthException() {
+ return new RuntimeException("No HTTP basic authentication configured!");
+ }
+
+ /** Returns an exception indicating that no API key authentication is configured. */
+ default RuntimeException apiKeyAuthException() {
+ return new RuntimeException("No API key authentication configured!");
+ }
+
+ /** Returns an exception indicating that no OAuth2 authentication is configured. */
+ default RuntimeException oAuth2Exception() {
+ return new RuntimeException("No OAuth2 authentication configured!");
+ }
+
+ /** Wraps a date/time parse exception. */
+ default RuntimeException dateTimeException(ParseException e) {
+ return new RuntimeException(e);
+ }
+
+ /** Wraps a Jackson serialization/deserialization exception. */
+ default RuntimeException jacksonException(Exception e) {
+ return new RuntimeException(e);
+ }
+
+ /**
+ * Returns an exception indicating that the requested authentication scheme is not configured.
+ *
+ * @param authName the name of the authentication scheme that could not be found
+ * @return a {@link RestClientException} describing the missing authentication
+ */
+ default RestClientException undefinedAuthenticationException(String authName) {
+ return new RestClientException("Authentication undefined: " + authName);
+ }
+
+ /** The default {@link ExceptionProvider} instance. */
+ ExceptionProvider DEFAULT = new ExceptionProvider() {};
+
+}
\ No newline at end of file
diff --git a/samples/client/petstore/java/restclient-springBoot4-jackson3-jspecify-openapiNullable/src/main/java/org/openapitools/client/JavaTimeFormatter.java b/samples/client/petstore/java/restclient-springBoot4-jackson3-jspecify-openapiNullable/src/main/java/org/openapitools/client/JavaTimeFormatter.java
new file mode 100644
index 000000000000..96463ebdee2f
--- /dev/null
+++ b/samples/client/petstore/java/restclient-springBoot4-jackson3-jspecify-openapiNullable/src/main/java/org/openapitools/client/JavaTimeFormatter.java
@@ -0,0 +1,68 @@
+/*
+ * jspecify
+ * test fully qualified name and jspecify
+ *
+ * The version of the OpenAPI document: 1.0.0
+ *
+ *
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
+ * https://openapi-generator.tech
+ * Do not edit the class manually.
+ */
+
+package org.openapitools.client;
+
+import java.time.OffsetDateTime;
+import java.time.format.DateTimeFormatter;
+import java.time.format.DateTimeParseException;
+
+/**
+ * Class that add parsing/formatting support for Java 8+ {@code OffsetDateTime} class.
+ * It's generated for java clients when {@code AbstractJavaCodegen#dateLibrary} specified as {@code java8}.
+ */
+@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT")
+public class JavaTimeFormatter {
+ private DateTimeFormatter offsetDateTimeFormatter = DateTimeFormatter.ISO_OFFSET_DATE_TIME;
+
+ /**
+ * Get the date format used to parse/format {@code OffsetDateTime} parameters.
+ *
+ * @return DateTimeFormatter
+ */
+ public DateTimeFormatter getOffsetDateTimeFormatter() {
+ return offsetDateTimeFormatter;
+ }
+
+ /**
+ * Set the date format used to parse/format {@code OffsetDateTime} parameters.
+ *
+ * @param offsetDateTimeFormatter {@code DateTimeFormatter}
+ */
+ public void setOffsetDateTimeFormatter(DateTimeFormatter offsetDateTimeFormatter) {
+ this.offsetDateTimeFormatter = offsetDateTimeFormatter;
+ }
+
+ /**
+ * Parse the given string into {@code OffsetDateTime} object.
+ *
+ * @param str String
+ * @return {@code OffsetDateTime}
+ */
+ public OffsetDateTime parseOffsetDateTime(String str) {
+ try {
+ return OffsetDateTime.parse(str, offsetDateTimeFormatter);
+ } catch (DateTimeParseException e) {
+ throw new RuntimeException(e);
+ }
+ }
+
+ /**
+ * Format the given {@code OffsetDateTime} object into string.
+ *
+ * @param offsetDateTime {@code OffsetDateTime}
+ * @return {@code OffsetDateTime} in string format
+ */
+ public String formatOffsetDateTime(OffsetDateTime offsetDateTime) {
+ return offsetDateTimeFormatter.format(offsetDateTime);
+ }
+}
\ No newline at end of file
diff --git a/samples/client/petstore/java/restclient-springBoot4-jackson3-jspecify-openapiNullable/src/main/java/org/openapitools/client/RFC3339DateFormat.java b/samples/client/petstore/java/restclient-springBoot4-jackson3-jspecify-openapiNullable/src/main/java/org/openapitools/client/RFC3339DateFormat.java
new file mode 100644
index 000000000000..07bbdd002992
--- /dev/null
+++ b/samples/client/petstore/java/restclient-springBoot4-jackson3-jspecify-openapiNullable/src/main/java/org/openapitools/client/RFC3339DateFormat.java
@@ -0,0 +1,57 @@
+/*
+ * jspecify
+ * test fully qualified name and jspecify
+ *
+ * The version of the OpenAPI document: 1.0.0
+ *
+ *
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
+ * https://openapi-generator.tech
+ * Do not edit the class manually.
+ */
+
+package org.openapitools.client;
+
+import java.text.DateFormat;
+import java.text.FieldPosition;
+import java.text.ParsePosition;
+import java.util.Date;
+import java.text.DecimalFormat;
+import java.util.GregorianCalendar;
+import java.util.TimeZone;
+import tools.jackson.databind.util.StdDateFormat;
+
+@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT")
+public class RFC3339DateFormat extends DateFormat {
+ private static final long serialVersionUID = 1L;
+ private static final TimeZone TIMEZONE_Z = TimeZone.getTimeZone("UTC");
+
+ private final StdDateFormat fmt = new StdDateFormat()
+ .withTimeZone(TIMEZONE_Z)
+ .withColonInTimeZone(true);
+
+ public RFC3339DateFormat() {
+ this.calendar = new GregorianCalendar();
+ this.numberFormat = new DecimalFormat();
+ }
+
+ @Override
+ public Date parse(String source) {
+ return parse(source, new ParsePosition(0));
+ }
+
+ @Override
+ public Date parse(String source, ParsePosition pos) {
+ return fmt.parse(source, pos);
+ }
+
+ @Override
+ public StringBuffer format(Date date, StringBuffer toAppendTo, FieldPosition fieldPosition) {
+ return fmt.format(date, toAppendTo, fieldPosition);
+ }
+
+ @Override
+ public Object clone() {
+ return super.clone();
+ }
+}
diff --git a/samples/client/petstore/java/restclient-springBoot4-jackson3-jspecify-openapiNullable/src/main/java/org/openapitools/client/ServerConfiguration.java b/samples/client/petstore/java/restclient-springBoot4-jackson3-jspecify-openapiNullable/src/main/java/org/openapitools/client/ServerConfiguration.java
new file mode 100644
index 000000000000..05a6de2af25d
--- /dev/null
+++ b/samples/client/petstore/java/restclient-springBoot4-jackson3-jspecify-openapiNullable/src/main/java/org/openapitools/client/ServerConfiguration.java
@@ -0,0 +1,72 @@
+/*
+ * jspecify
+ * test fully qualified name and jspecify
+ *
+ * The version of the OpenAPI document: 1.0.0
+ *
+ *
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
+ * https://openapi-generator.tech
+ * Do not edit the class manually.
+ */
+
+
+package org.openapitools.client;
+
+import java.util.Map;
+
+/**
+ * Representing a Server configuration.
+ */
+@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT")
+public class ServerConfiguration {
+ public String URL;
+ public String description;
+ public Map+ * Note: This might be replaced by utility method from commons-lang or guava someday + * if one of those libraries is added as dependency. + *
+ * + * @param array The array of strings + * @param separator The separator + * @return the resulting string + */ + public static String join(String[] array, String separator) { + int len = array.length; + if (len == 0) { + return ""; + } + + StringBuilder out = new StringBuilder(); + out.append(array[0]); + for (int i = 1; i < len; i++) { + out.append(separator).append(array[i]); + } + return out.toString(); + } + + /** + * Join a list of strings with the given separator. + * + * @param list The list of strings + * @param separator The separator + * @return the resulting string + */ + public static String join(Collection200 - ok
+ * @param id The id parameter
+ * @throws RestClientResponseException if an error occurs while attempting to invoke the API
+ */
+ private ResponseSpec fileIdGetRequestCreation(String id) throws RestClientResponseException {
+ Object postBody = null;
+ // verify the required parameter 'id' is set
+ if (id == null) {
+ throw new RestClientResponseException("Missing the required parameter 'id' when calling fileIdGet", HttpStatus.BAD_REQUEST.value(), HttpStatus.BAD_REQUEST.getReasonPhrase(), null, null, null);
+ }
+ // create path and map variables
+ final Map 200 - ok
+ * @param id The id parameter
+ * @throws RestClientResponseException if an error occurs while attempting to invoke the API
+ */
+ public void fileIdGet(String id) throws RestClientResponseException {
+ ParameterizedTypeReference 200 - ok
+ * @param id The id parameter
+ * @throws RestClientResponseException if an error occurs while attempting to invoke the API
+ */
+ public ResponseEntity 200 - ok
+ * @param id The id parameter
+ * @return ResponseSpec
+ * @throws RestClientResponseException if an error occurs while attempting to invoke the API
+ */
+ public ResponseSpec fileIdGetWithResponseSpec(String id) throws RestClientResponseException {
+ return fileIdGetRequestCreation(id);
+ }
+}
diff --git a/samples/client/petstore/java/restclient-springBoot4-jackson3-jspecify/src/main/java/org/openapitools/client/api/DefaultApi.java b/samples/client/petstore/java/restclient-springBoot4-jackson3-jspecify-openapiNullable/src/main/java/org/openapitools/client/api/FooApi.java
similarity index 52%
rename from samples/client/petstore/java/restclient-springBoot4-jackson3-jspecify/src/main/java/org/openapitools/client/api/DefaultApi.java
rename to samples/client/petstore/java/restclient-springBoot4-jackson3-jspecify-openapiNullable/src/main/java/org/openapitools/client/api/FooApi.java
index b8f342a4af8e..2277568a2a08 100644
--- a/samples/client/petstore/java/restclient-springBoot4-jackson3-jspecify/src/main/java/org/openapitools/client/api/DefaultApi.java
+++ b/samples/client/petstore/java/restclient-springBoot4-jackson3-jspecify-openapiNullable/src/main/java/org/openapitools/client/api/FooApi.java
@@ -2,7 +2,6 @@
import org.openapitools.client.ApiClient;
-import java.io.File;
import org.openapitools.client.model.Foo;
import org.jspecify.annotations.Nullable;
import java.time.OffsetDateTime;
@@ -28,14 +27,14 @@
import org.springframework.web.client.RestClientResponseException;
@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT")
-public class DefaultApi {
+public class FooApi {
private ApiClient apiClient;
- public DefaultApi() {
+ public FooApi() {
this(new ApiClient());
}
- public DefaultApi(ApiClient apiClient) {
+ public FooApi(ApiClient apiClient) {
this.apiClient = apiClient;
}
@@ -47,74 +46,42 @@ public void setApiClient(ApiClient apiClient) {
this.apiClient = apiClient;
}
- /**
- *
- *
- * 200 - ok
- * @param id The id parameter
- * @throws RestClientResponseException if an error occurs while attempting to invoke the API
- */
- private ResponseSpec fileIdGetRequestCreation(String id) throws RestClientResponseException {
- Object postBody = null;
- // verify the required parameter 'id' is set
- if (id == null) {
- throw new RestClientResponseException("Missing the required parameter 'id' when calling fileIdGet", HttpStatus.BAD_REQUEST.value(), HttpStatus.BAD_REQUEST.getReasonPhrase(), null, null, null);
- }
- // create path and map variables
- final Map 200 - ok
- * @param id The id parameter
+ * 0 - response
+ * @param requestParameters The fooDtParamGet request parameters as object
+ * @return Foo
* @throws RestClientResponseException if an error occurs while attempting to invoke the API
*/
- public void fileIdGet(String id) throws RestClientResponseException {
- ParameterizedTypeReference 200 - ok
- * @param id The id parameter
+ * 0 - response
+ * @param requestParameters The fooDtParamGet request parameters as object
+ * @return ResponseEntity<Foo>
* @throws RestClientResponseException if an error occurs while attempting to invoke the API
*/
- public ResponseEntity 200 - ok
- * @param id The id parameter
+ * 0 - response
+ * @param requestParameters The fooDtParamGet request parameters as object
* @return ResponseSpec
* @throws RestClientResponseException if an error occurs while attempting to invoke the API
*/
- public ResponseSpec fileIdGetWithResponseSpec(String id) throws RestClientResponseException {
- return fileIdGetRequestCreation(id);
+ public ResponseSpec fooDtParamGetWithResponseSpec(FooDtParamGetRequest requestParameters) throws RestClientResponseException {
+ return this.fooDtParamGetWithResponseSpec(requestParameters.dtParam(), requestParameters.dtQuery(), requestParameters.dtCookie(), requestParameters.color());
}
/**
@@ -204,73 +171,4 @@ public ResponseEntity 0 - ok
- * @param _file The _file parameter
- * @throws RestClientResponseException if an error occurs while attempting to invoke the API
- */
- private ResponseSpec uploadPostRequestCreation(@Nullable File _file) throws RestClientResponseException {
- Object postBody = null;
- // create path and map variables
- final Map 0 - ok
- * @param _file The _file parameter
- * @throws RestClientResponseException if an error occurs while attempting to invoke the API
- */
- public void uploadPost(@Nullable File _file) throws RestClientResponseException {
- ParameterizedTypeReference 0 - ok
- * @param _file The _file parameter
- * @throws RestClientResponseException if an error occurs while attempting to invoke the API
- */
- public ResponseEntity 0 - ok
- * @param _file The _file parameter
- * @return ResponseSpec
- * @throws RestClientResponseException if an error occurs while attempting to invoke the API
- */
- public ResponseSpec uploadPostWithResponseSpec(@Nullable File _file) throws RestClientResponseException {
- return uploadPostRequestCreation(_file);
- }
}
diff --git a/samples/client/petstore/java/restclient-springBoot4-jackson3-jspecify-openapiNullable/src/main/java/org/openapitools/client/api/UploadApi.java b/samples/client/petstore/java/restclient-springBoot4-jackson3-jspecify-openapiNullable/src/main/java/org/openapitools/client/api/UploadApi.java
new file mode 100644
index 000000000000..0b4b1176008c
--- /dev/null
+++ b/samples/client/petstore/java/restclient-springBoot4-jackson3-jspecify-openapiNullable/src/main/java/org/openapitools/client/api/UploadApi.java
@@ -0,0 +1,185 @@
+package org.openapitools.client.api;
+
+import org.openapitools.client.ApiClient;
+
+import java.io.File;
+import org.jspecify.annotations.Nullable;
+
+import java.util.HashMap;
+import java.util.List;
+import java.util.Locale;
+import java.util.Map;
+import java.util.Objects;
+import java.util.Arrays;
+import java.util.stream.Collectors;
+
+import org.springframework.core.io.FileSystemResource;
+import org.springframework.core.ParameterizedTypeReference;
+import org.springframework.http.HttpHeaders;
+import org.springframework.http.HttpMethod;
+import org.springframework.http.HttpStatus;
+import org.springframework.http.MediaType;
+import org.springframework.http.ResponseEntity;
+import org.springframework.util.LinkedMultiValueMap;
+import org.springframework.util.MultiValueMap;
+import org.springframework.web.client.RestClient.ResponseSpec;
+import org.springframework.web.client.RestClientResponseException;
+
+@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.25.0-SNAPSHOT")
+public class UploadApi {
+ private ApiClient apiClient;
+
+ public UploadApi() {
+ this(new ApiClient());
+ }
+
+ public UploadApi(ApiClient apiClient) {
+ this.apiClient = apiClient;
+ }
+
+ public ApiClient getApiClient() {
+ return apiClient;
+ }
+
+ public void setApiClient(ApiClient apiClient) {
+ this.apiClient = apiClient;
+ }
+
+ /**
+ *
+ *
+ * 0 - ok
+ * @param _file The _file parameter
+ * @throws RestClientResponseException if an error occurs while attempting to invoke the API
+ */
+ private ResponseSpec uploadFilesPostRequestCreation(@Nullable List