From b3054a1bb277ae347e723745ecf3c5ea6c3c829e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jean-Fran=C3=A7ois=20C=C3=B4t=C3=A9?= Date: Tue, 28 Apr 2026 15:51:32 -0400 Subject: [PATCH 1/3] Fix jspecify nullable with springboot 4 --- .../src/main/resources/JavaSpring/pathParams.mustache | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/openapi-generator/src/main/resources/JavaSpring/pathParams.mustache b/modules/openapi-generator/src/main/resources/JavaSpring/pathParams.mustache index 24ebb856a153..1e2313e1f4dd 100644 --- a/modules/openapi-generator/src/main/resources/JavaSpring/pathParams.mustache +++ b/modules/openapi-generator/src/main/resources/JavaSpring/pathParams.mustache @@ -1 +1 @@ -{{#isPathParam}}{{#vendorExtensions.x-field-extra-annotation}}{{{.}}} {{/vendorExtensions.x-field-extra-annotation}}{{#useBeanValidation}}{{>beanValidationPathParams}}{{/useBeanValidation}}{{>paramDoc}} @PathVariable("{{baseName}}"){{>dateTimeParam}}{{#isDeprecated}} @Deprecated{{/isDeprecated}} {{>optionalDataType}} {{paramName}}{{/isPathParam}} \ No newline at end of file +{{#isPathParam}}{{#vendorExtensions.x-field-extra-annotation}}{{{.}}} {{/vendorExtensions.x-field-extra-annotation}}{{#useBeanValidation}}{{>beanValidationPathParams}}{{/useBeanValidation}}{{>paramDoc}} @PathVariable("{{baseName}}"){{>dateTimeParam}}{{#isDeprecated}} @Deprecated{{/isDeprecated}} {{>nullableAnnotation}}{{>optionalDataType}} {{paramName}}{{/isPathParam}} From 82841101de5ea1e570659bb26eeda5faa00f1e50 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jean-Fran=C3=A7ois=20C=C3=B4t=C3=A9?= Date: Tue, 28 Apr 2026 15:54:50 -0400 Subject: [PATCH 2/3] Remove useless empty line --- .../src/main/resources/JavaSpring/pathParams.mustache | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/openapi-generator/src/main/resources/JavaSpring/pathParams.mustache b/modules/openapi-generator/src/main/resources/JavaSpring/pathParams.mustache index 1e2313e1f4dd..5a351829131d 100644 --- a/modules/openapi-generator/src/main/resources/JavaSpring/pathParams.mustache +++ b/modules/openapi-generator/src/main/resources/JavaSpring/pathParams.mustache @@ -1 +1 @@ -{{#isPathParam}}{{#vendorExtensions.x-field-extra-annotation}}{{{.}}} {{/vendorExtensions.x-field-extra-annotation}}{{#useBeanValidation}}{{>beanValidationPathParams}}{{/useBeanValidation}}{{>paramDoc}} @PathVariable("{{baseName}}"){{>dateTimeParam}}{{#isDeprecated}} @Deprecated{{/isDeprecated}} {{>nullableAnnotation}}{{>optionalDataType}} {{paramName}}{{/isPathParam}} +{{#isPathParam}}{{#vendorExtensions.x-field-extra-annotation}}{{{.}}} {{/vendorExtensions.x-field-extra-annotation}}{{#useBeanValidation}}{{>beanValidationPathParams}}{{/useBeanValidation}}{{>paramDoc}} @PathVariable("{{baseName}}"){{>dateTimeParam}}{{#isDeprecated}} @Deprecated{{/isDeprecated}} {{>nullableAnnotation}}{{>optionalDataType}} {{paramName}}{{/isPathParam}} \ No newline at end of file From b33f98e4360efc101632d8dd246fb0098f7175f6 Mon Sep 17 00:00:00 2001 From: William Cheng Date: Sun, 3 May 2026 22:42:58 +0800 Subject: [PATCH 3/3] add tests --- .../src/test/resources/3_0/java/jspecify.yaml | 12 ++ .../java/native-jackson3-jspecify/README.md | 11 +- .../native-jackson3-jspecify/api/openapi.yaml | 15 ++ .../docs/DefaultApi.md | 130 ++++++++++++++++++ .../openapitools/client/api/DefaultApi.java | 104 ++++++++++++++ .../README.md | 10 +- .../api/openapi.yaml | 15 ++ .../docs/DefaultApi.md | 64 +++++++++ .../openapitools/client/api/DefaultApi.java | 70 ++++++++++ .../README.md | 10 +- .../api/openapi.yaml | 15 ++ .../docs/DefaultApi.md | 64 +++++++++ .../openapitools/client/api/DefaultApi.java | 46 +++++++ .../README.md | 10 +- .../api/openapi.yaml | 15 ++ .../docs/DefaultApi.md | 64 +++++++++ .../openapitools/client/api/DefaultApi.java | 70 ++++++++++ .../.openapi-generator/FILES | 1 + .../java/org/openapitools/api/FileApi.java | 68 +++++++++ 19 files changed, 770 insertions(+), 24 deletions(-) create mode 100644 samples/openapi3/server/petstore/springboot-4-jspecify/src/main/java/org/openapitools/api/FileApi.java diff --git a/modules/openapi-generator/src/test/resources/3_0/java/jspecify.yaml b/modules/openapi-generator/src/test/resources/3_0/java/jspecify.yaml index d0c08b8c8afa..bd890dfd5b85 100644 --- a/modules/openapi-generator/src/test/resources/3_0/java/jspecify.yaml +++ b/modules/openapi-generator/src/test/resources/3_0/java/jspecify.yaml @@ -47,6 +47,18 @@ paths: default: description: ok + /file/{id}: + get: + parameters: + - in: path + name: id + required: true + schema: + type: string + responses: + '200': + description: ok + components: schemas: Foo: diff --git a/samples/client/petstore/java/native-jackson3-jspecify/README.md b/samples/client/petstore/java/native-jackson3-jspecify/README.md index 7c52c607f577..703b0ea1c259 100644 --- a/samples/client/petstore/java/native-jackson3-jspecify/README.md +++ b/samples/client/petstore/java/native-jackson3-jspecify/README.md @@ -85,14 +85,11 @@ public class DefaultApiExample { // Configure clients using the `defaultClient` object, such as // overriding the host and port, timeout, etc. DefaultApi apiInstance = new DefaultApi(defaultClient); - java.time.Instant dtParam = new java.time.Instant(); // java.time.Instant | - java.time.Instant dtQuery = new java.time.Instant(); // java.time.Instant | - java.time.Instant dtCookie = new java.time.Instant(); // java.time.Instant | + String id = "id_example"; // String | try { - Foo result = apiInstance.fooDtParamGet(dtParam, dtQuery, dtCookie); - System.out.println(result); + apiInstance.fileIdGet(id); } catch (ApiException e) { - System.err.println("Exception when calling DefaultApi#fooDtParamGet"); + System.err.println("Exception when calling DefaultApi#fileIdGet"); System.err.println("Status code: " + e.getCode()); System.err.println("Reason: " + e.getResponseBody()); System.err.println("Response headers: " + e.getResponseHeaders()); @@ -109,6 +106,8 @@ All URIs are relative to *http://localhost* Class | Method | HTTP request | Description ------------ | ------------- | ------------- | ------------- +*DefaultApi* | [**fileIdGet**](docs/DefaultApi.md#fileIdGet) | **GET** /file/{id} | +*DefaultApi* | [**fileIdGetWithHttpInfo**](docs/DefaultApi.md#fileIdGetWithHttpInfo) | **GET** /file/{id} | *DefaultApi* | [**fooDtParamGet**](docs/DefaultApi.md#fooDtParamGet) | **GET** /foo/{dtParam} | *DefaultApi* | [**fooDtParamGetWithHttpInfo**](docs/DefaultApi.md#fooDtParamGetWithHttpInfo) | **GET** /foo/{dtParam} | *DefaultApi* | [**uploadPost**](docs/DefaultApi.md#uploadPost) | **POST** /upload | diff --git a/samples/client/petstore/java/native-jackson3-jspecify/api/openapi.yaml b/samples/client/petstore/java/native-jackson3-jspecify/api/openapi.yaml index 9fb2142503e4..4dadd9ce8bb7 100644 --- a/samples/client/petstore/java/native-jackson3-jspecify/api/openapi.yaml +++ b/samples/client/petstore/java/native-jackson3-jspecify/api/openapi.yaml @@ -56,6 +56,21 @@ paths: x-content-type: multipart/form-data x-accepts: - application/json + /file/{id}: + get: + parameters: + - explode: false + in: path + name: id + required: true + schema: + type: string + style: simple + responses: + "200": + description: ok + x-accepts: + - application/json components: schemas: Foo: diff --git a/samples/client/petstore/java/native-jackson3-jspecify/docs/DefaultApi.md b/samples/client/petstore/java/native-jackson3-jspecify/docs/DefaultApi.md index c52ccbd552cd..63948852e85a 100644 --- a/samples/client/petstore/java/native-jackson3-jspecify/docs/DefaultApi.md +++ b/samples/client/petstore/java/native-jackson3-jspecify/docs/DefaultApi.md @@ -4,6 +4,8 @@ All URIs are relative to *http://localhost* | Method | HTTP request | Description | |------------- | ------------- | -------------| +| [**fileIdGet**](DefaultApi.md#fileIdGet) | **GET** /file/{id} | | +| [**fileIdGetWithHttpInfo**](DefaultApi.md#fileIdGetWithHttpInfo) | **GET** /file/{id} | | | [**fooDtParamGet**](DefaultApi.md#fooDtParamGet) | **GET** /foo/{dtParam} | | | [**fooDtParamGetWithHttpInfo**](DefaultApi.md#fooDtParamGetWithHttpInfo) | **GET** /foo/{dtParam} | | | [**uploadPost**](DefaultApi.md#uploadPost) | **POST** /upload | | @@ -11,6 +13,134 @@ All URIs are relative to *http://localhost* +## fileIdGet + +> void fileIdGet(id) + + + +### Example + +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.DefaultApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://localhost"); + + DefaultApi apiInstance = new DefaultApi(defaultClient); + String id = "id_example"; // String | + try { + apiInstance.fileIdGet(id); + } catch (ApiException e) { + System.err.println("Exception when calling DefaultApi#fileIdGet"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **id** | **String**| | | + +### Return type + + +null (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: Not defined + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | ok | - | + +## fileIdGetWithHttpInfo + +> ApiResponse fileIdGetWithHttpInfo(id) + + + +### Example + +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.ApiResponse; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.DefaultApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://localhost"); + + DefaultApi apiInstance = new DefaultApi(defaultClient); + String id = "id_example"; // String | + try { + ApiResponse response = apiInstance.fileIdGetWithHttpInfo(id); + System.out.println("Status code: " + response.getStatusCode()); + System.out.println("Response headers: " + response.getHeaders()); + } catch (ApiException e) { + System.err.println("Exception when calling DefaultApi#fileIdGet"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Response headers: " + e.getResponseHeaders()); + System.err.println("Reason: " + e.getResponseBody()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **id** | **String**| | | + +### Return type + + +ApiResponse + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: Not defined + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | ok | - | + + ## fooDtParamGet > Foo fooDtParamGet(dtParam, dtQuery, dtCookie) diff --git a/samples/client/petstore/java/native-jackson3-jspecify/src/main/java/org/openapitools/client/api/DefaultApi.java b/samples/client/petstore/java/native-jackson3-jspecify/src/main/java/org/openapitools/client/api/DefaultApi.java index efe11ab32d31..2538b208c1e5 100644 --- a/samples/client/petstore/java/native-jackson3-jspecify/src/main/java/org/openapitools/client/api/DefaultApi.java +++ b/samples/client/petstore/java/native-jackson3-jspecify/src/main/java/org/openapitools/client/api/DefaultApi.java @@ -172,6 +172,110 @@ private File prepareDownloadFile(HttpResponse response) throws IOEx return file; } + /** + * + * + * @param id (required) + * @throws ApiException if fails to make API call + */ + public void fileIdGet(String id) throws ApiException { + fileIdGet(id, null); + } + + /** + * + * + * @param id (required) + * @param headers Optional headers to include in the request + * @throws ApiException if fails to make API call + */ + public void fileIdGet(String id, Map headers) throws ApiException { + fileIdGetWithHttpInfo(id, headers); + } + + /** + * + * + * @param id (required) + * @return ApiResponse<Void> + * @throws ApiException if fails to make API call + */ + public ApiResponse fileIdGetWithHttpInfo(String id) throws ApiException { + return fileIdGetWithHttpInfo(id, null); + } + + /** + * + * + * @param id (required) + * @param headers Optional headers to include in the request + * @return ApiResponse<Void> + * @throws ApiException if fails to make API call + */ + public ApiResponse fileIdGetWithHttpInfo(String id, Map headers) throws ApiException { + HttpRequest.Builder localVarRequestBuilder = fileIdGetRequestBuilder(id, headers); + try { + HttpResponse localVarResponse = memberVarHttpClient.send( + localVarRequestBuilder.build(), + HttpResponse.BodyHandlers.ofInputStream()); + if (memberVarResponseInterceptor != null) { + memberVarResponseInterceptor.accept(localVarResponse); + } + InputStream localVarResponseBody = null; + try { + if (localVarResponse.statusCode()/ 100 != 2) { + throw getApiException("fileIdGet", localVarResponse); + } + localVarResponseBody = ApiClient.getResponseBody(localVarResponse); + if (localVarResponseBody != null) { + localVarResponseBody.readAllBytes(); + } + return new ApiResponse<>( + localVarResponse.statusCode(), + localVarResponse.headers().map(), + null + ); + } finally { + if (localVarResponseBody != null) { + localVarResponseBody.close(); + } + } + } catch (IOException e) { + throw new ApiException(e); + } + catch (InterruptedException e) { + Thread.currentThread().interrupt(); + throw new ApiException(e); + } + } + + private HttpRequest.Builder fileIdGetRequestBuilder(String id, Map headers) throws ApiException { + // verify the required parameter 'id' is set + if (id == null) { + throw new ApiException(400, "Missing the required parameter 'id' when calling fileIdGet"); + } + + HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); + + String localVarPath = "/file/{id}" + .replace("{id}", ApiClient.urlEncode(id.toString())); + + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); + + localVarRequestBuilder.header("Accept", "application/json"); + + localVarRequestBuilder.method("GET", HttpRequest.BodyPublishers.noBody()); + if (memberVarReadTimeout != null) { + localVarRequestBuilder.timeout(memberVarReadTimeout); + } + // Add custom headers if provided + localVarRequestBuilder = HttpRequestBuilderExtensions.withAdditionalHeaders(localVarRequestBuilder, headers); + if (memberVarInterceptor != null) { + memberVarInterceptor.accept(localVarRequestBuilder); + } + return localVarRequestBuilder; + } + /** * * diff --git a/samples/client/petstore/java/restclient-springBoot4-jackson3-jspecify/README.md b/samples/client/petstore/java/restclient-springBoot4-jackson3-jspecify/README.md index 748b99ed772d..85af43441812 100644 --- a/samples/client/petstore/java/restclient-springBoot4-jackson3-jspecify/README.md +++ b/samples/client/petstore/java/restclient-springBoot4-jackson3-jspecify/README.md @@ -93,14 +93,11 @@ public class DefaultApiExample { defaultClient.setBasePath("http://localhost"); DefaultApi apiInstance = new DefaultApi(defaultClient); - java.time.Instant dtParam = new java.time.Instant(); // java.time.Instant | - java.time.Instant dtQuery = new java.time.Instant(); // java.time.Instant | - java.time.Instant dtCookie = new java.time.Instant(); // java.time.Instant | + String id = "id_example"; // String | try { - Foo result = apiInstance.fooDtParamGet(dtParam, dtQuery, dtCookie); - System.out.println(result); + apiInstance.fileIdGet(id); } catch (HttpStatusCodeException e) { - System.err.println("Exception when calling DefaultApi#fooDtParamGet"); + System.err.println("Exception when calling DefaultApi#fileIdGet"); System.err.println("Status code: " + e.getStatusCode().value()); System.err.println("Reason: " + e.getResponseBodyAsString()); System.err.println("Response headers: " + e.getResponseHeaders()); @@ -117,6 +114,7 @@ All URIs are relative to *http://localhost* Class | Method | HTTP request | Description ------------ | ------------- | ------------- | ------------- +*DefaultApi* | [**fileIdGet**](docs/DefaultApi.md#fileIdGet) | **GET** /file/{id} | *DefaultApi* | [**fooDtParamGet**](docs/DefaultApi.md#fooDtParamGet) | **GET** /foo/{dtParam} | *DefaultApi* | [**uploadPost**](docs/DefaultApi.md#uploadPost) | **POST** /upload | diff --git a/samples/client/petstore/java/restclient-springBoot4-jackson3-jspecify/api/openapi.yaml b/samples/client/petstore/java/restclient-springBoot4-jackson3-jspecify/api/openapi.yaml index 9fb2142503e4..4dadd9ce8bb7 100644 --- a/samples/client/petstore/java/restclient-springBoot4-jackson3-jspecify/api/openapi.yaml +++ b/samples/client/petstore/java/restclient-springBoot4-jackson3-jspecify/api/openapi.yaml @@ -56,6 +56,21 @@ paths: x-content-type: multipart/form-data x-accepts: - application/json + /file/{id}: + get: + parameters: + - explode: false + in: path + name: id + required: true + schema: + type: string + style: simple + responses: + "200": + description: ok + x-accepts: + - application/json components: schemas: Foo: diff --git a/samples/client/petstore/java/restclient-springBoot4-jackson3-jspecify/docs/DefaultApi.md b/samples/client/petstore/java/restclient-springBoot4-jackson3-jspecify/docs/DefaultApi.md index 81e4c52b93f2..7a0ddb006a06 100644 --- a/samples/client/petstore/java/restclient-springBoot4-jackson3-jspecify/docs/DefaultApi.md +++ b/samples/client/petstore/java/restclient-springBoot4-jackson3-jspecify/docs/DefaultApi.md @@ -4,11 +4,75 @@ All URIs are relative to *http://localhost* | Method | HTTP request | Description | |------------- | ------------- | -------------| +| [**fileIdGet**](DefaultApi.md#fileIdGet) | **GET** /file/{id} | | | [**fooDtParamGet**](DefaultApi.md#fooDtParamGet) | **GET** /foo/{dtParam} | | | [**uploadPost**](DefaultApi.md#uploadPost) | **POST** /upload | | +## fileIdGet + +> fileIdGet(id) + + + +### Example + +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.DefaultApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://localhost"); + + DefaultApi apiInstance = new DefaultApi(defaultClient); + String id = "id_example"; // String | + try { + apiInstance.fileIdGet(id); + } catch (ApiException e) { + System.err.println("Exception when calling DefaultApi#fileIdGet"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **id** | **String**| | | + +### Return type + +null (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: Not defined + + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | ok | - | + + ## fooDtParamGet > Foo fooDtParamGet(dtParam, dtQuery, dtCookie) 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/src/main/java/org/openapitools/client/api/DefaultApi.java index 297a3a1625f6..accb19c454aa 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/src/main/java/org/openapitools/client/api/DefaultApi.java @@ -47,6 +47,76 @@ 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 pathParams = new HashMap<>(); + + pathParams.put("id", id); + + final MultiValueMap queryParams = new LinkedMultiValueMap<>(); + final HttpHeaders headerParams = new HttpHeaders(); + final MultiValueMap cookieParams = new LinkedMultiValueMap<>(); + final MultiValueMap formParams = new LinkedMultiValueMap<>(); + + final String[] localVarAccepts = { }; + final List localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + final String[] localVarContentTypes = { }; + final MediaType localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { }; + + ParameterizedTypeReference localVarReturnType = new ParameterizedTypeReference<>() {}; + return apiClient.invokeAPI("/file/{id}", HttpMethod.GET, pathParams, queryParams, postBody, headerParams, cookieParams, formParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); + } + + /** + * + * + *

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 localVarReturnType = new ParameterizedTypeReference<>() {}; + fileIdGetRequestCreation(id).body(localVarReturnType); + } + + /** + * + * + *

200 - ok + * @param id The id parameter + * @throws RestClientResponseException if an error occurs while attempting to invoke the API + */ + public ResponseEntity fileIdGetWithHttpInfo( String id) throws RestClientResponseException { + ParameterizedTypeReference localVarReturnType = new ParameterizedTypeReference<>() {}; + return fileIdGetRequestCreation(id).toEntity(localVarReturnType); + } + + /** + * + * + *

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/resttemplate-springBoot4-jackson3-jspecify/README.md b/samples/client/petstore/java/resttemplate-springBoot4-jackson3-jspecify/README.md index 96a11161cbc4..ae18140371fe 100644 --- a/samples/client/petstore/java/resttemplate-springBoot4-jackson3-jspecify/README.md +++ b/samples/client/petstore/java/resttemplate-springBoot4-jackson3-jspecify/README.md @@ -93,14 +93,11 @@ public class DefaultApiExample { defaultClient.setBasePath("http://localhost"); DefaultApi apiInstance = new DefaultApi(defaultClient); - java.time.Instant dtParam = new java.time.Instant(); // java.time.Instant | - java.time.Instant dtQuery = new java.time.Instant(); // java.time.Instant | - java.time.Instant dtCookie = new java.time.Instant(); // java.time.Instant | + String id = "id_example"; // String | try { - Foo result = apiInstance.fooDtParamGet(dtParam, dtQuery, dtCookie); - System.out.println(result); + apiInstance.fileIdGet(id); } catch (ApiException e) { - System.err.println("Exception when calling DefaultApi#fooDtParamGet"); + System.err.println("Exception when calling DefaultApi#fileIdGet"); System.err.println("Status code: " + e.getCode()); System.err.println("Reason: " + e.getResponseBody()); System.err.println("Response headers: " + e.getResponseHeaders()); @@ -117,6 +114,7 @@ All URIs are relative to *http://localhost* Class | Method | HTTP request | Description ------------ | ------------- | ------------- | ------------- +*DefaultApi* | [**fileIdGet**](docs/DefaultApi.md#fileIdGet) | **GET** /file/{id} | *DefaultApi* | [**fooDtParamGet**](docs/DefaultApi.md#fooDtParamGet) | **GET** /foo/{dtParam} | *DefaultApi* | [**uploadPost**](docs/DefaultApi.md#uploadPost) | **POST** /upload | diff --git a/samples/client/petstore/java/resttemplate-springBoot4-jackson3-jspecify/api/openapi.yaml b/samples/client/petstore/java/resttemplate-springBoot4-jackson3-jspecify/api/openapi.yaml index 9fb2142503e4..4dadd9ce8bb7 100644 --- a/samples/client/petstore/java/resttemplate-springBoot4-jackson3-jspecify/api/openapi.yaml +++ b/samples/client/petstore/java/resttemplate-springBoot4-jackson3-jspecify/api/openapi.yaml @@ -56,6 +56,21 @@ paths: x-content-type: multipart/form-data x-accepts: - application/json + /file/{id}: + get: + parameters: + - explode: false + in: path + name: id + required: true + schema: + type: string + style: simple + responses: + "200": + description: ok + x-accepts: + - application/json components: schemas: Foo: diff --git a/samples/client/petstore/java/resttemplate-springBoot4-jackson3-jspecify/docs/DefaultApi.md b/samples/client/petstore/java/resttemplate-springBoot4-jackson3-jspecify/docs/DefaultApi.md index 81e4c52b93f2..7a0ddb006a06 100644 --- a/samples/client/petstore/java/resttemplate-springBoot4-jackson3-jspecify/docs/DefaultApi.md +++ b/samples/client/petstore/java/resttemplate-springBoot4-jackson3-jspecify/docs/DefaultApi.md @@ -4,11 +4,75 @@ All URIs are relative to *http://localhost* | Method | HTTP request | Description | |------------- | ------------- | -------------| +| [**fileIdGet**](DefaultApi.md#fileIdGet) | **GET** /file/{id} | | | [**fooDtParamGet**](DefaultApi.md#fooDtParamGet) | **GET** /foo/{dtParam} | | | [**uploadPost**](DefaultApi.md#uploadPost) | **POST** /upload | | +## fileIdGet + +> fileIdGet(id) + + + +### Example + +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.DefaultApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://localhost"); + + DefaultApi apiInstance = new DefaultApi(defaultClient); + String id = "id_example"; // String | + try { + apiInstance.fileIdGet(id); + } catch (ApiException e) { + System.err.println("Exception when calling DefaultApi#fileIdGet"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **id** | **String**| | | + +### Return type + +null (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: Not defined + + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | ok | - | + + ## fooDtParamGet > Foo fooDtParamGet(dtParam, dtQuery, dtCookie) diff --git a/samples/client/petstore/java/resttemplate-springBoot4-jackson3-jspecify/src/main/java/org/openapitools/client/api/DefaultApi.java b/samples/client/petstore/java/resttemplate-springBoot4-jackson3-jspecify/src/main/java/org/openapitools/client/api/DefaultApi.java index 41b0dac5d763..679ecaf76301 100644 --- a/samples/client/petstore/java/resttemplate-springBoot4-jackson3-jspecify/src/main/java/org/openapitools/client/api/DefaultApi.java +++ b/samples/client/petstore/java/resttemplate-springBoot4-jackson3-jspecify/src/main/java/org/openapitools/client/api/DefaultApi.java @@ -40,6 +40,52 @@ public DefaultApi(ApiClient apiClient) { super(apiClient); } + /** + * + * + *

200 - ok + * @param id (required) + * @throws RestClientException if an error occurs while attempting to invoke the API + */ + public void fileIdGet(String id) throws RestClientException { + fileIdGetWithHttpInfo(id); + } + + /** + * + * + *

200 - ok + * @param id (required) + * @return ResponseEntity<Void> + * @throws RestClientException if an error occurs while attempting to invoke the API + */ + public ResponseEntity fileIdGetWithHttpInfo(String id) throws RestClientException { + Object localVarPostBody = null; + + // verify the required parameter 'id' is set + if (id == null) { + throw new HttpClientErrorException(HttpStatus.BAD_REQUEST, "Missing the required parameter 'id' when calling fileIdGet"); + } + + // create path and map variables + final Map uriVariables = new HashMap(); + uriVariables.put("id", id); + + final MultiValueMap localVarQueryParams = new LinkedMultiValueMap(); + final HttpHeaders localVarHeaderParams = new HttpHeaders(); + final MultiValueMap localVarCookieParams = new LinkedMultiValueMap(); + final MultiValueMap localVarFormParams = new LinkedMultiValueMap(); + + final String[] localVarAccepts = { }; + final List localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + final String[] localVarContentTypes = { }; + final MediaType localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { }; + + ParameterizedTypeReference localReturnType = new ParameterizedTypeReference() {}; + return apiClient.invokeAPI("/file/{id}", HttpMethod.GET, uriVariables, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localReturnType); + } /** * * diff --git a/samples/client/petstore/java/webclient-springBoot4-jackson3-jspecify/README.md b/samples/client/petstore/java/webclient-springBoot4-jackson3-jspecify/README.md index c56d4cba598d..cc583f39a49f 100644 --- a/samples/client/petstore/java/webclient-springBoot4-jackson3-jspecify/README.md +++ b/samples/client/petstore/java/webclient-springBoot4-jackson3-jspecify/README.md @@ -93,14 +93,11 @@ public class DefaultApiExample { defaultClient.setBasePath("http://localhost"); DefaultApi apiInstance = new DefaultApi(defaultClient); - java.time.Instant dtParam = new java.time.Instant(); // java.time.Instant | - java.time.Instant dtQuery = new java.time.Instant(); // java.time.Instant | - java.time.Instant dtCookie = new java.time.Instant(); // java.time.Instant | + String id = "id_example"; // String | try { - Foo result = apiInstance.fooDtParamGet(dtParam, dtQuery, dtCookie); - System.out.println(result); + apiInstance.fileIdGet(id); } catch (ApiException e) { - System.err.println("Exception when calling DefaultApi#fooDtParamGet"); + System.err.println("Exception when calling DefaultApi#fileIdGet"); System.err.println("Status code: " + e.getCode()); System.err.println("Reason: " + e.getResponseBody()); System.err.println("Response headers: " + e.getResponseHeaders()); @@ -117,6 +114,7 @@ All URIs are relative to *http://localhost* Class | Method | HTTP request | Description ------------ | ------------- | ------------- | ------------- +*DefaultApi* | [**fileIdGet**](docs/DefaultApi.md#fileIdGet) | **GET** /file/{id} | *DefaultApi* | [**fooDtParamGet**](docs/DefaultApi.md#fooDtParamGet) | **GET** /foo/{dtParam} | *DefaultApi* | [**uploadPost**](docs/DefaultApi.md#uploadPost) | **POST** /upload | diff --git a/samples/client/petstore/java/webclient-springBoot4-jackson3-jspecify/api/openapi.yaml b/samples/client/petstore/java/webclient-springBoot4-jackson3-jspecify/api/openapi.yaml index 9fb2142503e4..4dadd9ce8bb7 100644 --- a/samples/client/petstore/java/webclient-springBoot4-jackson3-jspecify/api/openapi.yaml +++ b/samples/client/petstore/java/webclient-springBoot4-jackson3-jspecify/api/openapi.yaml @@ -56,6 +56,21 @@ paths: x-content-type: multipart/form-data x-accepts: - application/json + /file/{id}: + get: + parameters: + - explode: false + in: path + name: id + required: true + schema: + type: string + style: simple + responses: + "200": + description: ok + x-accepts: + - application/json components: schemas: Foo: diff --git a/samples/client/petstore/java/webclient-springBoot4-jackson3-jspecify/docs/DefaultApi.md b/samples/client/petstore/java/webclient-springBoot4-jackson3-jspecify/docs/DefaultApi.md index 81e4c52b93f2..7a0ddb006a06 100644 --- a/samples/client/petstore/java/webclient-springBoot4-jackson3-jspecify/docs/DefaultApi.md +++ b/samples/client/petstore/java/webclient-springBoot4-jackson3-jspecify/docs/DefaultApi.md @@ -4,11 +4,75 @@ All URIs are relative to *http://localhost* | Method | HTTP request | Description | |------------- | ------------- | -------------| +| [**fileIdGet**](DefaultApi.md#fileIdGet) | **GET** /file/{id} | | | [**fooDtParamGet**](DefaultApi.md#fooDtParamGet) | **GET** /foo/{dtParam} | | | [**uploadPost**](DefaultApi.md#uploadPost) | **POST** /upload | | +## fileIdGet + +> fileIdGet(id) + + + +### Example + +```java +// Import classes: +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.DefaultApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://localhost"); + + DefaultApi apiInstance = new DefaultApi(defaultClient); + String id = "id_example"; // String | + try { + apiInstance.fileIdGet(id); + } catch (ApiException e) { + System.err.println("Exception when calling DefaultApi#fileIdGet"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **id** | **String**| | | + +### Return type + +null (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: Not defined + + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | ok | - | + + ## fooDtParamGet > Foo fooDtParamGet(dtParam, dtQuery, dtCookie) diff --git a/samples/client/petstore/java/webclient-springBoot4-jackson3-jspecify/src/main/java/org/openapitools/client/api/DefaultApi.java b/samples/client/petstore/java/webclient-springBoot4-jackson3-jspecify/src/main/java/org/openapitools/client/api/DefaultApi.java index ed9c59879506..d0909a3f6ca4 100644 --- a/samples/client/petstore/java/webclient-springBoot4-jackson3-jspecify/src/main/java/org/openapitools/client/api/DefaultApi.java +++ b/samples/client/petstore/java/webclient-springBoot4-jackson3-jspecify/src/main/java/org/openapitools/client/api/DefaultApi.java @@ -49,6 +49,76 @@ public void setApiClient(ApiClient apiClient) { this.apiClient = apiClient; } + /** + * + * + *

200 - ok + * @param id The id parameter + * @throws WebClientResponseException if an error occurs while attempting to invoke the API + */ + private ResponseSpec fileIdGetRequestCreation(String id) throws WebClientResponseException { + Object postBody = null; + // verify the required parameter 'id' is set + if (id == null) { + throw new WebClientResponseException("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 pathParams = new HashMap(); + + pathParams.put("id", id); + + final MultiValueMap queryParams = new LinkedMultiValueMap(); + final HttpHeaders headerParams = new HttpHeaders(); + final MultiValueMap cookieParams = new LinkedMultiValueMap(); + final MultiValueMap formParams = new LinkedMultiValueMap(); + + final String[] localVarAccepts = { }; + final List localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + final String[] localVarContentTypes = { }; + final MediaType localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { }; + + ParameterizedTypeReference localVarReturnType = new ParameterizedTypeReference() {}; + return apiClient.invokeAPI("/file/{id}", HttpMethod.GET, pathParams, queryParams, postBody, headerParams, cookieParams, formParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); + } + + /** + * + * + *

200 - ok + * @param id The id parameter + * @throws WebClientResponseException if an error occurs while attempting to invoke the API + */ + public Mono fileIdGet(String id) throws WebClientResponseException { + ParameterizedTypeReference localVarReturnType = new ParameterizedTypeReference() {}; + return fileIdGetRequestCreation(id).bodyToMono(localVarReturnType); + } + + /** + * + * + *

200 - ok + * @param id The id parameter + * @throws WebClientResponseException if an error occurs while attempting to invoke the API + */ + public Mono> fileIdGetWithHttpInfo(String id) throws WebClientResponseException { + ParameterizedTypeReference localVarReturnType = new ParameterizedTypeReference() {}; + return fileIdGetRequestCreation(id).toEntity(localVarReturnType); + } + + /** + * + * + *

200 - ok + * @param id The id parameter + * @return ResponseSpec + * @throws WebClientResponseException if an error occurs while attempting to invoke the API + */ + public ResponseSpec fileIdGetWithResponseSpec(String id) throws WebClientResponseException { + return fileIdGetRequestCreation(id); + } + /** * * diff --git a/samples/openapi3/server/petstore/springboot-4-jspecify/.openapi-generator/FILES b/samples/openapi3/server/petstore/springboot-4-jspecify/.openapi-generator/FILES index 732881edb8e3..632e71aef704 100644 --- a/samples/openapi3/server/petstore/springboot-4-jspecify/.openapi-generator/FILES +++ b/samples/openapi3/server/petstore/springboot-4-jspecify/.openapi-generator/FILES @@ -1,6 +1,7 @@ README.md pom.xml src/main/java/org/openapitools/api/ApiUtil.java +src/main/java/org/openapitools/api/FileApi.java src/main/java/org/openapitools/api/FooApi.java src/main/java/org/openapitools/api/UploadApi.java src/main/java/org/openapitools/api/package-info.java diff --git a/samples/openapi3/server/petstore/springboot-4-jspecify/src/main/java/org/openapitools/api/FileApi.java b/samples/openapi3/server/petstore/springboot-4-jspecify/src/main/java/org/openapitools/api/FileApi.java new file mode 100644 index 000000000000..3b298eedb58d --- /dev/null +++ b/samples/openapi3/server/petstore/springboot-4-jspecify/src/main/java/org/openapitools/api/FileApi.java @@ -0,0 +1,68 @@ +/* + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech) (7.23.0-SNAPSHOT). + * https://openapi-generator.tech + * Do not edit the class manually. + */ +package org.openapitools.api; + +import io.swagger.v3.oas.annotations.ExternalDocumentation; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.Parameter; +import io.swagger.v3.oas.annotations.Parameters; +import io.swagger.v3.oas.annotations.media.ArraySchema; +import io.swagger.v3.oas.annotations.media.Content; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.responses.ApiResponse; +import io.swagger.v3.oas.annotations.security.SecurityRequirement; +import io.swagger.v3.oas.annotations.tags.Tag; +import io.swagger.v3.oas.annotations.enums.ParameterIn; +import io.swagger.v3.oas.annotations.media.ExampleObject; +import org.springframework.http.HttpStatus; +import org.springframework.http.MediaType; +import org.springframework.http.ResponseEntity; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; +import org.springframework.web.context.request.NativeWebRequest; +import org.springframework.web.multipart.MultipartFile; + +import jakarta.validation.Valid; +import jakarta.validation.constraints.*; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import jakarta.annotation.Generated; + +@Generated(value = "org.openapitools.codegen.languages.SpringCodegen", comments = "Generator version: 7.23.0-SNAPSHOT") +@Validated +@Tag(name = "file", description = "the file API") +public interface FileApi { + + default Optional getRequest() { + return Optional.empty(); + } + + String PATH_FILE_ID_GET = "/file/{id}"; + /** + * GET /file/{id} + * + * @param id (required) + * @return ok (status code 200) + */ + @Operation( + operationId = "fileIdGet", + responses = { + @ApiResponse(responseCode = "200", description = "ok") + } + ) + @RequestMapping( + method = RequestMethod.GET, + value = FileApi.PATH_FILE_ID_GET + ) + default ResponseEntity fileIdGet( + @Parameter(name = "id", description = "", required = true, in = ParameterIn.PATH) @PathVariable("id") String id + ) { + return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED); + + } + +}