diff --git a/modules/openapi-generator/src/main/resources/JavaSpring/pathParams.mustache b/modules/openapi-generator/src/main/resources/JavaSpring/pathParams.mustache index 24ebb856a153..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}} {{>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}} \ No newline at end of file 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..da7a69263b09 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 @@ -39,14 +39,41 @@ paths: multipart/form-data: schema: type: object + required: + - file properties: file: type: string format: binary + metadata: + type: string + format: binary responses: default: description: ok - + content: + application/json: + schema: + properties: + id: + type: string + format: uuid + /download/{id}: + get: + parameters: + - in: path + name: id + required: true + schema: + type: string + responses: + '200': + description: ok + content: + application/octet-stream: + schema: + type: string + format: binary components: schemas: Foo: diff --git a/samples/client/petstore/java/native-jackson3-jspecify/.openapi-generator/FILES b/samples/client/petstore/java/native-jackson3-jspecify/.openapi-generator/FILES index 095d16de0c5d..9ed618bb5ecf 100644 --- a/samples/client/petstore/java/native-jackson3-jspecify/.openapi-generator/FILES +++ b/samples/client/petstore/java/native-jackson3-jspecify/.openapi-generator/FILES @@ -1,5 +1,6 @@ .github/workflows/maven.yml .gitignore +.openapi-generator-ignore .travis.yml README.md api/openapi.yaml @@ -7,6 +8,7 @@ build.gradle build.sbt docs/DefaultApi.md docs/Foo.md +docs/UploadPostDefaultResponse.md git_push.sh gradle.properties gradle/wrapper/gradle-wrapper.jar @@ -31,5 +33,9 @@ src/main/java/org/openapitools/client/api/DefaultApi.java src/main/java/org/openapitools/client/api/package-info.java src/main/java/org/openapitools/client/model/AbstractOpenApiSchema.java src/main/java/org/openapitools/client/model/Foo.java +src/main/java/org/openapitools/client/model/UploadPostDefaultResponse.java src/main/java/org/openapitools/client/model/package-info.java src/main/java/org/openapitools/client/package-info.java +src/test/java/org/openapitools/client/api/DefaultApiTest.java +src/test/java/org/openapitools/client/model/FooTest.java +src/test/java/org/openapitools/client/model/UploadPostDefaultResponseTest.java diff --git a/samples/client/petstore/java/native-jackson3-jspecify/README.md b/samples/client/petstore/java/native-jackson3-jspecify/README.md index 7c52c607f577..2ec2d086b05e 100644 --- a/samples/client/petstore/java/native-jackson3-jspecify/README.md +++ b/samples/client/petstore/java/native-jackson3-jspecify/README.md @@ -85,14 +85,12 @@ 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); + File result = apiInstance.downloadIdGet(id); System.out.println(result); } catch (ApiException e) { - System.err.println("Exception when calling DefaultApi#fooDtParamGet"); + System.err.println("Exception when calling DefaultApi#downloadIdGet"); System.err.println("Status code: " + e.getCode()); System.err.println("Reason: " + e.getResponseBody()); System.err.println("Response headers: " + e.getResponseHeaders()); @@ -109,6 +107,8 @@ All URIs are relative to *http://localhost* Class | Method | HTTP request | Description ------------ | ------------- | ------------- | ------------- +*DefaultApi* | [**downloadIdGet**](docs/DefaultApi.md#downloadIdGet) | **GET** /download/{id} | +*DefaultApi* | [**downloadIdGetWithHttpInfo**](docs/DefaultApi.md#downloadIdGetWithHttpInfo) | **GET** /download/{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 | @@ -118,6 +118,7 @@ Class | Method | HTTP request | Description ## Documentation for Models - [Foo](docs/Foo.md) + - [UploadPostDefaultResponse](docs/UploadPostDefaultResponse.md) 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..c56e7b0a70c4 100644 --- a/samples/client/petstore/java/native-jackson3-jspecify/api/openapi.yaml +++ b/samples/client/petstore/java/native-jackson3-jspecify/api/openapi.yaml @@ -52,10 +52,34 @@ paths: description: file responses: default: + content: + application/json: + schema: + $ref: "#/components/schemas/_upload_post_default_response" description: ok x-content-type: multipart/form-data x-accepts: - application/json + /download/{id}: + get: + parameters: + - explode: false + in: path + name: id + required: true + schema: + type: string + style: simple + responses: + "200": + content: + application/octet-stream: + schema: + format: binary + type: string + description: ok + x-accepts: + - application/octet-stream components: schemas: Foo: @@ -100,5 +124,17 @@ components: file: format: binary type: string + metadata: + format: binary + type: string + required: + - file type: object + _upload_post_default_response: + example: + id: 046b6c7f-0b8a-43b9-b35d-6489e6daee91 + properties: + id: + format: uuid + type: string 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..b966d5b992d6 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 | |------------- | ------------- | -------------| +| [**downloadIdGet**](DefaultApi.md#downloadIdGet) | **GET** /download/{id} | | +| [**downloadIdGetWithHttpInfo**](DefaultApi.md#downloadIdGetWithHttpInfo) | **GET** /download/{id} | | | [**fooDtParamGet**](DefaultApi.md#fooDtParamGet) | **GET** /foo/{dtParam} | | | [**fooDtParamGetWithHttpInfo**](DefaultApi.md#fooDtParamGetWithHttpInfo) | **GET** /foo/{dtParam} | | | [**uploadPost**](DefaultApi.md#uploadPost) | **POST** /upload | | @@ -11,6 +13,136 @@ All URIs are relative to *http://localhost* +## downloadIdGet + +> File downloadIdGet(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 { + File result = apiInstance.downloadIdGet(id); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling DefaultApi#downloadIdGet"); + 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 + +[**File**](File.md) + + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/octet-stream + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | ok | - | + +## downloadIdGetWithHttpInfo + +> ApiResponse downloadIdGetWithHttpInfo(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.downloadIdGetWithHttpInfo(id); + System.out.println("Status code: " + response.getStatusCode()); + System.out.println("Response headers: " + response.getHeaders()); + System.out.println("Response body: " + response.getData()); + } catch (ApiException e) { + System.err.println("Exception when calling DefaultApi#downloadIdGet"); + 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<[**File**](File.md)> + + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/octet-stream + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | ok | - | + + ## fooDtParamGet > Foo fooDtParamGet(dtParam, dtQuery, dtCookie) @@ -151,7 +283,7 @@ No authorization required ## uploadPost -> void uploadPost(_file) +> UploadPostDefaultResponse uploadPost(_file, metadata) @@ -172,8 +304,10 @@ public class Example { DefaultApi apiInstance = new DefaultApi(defaultClient); File _file = new File("/path/to/file"); // File | + File metadata = new File("/path/to/file"); // File | try { - apiInstance.uploadPost(_file); + UploadPostDefaultResponse result = apiInstance.uploadPost(_file, metadata); + System.out.println(result); } catch (ApiException e) { System.err.println("Exception when calling DefaultApi#uploadPost"); System.err.println("Status code: " + e.getCode()); @@ -190,12 +324,13 @@ public class Example { | Name | Type | Description | Notes | |------------- | ------------- | ------------- | -------------| -| **_file** | **File**| | [optional] | +| **_file** | **File**| | | +| **metadata** | **File**| | [optional] | ### Return type +[**UploadPostDefaultResponse**](UploadPostDefaultResponse.md) -null (empty response body) ### Authorization @@ -204,7 +339,7 @@ No authorization required ### HTTP request headers - **Content-Type**: multipart/form-data -- **Accept**: Not defined +- **Accept**: application/json ### HTTP response details | Status code | Description | Response headers | @@ -213,7 +348,7 @@ No authorization required ## uploadPostWithHttpInfo -> ApiResponse uploadPostWithHttpInfo(_file) +> ApiResponse uploadPostWithHttpInfo(_file, metadata) @@ -235,10 +370,12 @@ public class Example { DefaultApi apiInstance = new DefaultApi(defaultClient); File _file = new File("/path/to/file"); // File | + File metadata = new File("/path/to/file"); // File | try { - ApiResponse response = apiInstance.uploadPostWithHttpInfo(_file); + ApiResponse response = apiInstance.uploadPostWithHttpInfo(_file, metadata); System.out.println("Status code: " + response.getStatusCode()); System.out.println("Response headers: " + response.getHeaders()); + System.out.println("Response body: " + response.getData()); } catch (ApiException e) { System.err.println("Exception when calling DefaultApi#uploadPost"); System.err.println("Status code: " + e.getCode()); @@ -255,12 +392,13 @@ public class Example { | Name | Type | Description | Notes | |------------- | ------------- | ------------- | -------------| -| **_file** | **File**| | [optional] | +| **_file** | **File**| | | +| **metadata** | **File**| | [optional] | ### Return type +ApiResponse<[**UploadPostDefaultResponse**](UploadPostDefaultResponse.md)> -ApiResponse ### Authorization @@ -269,7 +407,7 @@ No authorization required ### HTTP request headers - **Content-Type**: multipart/form-data -- **Accept**: Not defined +- **Accept**: application/json ### HTTP response details | Status code | Description | Response headers | diff --git a/samples/client/petstore/java/native-jackson3-jspecify/docs/UploadPostDefaultResponse.md b/samples/client/petstore/java/native-jackson3-jspecify/docs/UploadPostDefaultResponse.md new file mode 100644 index 000000000000..e80266b51339 --- /dev/null +++ b/samples/client/petstore/java/native-jackson3-jspecify/docs/UploadPostDefaultResponse.md @@ -0,0 +1,13 @@ + + +# UploadPostDefaultResponse + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**id** | **UUID** | | [optional] | + + + diff --git a/samples/client/petstore/java/native-jackson3-jspecify/gradlew b/samples/client/petstore/java/native-jackson3-jspecify/gradlew old mode 100755 new mode 100644 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..c4ce1978a201 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 @@ -22,6 +22,7 @@ import org.openapitools.client.model.Foo; import org.jspecify.annotations.Nullable; import java.time.OffsetDateTime; +import org.openapitools.client.model.UploadPostDefaultResponse; import tools.jackson.core.JacksonException; import tools.jackson.core.type.TypeReference; @@ -172,6 +173,123 @@ private File prepareDownloadFile(HttpResponse response) throws IOEx return file; } + /** + * + * + * @param id (required) + * @return File + * @throws ApiException if fails to make API call + */ + public File downloadIdGet(String id) throws ApiException { + return downloadIdGet(id, null); + } + + /** + * + * + * @param id (required) + * @param headers Optional headers to include in the request + * @return File + * @throws ApiException if fails to make API call + */ + public File downloadIdGet(String id, Map headers) throws ApiException { + ApiResponse localVarResponse = downloadIdGetWithHttpInfo(id, headers); + return localVarResponse.getData(); + } + + /** + * + * + * @param id (required) + * @return ApiResponse<File> + * @throws ApiException if fails to make API call + */ + public ApiResponse downloadIdGetWithHttpInfo(String id) throws ApiException { + return downloadIdGetWithHttpInfo(id, null); + } + + /** + * + * + * @param id (required) + * @param headers Optional headers to include in the request + * @return ApiResponse<File> + * @throws ApiException if fails to make API call + */ + public ApiResponse downloadIdGetWithHttpInfo(String id, Map headers) throws ApiException { + HttpRequest.Builder localVarRequestBuilder = downloadIdGetRequestBuilder(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("downloadIdGet", localVarResponse); + } + localVarResponseBody = ApiClient.getResponseBody(localVarResponse); + if (localVarResponseBody == null) { + return new ApiResponse( + localVarResponse.statusCode(), + localVarResponse.headers().map(), + null + ); + } + + + // Handle file downloading. + File responseValue = downloadFileFromResponse(localVarResponse, localVarResponseBody); + + + return new ApiResponse( + localVarResponse.statusCode(), + localVarResponse.headers().map(), + responseValue + ); + } finally { + if (localVarResponseBody != null) { + localVarResponseBody.close(); + } + } + } catch (IOException | JacksonException e) { + throw new ApiException(e); + } + catch (InterruptedException e) { + Thread.currentThread().interrupt(); + throw new ApiException(e); + } + } + + private HttpRequest.Builder downloadIdGetRequestBuilder(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 downloadIdGet"); + } + + HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); + + String localVarPath = "/download/{id}" + .replace("{id}", ApiClient.urlEncode(id.toString())); + + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); + + localVarRequestBuilder.header("Accept", "application/octet-stream"); + + 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; + } + /** * * @@ -312,45 +430,52 @@ private HttpRequest.Builder fooDtParamGetRequestBuilder(java.time.@Nullable Inst /** * * - * @param _file (optional) + * @param _file (required) + * @param metadata (optional) + * @return UploadPostDefaultResponse * @throws ApiException if fails to make API call */ - public void uploadPost(@Nullable File _file) throws ApiException { - uploadPost(_file, null); + public UploadPostDefaultResponse uploadPost(File _file, @Nullable File metadata) throws ApiException { + return uploadPost(_file, metadata, null); } /** * * - * @param _file (optional) + * @param _file (required) + * @param metadata (optional) * @param headers Optional headers to include in the request + * @return UploadPostDefaultResponse * @throws ApiException if fails to make API call */ - public void uploadPost(@Nullable File _file, Map headers) throws ApiException { - uploadPostWithHttpInfo(_file, headers); + public UploadPostDefaultResponse uploadPost(File _file, @Nullable File metadata, Map headers) throws ApiException { + ApiResponse localVarResponse = uploadPostWithHttpInfo(_file, metadata, headers); + return localVarResponse.getData(); } /** * * - * @param _file (optional) - * @return ApiResponse<Void> + * @param _file (required) + * @param metadata (optional) + * @return ApiResponse<UploadPostDefaultResponse> * @throws ApiException if fails to make API call */ - public ApiResponse uploadPostWithHttpInfo(@Nullable File _file) throws ApiException { - return uploadPostWithHttpInfo(_file, null); + public ApiResponse uploadPostWithHttpInfo(File _file, @Nullable File metadata) throws ApiException { + return uploadPostWithHttpInfo(_file, metadata, null); } /** * * - * @param _file (optional) + * @param _file (required) + * @param metadata (optional) * @param headers Optional headers to include in the request - * @return ApiResponse<Void> + * @return ApiResponse<UploadPostDefaultResponse> * @throws ApiException if fails to make API call */ - public ApiResponse uploadPostWithHttpInfo(@Nullable File _file, Map headers) throws ApiException { - HttpRequest.Builder localVarRequestBuilder = uploadPostRequestBuilder(_file, headers); + public ApiResponse uploadPostWithHttpInfo(File _file, @Nullable File metadata, Map headers) throws ApiException { + HttpRequest.Builder localVarRequestBuilder = uploadPostRequestBuilder(_file, metadata, headers); try { HttpResponse localVarResponse = memberVarHttpClient.send( localVarRequestBuilder.build(), @@ -364,20 +489,31 @@ public ApiResponse uploadPostWithHttpInfo(@Nullable File _file, Map( + localVarResponse.statusCode(), + localVarResponse.headers().map(), + null + ); } - return new ApiResponse<>( + + + + String responseBody = new String(localVarResponseBody.readAllBytes()); + UploadPostDefaultResponse responseValue = responseBody.isBlank()? null: memberVarObjectMapper.readValue(responseBody, new TypeReference() {}); + + + return new ApiResponse( localVarResponse.statusCode(), localVarResponse.headers().map(), - null + responseValue ); } finally { if (localVarResponseBody != null) { localVarResponseBody.close(); } } - } catch (IOException e) { + } catch (IOException | JacksonException e) { throw new ApiException(e); } catch (InterruptedException e) { @@ -386,7 +522,11 @@ public ApiResponse uploadPostWithHttpInfo(@Nullable File _file, Map headers) throws ApiException { + private HttpRequest.Builder uploadPostRequestBuilder(File _file, @Nullable File metadata, Map headers) throws ApiException { + // verify the required parameter '_file' is set + if (_file == null) { + throw new ApiException(400, "Missing the required parameter '_file' when calling uploadPost"); + } HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); @@ -400,6 +540,8 @@ private HttpRequest.Builder uploadPostRequestBuilder(@Nullable File _file, Map 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..c56e7b0a70c4 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 @@ -52,10 +52,34 @@ paths: description: file responses: default: + content: + application/json: + schema: + $ref: "#/components/schemas/_upload_post_default_response" description: ok x-content-type: multipart/form-data x-accepts: - application/json + /download/{id}: + get: + parameters: + - explode: false + in: path + name: id + required: true + schema: + type: string + style: simple + responses: + "200": + content: + application/octet-stream: + schema: + format: binary + type: string + description: ok + x-accepts: + - application/octet-stream components: schemas: Foo: @@ -100,5 +124,17 @@ components: file: format: binary type: string + metadata: + format: binary + type: string + required: + - file type: object + _upload_post_default_response: + example: + id: 046b6c7f-0b8a-43b9-b35d-6489e6daee91 + properties: + id: + format: uuid + type: string 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..29e263ac5813 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,76 @@ All URIs are relative to *http://localhost* | Method | HTTP request | Description | |------------- | ------------- | -------------| +| [**downloadIdGet**](DefaultApi.md#downloadIdGet) | **GET** /download/{id} | | | [**fooDtParamGet**](DefaultApi.md#fooDtParamGet) | **GET** /foo/{dtParam} | | | [**uploadPost**](DefaultApi.md#uploadPost) | **POST** /upload | | +## downloadIdGet + +> File downloadIdGet(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 { + File result = apiInstance.downloadIdGet(id); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling DefaultApi#downloadIdGet"); + 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 + +[**File**](File.md) + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/octet-stream + + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | ok | - | + + ## fooDtParamGet > Foo fooDtParamGet(dtParam, dtQuery, dtCookie) @@ -79,7 +144,7 @@ No authorization required ## uploadPost -> uploadPost(_file) +> UploadPostDefaultResponse uploadPost(_file, metadata) @@ -100,8 +165,10 @@ public class Example { DefaultApi apiInstance = new DefaultApi(defaultClient); File _file = new File("/path/to/file"); // File | + File metadata = new File("/path/to/file"); // File | try { - apiInstance.uploadPost(_file); + UploadPostDefaultResponse result = apiInstance.uploadPost(_file, metadata); + System.out.println(result); } catch (ApiException e) { System.err.println("Exception when calling DefaultApi#uploadPost"); System.err.println("Status code: " + e.getCode()); @@ -118,11 +185,12 @@ public class Example { | Name | Type | Description | Notes | |------------- | ------------- | ------------- | -------------| -| **_file** | **File**| | [optional] | +| **_file** | **File**| | | +| **metadata** | **File**| | [optional] | ### Return type -null (empty response body) +[**UploadPostDefaultResponse**](UploadPostDefaultResponse.md) ### Authorization @@ -131,7 +199,7 @@ No authorization required ### HTTP request headers - **Content-Type**: multipart/form-data -- **Accept**: Not defined +- **Accept**: application/json ### HTTP response details diff --git a/samples/client/petstore/java/restclient-springBoot4-jackson3-jspecify/docs/UploadPostDefaultResponse.md b/samples/client/petstore/java/restclient-springBoot4-jackson3-jspecify/docs/UploadPostDefaultResponse.md new file mode 100644 index 000000000000..e80266b51339 --- /dev/null +++ b/samples/client/petstore/java/restclient-springBoot4-jackson3-jspecify/docs/UploadPostDefaultResponse.md @@ -0,0 +1,13 @@ + + +# UploadPostDefaultResponse + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**id** | **UUID** | | [optional] | + + + diff --git a/samples/client/petstore/java/restclient-springBoot4-jackson3-jspecify/gradlew b/samples/client/petstore/java/restclient-springBoot4-jackson3-jspecify/gradlew old mode 100755 new mode 100644 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..6b4d05a1e91a 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 @@ -6,6 +6,7 @@ import org.openapitools.client.model.Foo; import org.jspecify.annotations.Nullable; import java.time.OffsetDateTime; +import org.openapitools.client.model.UploadPostDefaultResponse; import java.util.HashMap; import java.util.List; @@ -47,6 +48,81 @@ public void setApiClient(ApiClient apiClient) { this.apiClient = apiClient; } + /** + * + * + *

200 - ok + * @param id The id parameter + * @return File + * @throws RestClientResponseException if an error occurs while attempting to invoke the API + */ + private ResponseSpec downloadIdGetRequestCreation(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 downloadIdGet", 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 = { + "application/octet-stream" + }; + 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("/download/{id}", HttpMethod.GET, pathParams, queryParams, postBody, headerParams, cookieParams, formParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); + } + + /** + * + * + *

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

200 - ok + * @param id The id parameter + * @return ResponseEntity<File> + * @throws RestClientResponseException if an error occurs while attempting to invoke the API + */ + public ResponseEntity downloadIdGetWithHttpInfo( String id) throws RestClientResponseException { + ParameterizedTypeReference localVarReturnType = new ParameterizedTypeReference<>() {}; + return downloadIdGetRequestCreation(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 downloadIdGetWithResponseSpec(String id) throws RestClientResponseException { + return downloadIdGetRequestCreation(id); + } + /** * * @@ -135,10 +211,16 @@ public ResponseSpec fooDtParamGetWithResponseSpec(java.time.@Nullable Instant dt * *

0 - ok * @param _file The _file parameter + * @param metadata The metadata parameter + * @return UploadPostDefaultResponse * @throws RestClientResponseException if an error occurs while attempting to invoke the API */ - private ResponseSpec uploadPostRequestCreation(@Nullable File _file) throws RestClientResponseException { + private ResponseSpec uploadPostRequestCreation(File _file, @Nullable File metadata) throws RestClientResponseException { Object postBody = null; + // verify the required parameter '_file' is set + if (_file == null) { + throw new RestClientResponseException("Missing the required parameter '_file' when calling uploadPost", HttpStatus.BAD_REQUEST.value(), HttpStatus.BAD_REQUEST.getReasonPhrase(), null, null, null); + } // create path and map variables final Map pathParams = new HashMap<>(); @@ -149,8 +231,12 @@ private ResponseSpec uploadPostRequestCreation(@Nullable File _file) throws Rest if (_file != null) formParams.add("file", new FileSystemResource(_file)); + if (metadata != null) + formParams.add("metadata", new FileSystemResource(metadata)); - final String[] localVarAccepts = { }; + final String[] localVarAccepts = { + "application/json" + }; final List localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); final String[] localVarContentTypes = { "multipart/form-data" @@ -159,7 +245,7 @@ private ResponseSpec uploadPostRequestCreation(@Nullable File _file) throws Rest String[] localVarAuthNames = new String[] { }; - ParameterizedTypeReference localVarReturnType = new ParameterizedTypeReference<>() {}; + ParameterizedTypeReference localVarReturnType = new ParameterizedTypeReference<>() {}; return apiClient.invokeAPI("/upload", HttpMethod.POST, pathParams, queryParams, postBody, headerParams, cookieParams, formParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); } @@ -168,11 +254,13 @@ private ResponseSpec uploadPostRequestCreation(@Nullable File _file) throws Rest * *

0 - ok * @param _file The _file parameter + * @param metadata The metadata parameter + * @return UploadPostDefaultResponse * @throws RestClientResponseException if an error occurs while attempting to invoke the API */ - public void uploadPost(@Nullable File _file) throws RestClientResponseException { - ParameterizedTypeReference localVarReturnType = new ParameterizedTypeReference<>() {}; - uploadPostRequestCreation(_file).body(localVarReturnType); + public UploadPostDefaultResponse uploadPost(File _file, @Nullable File metadata) throws RestClientResponseException { + ParameterizedTypeReference localVarReturnType = new ParameterizedTypeReference<>() {}; + return uploadPostRequestCreation(_file, metadata).body(localVarReturnType); } /** @@ -180,11 +268,13 @@ public void uploadPost(@Nullable File _file) throws RestClientResponseException * *

0 - ok * @param _file The _file parameter + * @param metadata The metadata parameter + * @return ResponseEntity<UploadPostDefaultResponse> * @throws RestClientResponseException if an error occurs while attempting to invoke the API */ - public ResponseEntity uploadPostWithHttpInfo(@Nullable File _file) throws RestClientResponseException { - ParameterizedTypeReference localVarReturnType = new ParameterizedTypeReference<>() {}; - return uploadPostRequestCreation(_file).toEntity(localVarReturnType); + public ResponseEntity uploadPostWithHttpInfo(File _file, @Nullable File metadata) throws RestClientResponseException { + ParameterizedTypeReference localVarReturnType = new ParameterizedTypeReference<>() {}; + return uploadPostRequestCreation(_file, metadata).toEntity(localVarReturnType); } /** @@ -192,10 +282,11 @@ public ResponseEntity uploadPostWithHttpInfo(@Nullable File _file) throws * *

0 - ok * @param _file The _file parameter + * @param metadata The metadata 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); + public ResponseSpec uploadPostWithResponseSpec(File _file, @Nullable File metadata) throws RestClientResponseException { + return uploadPostRequestCreation(_file, metadata); } } diff --git a/samples/client/petstore/java/restclient-springBoot4-jackson3-jspecify/src/main/java/org/openapitools/client/model/UploadPostDefaultResponse.java b/samples/client/petstore/java/restclient-springBoot4-jackson3-jspecify/src/main/java/org/openapitools/client/model/UploadPostDefaultResponse.java new file mode 100644 index 000000000000..88492b1fa700 --- /dev/null +++ b/samples/client/petstore/java/restclient-springBoot4-jackson3-jspecify/src/main/java/org/openapitools/client/model/UploadPostDefaultResponse.java @@ -0,0 +1,106 @@ +/* + * 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.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import java.util.UUID; +import org.jspecify.annotations.Nullable; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonIgnore; + +/** + * UploadPostDefaultResponse + */ +@JsonPropertyOrder({ + UploadPostDefaultResponse.JSON_PROPERTY_ID +}) +@JsonTypeName("_upload_post_default_response") +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.23.0-SNAPSHOT") +public class UploadPostDefaultResponse { + public static final String JSON_PROPERTY_ID = "id"; + + private @Nullable UUID id; + + public UploadPostDefaultResponse() { + } + + public UploadPostDefaultResponse id(@Nullable UUID id) { + + this.id = id; + return this; + } + + /** + * Get id + * @return id + */ + + @JsonProperty(value = JSON_PROPERTY_ID, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public @Nullable UUID getId() { + return id; + } + + + @JsonProperty(value = JSON_PROPERTY_ID, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setId(@Nullable UUID id) { + this.id = id; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + UploadPostDefaultResponse uploadPostDefaultResponse = (UploadPostDefaultResponse) o; + return Objects.equals(this.id, uploadPostDefaultResponse.id); + } + + @Override + public int hashCode() { + return Objects.hash(id); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class UploadPostDefaultResponse {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + +} + diff --git a/samples/client/petstore/java/restclient-springBoot4-jackson3-jspecify/src/test/java/org/openapitools/client/api/DefaultApiTest.java b/samples/client/petstore/java/restclient-springBoot4-jackson3-jspecify/src/test/java/org/openapitools/client/api/DefaultApiTest.java index 2090a328d4a2..57aed2328926 100644 --- a/samples/client/petstore/java/restclient-springBoot4-jackson3-jspecify/src/test/java/org/openapitools/client/api/DefaultApiTest.java +++ b/samples/client/petstore/java/restclient-springBoot4-jackson3-jspecify/src/test/java/org/openapitools/client/api/DefaultApiTest.java @@ -17,6 +17,7 @@ import org.openapitools.client.model.Foo; import org.jspecify.annotations.Nullable; import java.time.OffsetDateTime; +import org.openapitools.client.model.UploadPostDefaultResponse; import org.junit.jupiter.api.Disabled; import org.junit.jupiter.api.Test; @@ -35,6 +36,19 @@ public class DefaultApiTest { private final DefaultApi api = new DefaultApi(); + /** + * + * + * + */ + @Test + public void downloadIdGetTest() { + String id = null; + File response = api.downloadIdGet(id); + + // TODO: test validations + } + /** * * @@ -58,9 +72,10 @@ public void fooDtParamGetTest() { @Test public void uploadPostTest() { File _file = null; - api.uploadPost(_file); + File metadata = null; + UploadPostDefaultResponse response = api.uploadPost(_file, metadata); // TODO: test validations } -} \ No newline at end of file +} diff --git a/samples/client/petstore/java/restclient-springBoot4-jackson3-jspecify/src/test/java/org/openapitools/client/model/UploadPostDefaultResponseTest.java b/samples/client/petstore/java/restclient-springBoot4-jackson3-jspecify/src/test/java/org/openapitools/client/model/UploadPostDefaultResponseTest.java new file mode 100644 index 000000000000..6d0f7c414784 --- /dev/null +++ b/samples/client/petstore/java/restclient-springBoot4-jackson3-jspecify/src/test/java/org/openapitools/client/model/UploadPostDefaultResponseTest.java @@ -0,0 +1,49 @@ +/* + * 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.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import java.util.UUID; +import org.jspecify.annotations.Nullable; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for UploadPostDefaultResponse + */ +class UploadPostDefaultResponseTest { + private final UploadPostDefaultResponse model = new UploadPostDefaultResponse(); + + /** + * Model tests for UploadPostDefaultResponse + */ + @Test + void testUploadPostDefaultResponse() { + // TODO: test UploadPostDefaultResponse + } + + /** + * Test the property 'id' + */ + @Test + void idTest() { + // TODO: test id + } + +} diff --git a/samples/client/petstore/java/resttemplate-springBoot4-jackson3-jspecify/.openapi-generator/FILES b/samples/client/petstore/java/resttemplate-springBoot4-jackson3-jspecify/.openapi-generator/FILES index 56926e5b1c76..ecc0d11dd9e3 100644 --- a/samples/client/petstore/java/resttemplate-springBoot4-jackson3-jspecify/.openapi-generator/FILES +++ b/samples/client/petstore/java/resttemplate-springBoot4-jackson3-jspecify/.openapi-generator/FILES @@ -7,6 +7,7 @@ build.gradle build.sbt docs/DefaultApi.md docs/Foo.md +docs/UploadPostDefaultResponse.md git_push.sh gradle.properties gradle/wrapper/gradle-wrapper.jar @@ -31,5 +32,6 @@ src/main/java/org/openapitools/client/auth/Authentication.java src/main/java/org/openapitools/client/auth/HttpBasicAuth.java src/main/java/org/openapitools/client/auth/HttpBearerAuth.java src/main/java/org/openapitools/client/model/Foo.java +src/main/java/org/openapitools/client/model/UploadPostDefaultResponse.java src/main/java/org/openapitools/client/model/package-info.java src/main/java/org/openapitools/client/package-info.java 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..3670e69313c6 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,12 @@ 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); + File result = apiInstance.downloadIdGet(id); System.out.println(result); } catch (ApiException e) { - System.err.println("Exception when calling DefaultApi#fooDtParamGet"); + System.err.println("Exception when calling DefaultApi#downloadIdGet"); System.err.println("Status code: " + e.getCode()); System.err.println("Reason: " + e.getResponseBody()); System.err.println("Response headers: " + e.getResponseHeaders()); @@ -117,6 +115,7 @@ All URIs are relative to *http://localhost* Class | Method | HTTP request | Description ------------ | ------------- | ------------- | ------------- +*DefaultApi* | [**downloadIdGet**](docs/DefaultApi.md#downloadIdGet) | **GET** /download/{id} | *DefaultApi* | [**fooDtParamGet**](docs/DefaultApi.md#fooDtParamGet) | **GET** /foo/{dtParam} | *DefaultApi* | [**uploadPost**](docs/DefaultApi.md#uploadPost) | **POST** /upload | @@ -124,6 +123,7 @@ Class | Method | HTTP request | Description ## Documentation for Models - [Foo](docs/Foo.md) + - [UploadPostDefaultResponse](docs/UploadPostDefaultResponse.md) 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..c56e7b0a70c4 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 @@ -52,10 +52,34 @@ paths: description: file responses: default: + content: + application/json: + schema: + $ref: "#/components/schemas/_upload_post_default_response" description: ok x-content-type: multipart/form-data x-accepts: - application/json + /download/{id}: + get: + parameters: + - explode: false + in: path + name: id + required: true + schema: + type: string + style: simple + responses: + "200": + content: + application/octet-stream: + schema: + format: binary + type: string + description: ok + x-accepts: + - application/octet-stream components: schemas: Foo: @@ -100,5 +124,17 @@ components: file: format: binary type: string + metadata: + format: binary + type: string + required: + - file type: object + _upload_post_default_response: + example: + id: 046b6c7f-0b8a-43b9-b35d-6489e6daee91 + properties: + id: + format: uuid + type: string 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..29e263ac5813 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,76 @@ All URIs are relative to *http://localhost* | Method | HTTP request | Description | |------------- | ------------- | -------------| +| [**downloadIdGet**](DefaultApi.md#downloadIdGet) | **GET** /download/{id} | | | [**fooDtParamGet**](DefaultApi.md#fooDtParamGet) | **GET** /foo/{dtParam} | | | [**uploadPost**](DefaultApi.md#uploadPost) | **POST** /upload | | +## downloadIdGet + +> File downloadIdGet(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 { + File result = apiInstance.downloadIdGet(id); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling DefaultApi#downloadIdGet"); + 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 + +[**File**](File.md) + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/octet-stream + + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | ok | - | + + ## fooDtParamGet > Foo fooDtParamGet(dtParam, dtQuery, dtCookie) @@ -79,7 +144,7 @@ No authorization required ## uploadPost -> uploadPost(_file) +> UploadPostDefaultResponse uploadPost(_file, metadata) @@ -100,8 +165,10 @@ public class Example { DefaultApi apiInstance = new DefaultApi(defaultClient); File _file = new File("/path/to/file"); // File | + File metadata = new File("/path/to/file"); // File | try { - apiInstance.uploadPost(_file); + UploadPostDefaultResponse result = apiInstance.uploadPost(_file, metadata); + System.out.println(result); } catch (ApiException e) { System.err.println("Exception when calling DefaultApi#uploadPost"); System.err.println("Status code: " + e.getCode()); @@ -118,11 +185,12 @@ public class Example { | Name | Type | Description | Notes | |------------- | ------------- | ------------- | -------------| -| **_file** | **File**| | [optional] | +| **_file** | **File**| | | +| **metadata** | **File**| | [optional] | ### Return type -null (empty response body) +[**UploadPostDefaultResponse**](UploadPostDefaultResponse.md) ### Authorization @@ -131,7 +199,7 @@ No authorization required ### HTTP request headers - **Content-Type**: multipart/form-data -- **Accept**: Not defined +- **Accept**: application/json ### HTTP response details diff --git a/samples/client/petstore/java/resttemplate-springBoot4-jackson3-jspecify/docs/UploadPostDefaultResponse.md b/samples/client/petstore/java/resttemplate-springBoot4-jackson3-jspecify/docs/UploadPostDefaultResponse.md new file mode 100644 index 000000000000..e80266b51339 --- /dev/null +++ b/samples/client/petstore/java/resttemplate-springBoot4-jackson3-jspecify/docs/UploadPostDefaultResponse.md @@ -0,0 +1,13 @@ + + +# UploadPostDefaultResponse + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**id** | **UUID** | | [optional] | + + + 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..242f7b2149aa 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 @@ -7,6 +7,7 @@ import org.openapitools.client.model.Foo; import org.jspecify.annotations.Nullable; import java.time.OffsetDateTime; +import org.openapitools.client.model.UploadPostDefaultResponse; import java.util.Collections; import java.util.HashMap; @@ -40,6 +41,55 @@ public DefaultApi(ApiClient apiClient) { super(apiClient); } + /** + * + * + *

200 - ok + * @param id (required) + * @return File + * @throws RestClientException if an error occurs while attempting to invoke the API + */ + public File downloadIdGet(String id) throws RestClientException { + return downloadIdGetWithHttpInfo(id).getBody(); + } + + /** + * + * + *

200 - ok + * @param id (required) + * @return ResponseEntity<File> + * @throws RestClientException if an error occurs while attempting to invoke the API + */ + public ResponseEntity downloadIdGetWithHttpInfo(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 downloadIdGet"); + } + + // 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 = { + "application/octet-stream" + }; + 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("/download/{id}", HttpMethod.GET, uriVariables, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localReturnType); + } /** * * @@ -98,24 +148,32 @@ public ResponseEntity fooDtParamGetWithHttpInfo(java.time.Instant dtParam, * * *

0 - ok - * @param _file (optional) + * @param _file (required) + * @param metadata (optional) + * @return UploadPostDefaultResponse * @throws RestClientException if an error occurs while attempting to invoke the API */ - public void uploadPost(File _file) throws RestClientException { - uploadPostWithHttpInfo(_file); + public UploadPostDefaultResponse uploadPost(File _file, File metadata) throws RestClientException { + return uploadPostWithHttpInfo(_file, metadata).getBody(); } /** * * *

0 - ok - * @param _file (optional) - * @return ResponseEntity<Void> + * @param _file (required) + * @param metadata (optional) + * @return ResponseEntity<UploadPostDefaultResponse> * @throws RestClientException if an error occurs while attempting to invoke the API */ - public ResponseEntity uploadPostWithHttpInfo(File _file) throws RestClientException { + public ResponseEntity uploadPostWithHttpInfo(File _file, File metadata) throws RestClientException { Object localVarPostBody = null; + // verify the required parameter '_file' is set + if (_file == null) { + throw new HttpClientErrorException(HttpStatus.BAD_REQUEST, "Missing the required parameter '_file' when calling uploadPost"); + } + final MultiValueMap localVarQueryParams = new LinkedMultiValueMap(); final HttpHeaders localVarHeaderParams = new HttpHeaders(); @@ -124,8 +182,12 @@ public ResponseEntity uploadPostWithHttpInfo(File _file) throws RestClient if (_file != null) localVarFormParams.add("file", new FileSystemResource(_file)); + if (metadata != null) + localVarFormParams.add("metadata", new FileSystemResource(metadata)); - final String[] localVarAccepts = { }; + final String[] localVarAccepts = { + "application/json" + }; final List localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); final String[] localVarContentTypes = { "multipart/form-data" @@ -134,7 +196,7 @@ public ResponseEntity uploadPostWithHttpInfo(File _file) throws RestClient String[] localVarAuthNames = new String[] { }; - ParameterizedTypeReference localReturnType = new ParameterizedTypeReference() {}; + ParameterizedTypeReference localReturnType = new ParameterizedTypeReference() {}; return apiClient.invokeAPI("/upload", HttpMethod.POST, Collections.emptyMap(), localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localReturnType); } @@ -149,7 +211,9 @@ public ResponseEntity invokeAPI(String url, HttpMethod method, Object req final MultiValueMap localVarCookieParams = new LinkedMultiValueMap(); final MultiValueMap localVarFormParams = new LinkedMultiValueMap(); - final String[] localVarAccepts = { }; + final String[] localVarAccepts = { + "application/json" + }; final List localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); final String[] localVarContentTypes = { "multipart/form-data" diff --git a/samples/client/petstore/java/resttemplate-springBoot4-jackson3-jspecify/src/main/java/org/openapitools/client/model/UploadPostDefaultResponse.java b/samples/client/petstore/java/resttemplate-springBoot4-jackson3-jspecify/src/main/java/org/openapitools/client/model/UploadPostDefaultResponse.java new file mode 100644 index 000000000000..88492b1fa700 --- /dev/null +++ b/samples/client/petstore/java/resttemplate-springBoot4-jackson3-jspecify/src/main/java/org/openapitools/client/model/UploadPostDefaultResponse.java @@ -0,0 +1,106 @@ +/* + * 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.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import java.util.UUID; +import org.jspecify.annotations.Nullable; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonIgnore; + +/** + * UploadPostDefaultResponse + */ +@JsonPropertyOrder({ + UploadPostDefaultResponse.JSON_PROPERTY_ID +}) +@JsonTypeName("_upload_post_default_response") +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.23.0-SNAPSHOT") +public class UploadPostDefaultResponse { + public static final String JSON_PROPERTY_ID = "id"; + + private @Nullable UUID id; + + public UploadPostDefaultResponse() { + } + + public UploadPostDefaultResponse id(@Nullable UUID id) { + + this.id = id; + return this; + } + + /** + * Get id + * @return id + */ + + @JsonProperty(value = JSON_PROPERTY_ID, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public @Nullable UUID getId() { + return id; + } + + + @JsonProperty(value = JSON_PROPERTY_ID, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setId(@Nullable UUID id) { + this.id = id; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + UploadPostDefaultResponse uploadPostDefaultResponse = (UploadPostDefaultResponse) o; + return Objects.equals(this.id, uploadPostDefaultResponse.id); + } + + @Override + public int hashCode() { + return Objects.hash(id); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class UploadPostDefaultResponse {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + +} + diff --git a/samples/client/petstore/java/resttemplate-springBoot4-jackson3-jspecify/src/test/java/org/openapitools/client/api/DefaultApiTest.java b/samples/client/petstore/java/resttemplate-springBoot4-jackson3-jspecify/src/test/java/org/openapitools/client/api/DefaultApiTest.java index 65ddba4827cf..16d378368afb 100644 --- a/samples/client/petstore/java/resttemplate-springBoot4-jackson3-jspecify/src/test/java/org/openapitools/client/api/DefaultApiTest.java +++ b/samples/client/petstore/java/resttemplate-springBoot4-jackson3-jspecify/src/test/java/org/openapitools/client/api/DefaultApiTest.java @@ -17,6 +17,7 @@ import org.openapitools.client.model.Foo; import org.jspecify.annotations.Nullable; import java.time.OffsetDateTime; +import org.openapitools.client.model.UploadPostDefaultResponse; import org.junit.jupiter.api.Disabled; import org.junit.jupiter.api.Test; import org.springframework.web.client.RestClientException; @@ -37,6 +38,23 @@ class DefaultApiTest { private final DefaultApi api = new DefaultApi(); + /** + * + * + * + * + * @throws RestClientException + * if the Api call fails + */ + @Test + void downloadIdGetTest() { + String id = null; + + File response = api.downloadIdGet(id); + + // TODO: test validations + } + /** * * @@ -67,8 +85,9 @@ void fooDtParamGetTest() { @Test void uploadPostTest() { File _file = null; + File metadata = null; - api.uploadPost(_file); + UploadPostDefaultResponse response = api.uploadPost(_file, metadata); // TODO: test validations } diff --git a/samples/client/petstore/java/resttemplate-springBoot4-jackson3-jspecify/src/test/java/org/openapitools/client/model/UploadPostDefaultResponseTest.java b/samples/client/petstore/java/resttemplate-springBoot4-jackson3-jspecify/src/test/java/org/openapitools/client/model/UploadPostDefaultResponseTest.java new file mode 100644 index 000000000000..6d0f7c414784 --- /dev/null +++ b/samples/client/petstore/java/resttemplate-springBoot4-jackson3-jspecify/src/test/java/org/openapitools/client/model/UploadPostDefaultResponseTest.java @@ -0,0 +1,49 @@ +/* + * 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.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import java.util.UUID; +import org.jspecify.annotations.Nullable; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for UploadPostDefaultResponse + */ +class UploadPostDefaultResponseTest { + private final UploadPostDefaultResponse model = new UploadPostDefaultResponse(); + + /** + * Model tests for UploadPostDefaultResponse + */ + @Test + void testUploadPostDefaultResponse() { + // TODO: test UploadPostDefaultResponse + } + + /** + * Test the property 'id' + */ + @Test + void idTest() { + // TODO: test id + } + +} diff --git a/samples/client/petstore/java/webclient-springBoot4-jackson3-jspecify/.openapi-generator/FILES b/samples/client/petstore/java/webclient-springBoot4-jackson3-jspecify/.openapi-generator/FILES index d59cb3fdbb35..0fa31ce99624 100644 --- a/samples/client/petstore/java/webclient-springBoot4-jackson3-jspecify/.openapi-generator/FILES +++ b/samples/client/petstore/java/webclient-springBoot4-jackson3-jspecify/.openapi-generator/FILES @@ -7,6 +7,7 @@ build.gradle build.sbt docs/DefaultApi.md docs/Foo.md +docs/UploadPostDefaultResponse.md git_push.sh gradle.properties gradle/wrapper/gradle-wrapper.jar @@ -31,5 +32,6 @@ src/main/java/org/openapitools/client/auth/Authentication.java src/main/java/org/openapitools/client/auth/HttpBasicAuth.java src/main/java/org/openapitools/client/auth/HttpBearerAuth.java src/main/java/org/openapitools/client/model/Foo.java +src/main/java/org/openapitools/client/model/UploadPostDefaultResponse.java src/main/java/org/openapitools/client/model/package-info.java src/main/java/org/openapitools/client/package-info.java 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..e2fe5cdc9d6c 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,12 @@ 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); + File result = apiInstance.downloadIdGet(id); System.out.println(result); } catch (ApiException e) { - System.err.println("Exception when calling DefaultApi#fooDtParamGet"); + System.err.println("Exception when calling DefaultApi#downloadIdGet"); System.err.println("Status code: " + e.getCode()); System.err.println("Reason: " + e.getResponseBody()); System.err.println("Response headers: " + e.getResponseHeaders()); @@ -117,6 +115,7 @@ All URIs are relative to *http://localhost* Class | Method | HTTP request | Description ------------ | ------------- | ------------- | ------------- +*DefaultApi* | [**downloadIdGet**](docs/DefaultApi.md#downloadIdGet) | **GET** /download/{id} | *DefaultApi* | [**fooDtParamGet**](docs/DefaultApi.md#fooDtParamGet) | **GET** /foo/{dtParam} | *DefaultApi* | [**uploadPost**](docs/DefaultApi.md#uploadPost) | **POST** /upload | @@ -124,6 +123,7 @@ Class | Method | HTTP request | Description ## Documentation for Models - [Foo](docs/Foo.md) + - [UploadPostDefaultResponse](docs/UploadPostDefaultResponse.md) 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..c56e7b0a70c4 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 @@ -52,10 +52,34 @@ paths: description: file responses: default: + content: + application/json: + schema: + $ref: "#/components/schemas/_upload_post_default_response" description: ok x-content-type: multipart/form-data x-accepts: - application/json + /download/{id}: + get: + parameters: + - explode: false + in: path + name: id + required: true + schema: + type: string + style: simple + responses: + "200": + content: + application/octet-stream: + schema: + format: binary + type: string + description: ok + x-accepts: + - application/octet-stream components: schemas: Foo: @@ -100,5 +124,17 @@ components: file: format: binary type: string + metadata: + format: binary + type: string + required: + - file type: object + _upload_post_default_response: + example: + id: 046b6c7f-0b8a-43b9-b35d-6489e6daee91 + properties: + id: + format: uuid + type: string 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..29e263ac5813 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,76 @@ All URIs are relative to *http://localhost* | Method | HTTP request | Description | |------------- | ------------- | -------------| +| [**downloadIdGet**](DefaultApi.md#downloadIdGet) | **GET** /download/{id} | | | [**fooDtParamGet**](DefaultApi.md#fooDtParamGet) | **GET** /foo/{dtParam} | | | [**uploadPost**](DefaultApi.md#uploadPost) | **POST** /upload | | +## downloadIdGet + +> File downloadIdGet(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 { + File result = apiInstance.downloadIdGet(id); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling DefaultApi#downloadIdGet"); + 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 + +[**File**](File.md) + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/octet-stream + + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | ok | - | + + ## fooDtParamGet > Foo fooDtParamGet(dtParam, dtQuery, dtCookie) @@ -79,7 +144,7 @@ No authorization required ## uploadPost -> uploadPost(_file) +> UploadPostDefaultResponse uploadPost(_file, metadata) @@ -100,8 +165,10 @@ public class Example { DefaultApi apiInstance = new DefaultApi(defaultClient); File _file = new File("/path/to/file"); // File | + File metadata = new File("/path/to/file"); // File | try { - apiInstance.uploadPost(_file); + UploadPostDefaultResponse result = apiInstance.uploadPost(_file, metadata); + System.out.println(result); } catch (ApiException e) { System.err.println("Exception when calling DefaultApi#uploadPost"); System.err.println("Status code: " + e.getCode()); @@ -118,11 +185,12 @@ public class Example { | Name | Type | Description | Notes | |------------- | ------------- | ------------- | -------------| -| **_file** | **File**| | [optional] | +| **_file** | **File**| | | +| **metadata** | **File**| | [optional] | ### Return type -null (empty response body) +[**UploadPostDefaultResponse**](UploadPostDefaultResponse.md) ### Authorization @@ -131,7 +199,7 @@ No authorization required ### HTTP request headers - **Content-Type**: multipart/form-data -- **Accept**: Not defined +- **Accept**: application/json ### HTTP response details diff --git a/samples/client/petstore/java/webclient-springBoot4-jackson3-jspecify/docs/UploadPostDefaultResponse.md b/samples/client/petstore/java/webclient-springBoot4-jackson3-jspecify/docs/UploadPostDefaultResponse.md new file mode 100644 index 000000000000..e80266b51339 --- /dev/null +++ b/samples/client/petstore/java/webclient-springBoot4-jackson3-jspecify/docs/UploadPostDefaultResponse.md @@ -0,0 +1,13 @@ + + +# UploadPostDefaultResponse + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**id** | **UUID** | | [optional] | + + + 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..89386a51d394 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 @@ -6,6 +6,7 @@ import org.openapitools.client.model.Foo; import org.jspecify.annotations.Nullable; import java.time.OffsetDateTime; +import org.openapitools.client.model.UploadPostDefaultResponse; import java.util.HashMap; import java.util.List; @@ -49,6 +50,81 @@ public void setApiClient(ApiClient apiClient) { this.apiClient = apiClient; } + /** + * + * + *

200 - ok + * @param id The id parameter + * @return File + * @throws WebClientResponseException if an error occurs while attempting to invoke the API + */ + private ResponseSpec downloadIdGetRequestCreation(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 downloadIdGet", 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 = { + "application/octet-stream" + }; + 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("/download/{id}", HttpMethod.GET, pathParams, queryParams, postBody, headerParams, cookieParams, formParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); + } + + /** + * + * + *

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

200 - ok + * @param id The id parameter + * @return ResponseEntity<File> + * @throws WebClientResponseException if an error occurs while attempting to invoke the API + */ + public Mono> downloadIdGetWithHttpInfo(String id) throws WebClientResponseException { + ParameterizedTypeReference localVarReturnType = new ParameterizedTypeReference() {}; + return downloadIdGetRequestCreation(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 downloadIdGetWithResponseSpec(String id) throws WebClientResponseException { + return downloadIdGetRequestCreation(id); + } + /** * * @@ -137,10 +213,16 @@ public ResponseSpec fooDtParamGetWithResponseSpec(java.time.@Nullable Instant dt * *

0 - ok * @param _file The _file parameter + * @param metadata The metadata parameter + * @return UploadPostDefaultResponse * @throws WebClientResponseException if an error occurs while attempting to invoke the API */ - private ResponseSpec uploadPostRequestCreation(@Nullable File _file) throws WebClientResponseException { + private ResponseSpec uploadPostRequestCreation(File _file, @Nullable File metadata) throws WebClientResponseException { Object postBody = null; + // verify the required parameter '_file' is set + if (_file == null) { + throw new WebClientResponseException("Missing the required parameter '_file' when calling uploadPost", HttpStatus.BAD_REQUEST.value(), HttpStatus.BAD_REQUEST.getReasonPhrase(), null, null, null); + } // create path and map variables final Map pathParams = new HashMap(); @@ -151,8 +233,12 @@ private ResponseSpec uploadPostRequestCreation(@Nullable File _file) throws WebC if (_file != null) formParams.add("file", new FileSystemResource(_file)); + if (metadata != null) + formParams.add("metadata", new FileSystemResource(metadata)); - final String[] localVarAccepts = { }; + final String[] localVarAccepts = { + "application/json" + }; final List localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); final String[] localVarContentTypes = { "multipart/form-data" @@ -161,7 +247,7 @@ private ResponseSpec uploadPostRequestCreation(@Nullable File _file) throws WebC String[] localVarAuthNames = new String[] { }; - ParameterizedTypeReference localVarReturnType = new ParameterizedTypeReference() {}; + ParameterizedTypeReference localVarReturnType = new ParameterizedTypeReference() {}; return apiClient.invokeAPI("/upload", HttpMethod.POST, pathParams, queryParams, postBody, headerParams, cookieParams, formParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); } @@ -170,11 +256,13 @@ private ResponseSpec uploadPostRequestCreation(@Nullable File _file) throws WebC * *

0 - ok * @param _file The _file parameter + * @param metadata The metadata parameter + * @return UploadPostDefaultResponse * @throws WebClientResponseException if an error occurs while attempting to invoke the API */ - public Mono uploadPost(@Nullable File _file) throws WebClientResponseException { - ParameterizedTypeReference localVarReturnType = new ParameterizedTypeReference() {}; - return uploadPostRequestCreation(_file).bodyToMono(localVarReturnType); + public Mono uploadPost(File _file, @Nullable File metadata) throws WebClientResponseException { + ParameterizedTypeReference localVarReturnType = new ParameterizedTypeReference() {}; + return uploadPostRequestCreation(_file, metadata).bodyToMono(localVarReturnType); } /** @@ -182,11 +270,13 @@ public Mono uploadPost(@Nullable File _file) throws WebClientResponseExcep * *

0 - ok * @param _file The _file parameter + * @param metadata The metadata parameter + * @return ResponseEntity<UploadPostDefaultResponse> * @throws WebClientResponseException if an error occurs while attempting to invoke the API */ - public Mono> uploadPostWithHttpInfo(@Nullable File _file) throws WebClientResponseException { - ParameterizedTypeReference localVarReturnType = new ParameterizedTypeReference() {}; - return uploadPostRequestCreation(_file).toEntity(localVarReturnType); + public Mono> uploadPostWithHttpInfo(File _file, @Nullable File metadata) throws WebClientResponseException { + ParameterizedTypeReference localVarReturnType = new ParameterizedTypeReference() {}; + return uploadPostRequestCreation(_file, metadata).toEntity(localVarReturnType); } /** @@ -194,10 +284,11 @@ public Mono> uploadPostWithHttpInfo(@Nullable File _file) t * *

0 - ok * @param _file The _file parameter + * @param metadata The metadata parameter * @return ResponseSpec * @throws WebClientResponseException if an error occurs while attempting to invoke the API */ - public ResponseSpec uploadPostWithResponseSpec(@Nullable File _file) throws WebClientResponseException { - return uploadPostRequestCreation(_file); + public ResponseSpec uploadPostWithResponseSpec(File _file, @Nullable File metadata) throws WebClientResponseException { + return uploadPostRequestCreation(_file, metadata); } } diff --git a/samples/client/petstore/java/webclient-springBoot4-jackson3-jspecify/src/main/java/org/openapitools/client/model/UploadPostDefaultResponse.java b/samples/client/petstore/java/webclient-springBoot4-jackson3-jspecify/src/main/java/org/openapitools/client/model/UploadPostDefaultResponse.java new file mode 100644 index 000000000000..c8e93b7b04d8 --- /dev/null +++ b/samples/client/petstore/java/webclient-springBoot4-jackson3-jspecify/src/main/java/org/openapitools/client/model/UploadPostDefaultResponse.java @@ -0,0 +1,105 @@ +/* + * 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.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import java.util.UUID; +import org.jspecify.annotations.Nullable; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import com.fasterxml.jackson.annotation.JsonTypeName; + +/** + * UploadPostDefaultResponse + */ +@JsonPropertyOrder({ + UploadPostDefaultResponse.JSON_PROPERTY_ID +}) +@JsonTypeName("_upload_post_default_response") +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.23.0-SNAPSHOT") +public class UploadPostDefaultResponse { + public static final String JSON_PROPERTY_ID = "id"; + + private @Nullable UUID id; + + public UploadPostDefaultResponse() { + } + + public UploadPostDefaultResponse id(@Nullable UUID id) { + + this.id = id; + return this; + } + + /** + * Get id + * @return id + */ + + @JsonProperty(value = JSON_PROPERTY_ID, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + + public @Nullable UUID getId() { + return id; + } + + + @JsonProperty(value = JSON_PROPERTY_ID, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setId(@Nullable UUID id) { + this.id = id; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + UploadPostDefaultResponse uploadPostDefaultResponse = (UploadPostDefaultResponse) o; + return Objects.equals(this.id, uploadPostDefaultResponse.id); + } + + @Override + public int hashCode() { + return Objects.hash(id); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class UploadPostDefaultResponse {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + +} + diff --git a/samples/client/petstore/java/webclient-springBoot4-jackson3-jspecify/src/test/java/org/openapitools/client/api/DefaultApiTest.java b/samples/client/petstore/java/webclient-springBoot4-jackson3-jspecify/src/test/java/org/openapitools/client/api/DefaultApiTest.java index 706e3b1b6de3..5f350074dd1d 100644 --- a/samples/client/petstore/java/webclient-springBoot4-jackson3-jspecify/src/test/java/org/openapitools/client/api/DefaultApiTest.java +++ b/samples/client/petstore/java/webclient-springBoot4-jackson3-jspecify/src/test/java/org/openapitools/client/api/DefaultApiTest.java @@ -17,6 +17,7 @@ import org.openapitools.client.model.Foo; import org.jspecify.annotations.Nullable; import java.time.OffsetDateTime; +import org.openapitools.client.model.UploadPostDefaultResponse; import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Disabled; import org.junit.jupiter.api.Test; @@ -36,6 +37,20 @@ public class DefaultApiTest { private final DefaultApi api = new DefaultApi(); + /** + * + * + * + */ + @Test + public void downloadIdGetTest() { + // uncomment below to test the function + //String id = null; + //File response = api.downloadIdGet(id).block(); + + // TODO: test validations + } + /** * * @@ -44,9 +59,9 @@ public class DefaultApiTest { @Test public void fooDtParamGetTest() { // uncomment below to test the function - //OffsetDateTime dtParam = null; - //OffsetDateTime dtQuery = null; - //OffsetDateTime dtCookie = null; + //java.time.Instant dtParam = null; + //java.time.Instant dtQuery = null; + //java.time.Instant dtCookie = null; //Foo response = api.fooDtParamGet(dtParam, dtQuery, dtCookie).block(); // TODO: test validations @@ -61,7 +76,8 @@ public void fooDtParamGetTest() { public void uploadPostTest() { // uncomment below to test the function //File _file = null; - //api.uploadPost(_file).block(); + //File metadata = null; + //UploadPostDefaultResponse response = api.uploadPost(_file, metadata).block(); // TODO: test validations } diff --git a/samples/client/petstore/java/webclient-springBoot4-jackson3-jspecify/src/test/java/org/openapitools/client/model/UploadPostDefaultResponseTest.java b/samples/client/petstore/java/webclient-springBoot4-jackson3-jspecify/src/test/java/org/openapitools/client/model/UploadPostDefaultResponseTest.java new file mode 100644 index 000000000000..6d0f7c414784 --- /dev/null +++ b/samples/client/petstore/java/webclient-springBoot4-jackson3-jspecify/src/test/java/org/openapitools/client/model/UploadPostDefaultResponseTest.java @@ -0,0 +1,49 @@ +/* + * 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.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import java.util.UUID; +import org.jspecify.annotations.Nullable; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for UploadPostDefaultResponse + */ +class UploadPostDefaultResponseTest { + private final UploadPostDefaultResponse model = new UploadPostDefaultResponse(); + + /** + * Model tests for UploadPostDefaultResponse + */ + @Test + void testUploadPostDefaultResponse() { + // TODO: test UploadPostDefaultResponse + } + + /** + * Test the property 'id' + */ + @Test + void idTest() { + // TODO: test 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..2c7a524f5c12 100644 --- a/samples/openapi3/server/petstore/springboot-4-jspecify/.openapi-generator/FILES +++ b/samples/openapi3/server/petstore/springboot-4-jspecify/.openapi-generator/FILES @@ -1,8 +1,11 @@ +.openapi-generator-ignore README.md pom.xml src/main/java/org/openapitools/api/ApiUtil.java +src/main/java/org/openapitools/api/DownloadApi.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 src/main/java/org/openapitools/model/Foo.java +src/main/java/org/openapitools/model/UploadPostDefaultResponse.java src/main/java/org/openapitools/model/package-info.java diff --git a/samples/openapi3/server/petstore/springboot-4-jspecify/src/main/java/org/openapitools/api/DownloadApi.java b/samples/openapi3/server/petstore/springboot-4-jspecify/src/main/java/org/openapitools/api/DownloadApi.java new file mode 100644 index 000000000000..20680b7af10f --- /dev/null +++ b/samples/openapi3/server/petstore/springboot-4-jspecify/src/main/java/org/openapitools/api/DownloadApi.java @@ -0,0 +1,71 @@ +/* + * 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 = "download", description = "the download API") +public interface DownloadApi { + + default Optional getRequest() { + return Optional.empty(); + } + + String PATH_DOWNLOAD_ID_GET = "/download/{id}"; + /** + * GET /download/{id} + * + * @param id (required) + * @return ok (status code 200) + */ + @Operation( + operationId = "downloadIdGet", + responses = { + @ApiResponse(responseCode = "200", description = "ok", content = { + @Content(mediaType = "application/octet-stream", schema = @Schema(implementation = org.springframework.core.io.Resource.class)) + }) + } + ) + @RequestMapping( + method = RequestMethod.GET, + value = DownloadApi.PATH_DOWNLOAD_ID_GET, + produces = { "application/octet-stream" } + ) + default ResponseEntity downloadIdGet( + @Parameter(name = "id", description = "", required = true, in = ParameterIn.PATH) @PathVariable("id") String id + ) { + return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED); + + } + +} diff --git a/samples/openapi3/server/petstore/springboot-4-jspecify/src/main/java/org/openapitools/api/UploadApi.java b/samples/openapi3/server/petstore/springboot-4-jspecify/src/main/java/org/openapitools/api/UploadApi.java index 616d6a474924..96b406084cf2 100644 --- a/samples/openapi3/server/petstore/springboot-4-jspecify/src/main/java/org/openapitools/api/UploadApi.java +++ b/samples/openapi3/server/petstore/springboot-4-jspecify/src/main/java/org/openapitools/api/UploadApi.java @@ -6,6 +6,7 @@ package org.openapitools.api; import org.jspecify.annotations.Nullable; +import org.openapitools.model.UploadPostDefaultResponse; import io.swagger.v3.oas.annotations.ExternalDocumentation; import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.Parameter; @@ -46,23 +47,37 @@ default Optional getRequest() { /** * POST /upload * - * @param file (optional) + * @param file (required) + * @param metadata (optional) * @return ok (status code 200) */ @Operation( operationId = "uploadPost", responses = { - @ApiResponse(responseCode = "default", description = "ok") + @ApiResponse(responseCode = "default", description = "ok", content = { + @Content(mediaType = "application/json", schema = @Schema(implementation = UploadPostDefaultResponse.class)) + }) } ) @RequestMapping( method = RequestMethod.POST, value = UploadApi.PATH_UPLOAD_POST, + produces = { "application/json" }, consumes = { "multipart/form-data" } ) - default ResponseEntity uploadPost( - @Parameter(name = "file", description = "") @RequestPart(value = "file", required = false) MultipartFile file + default ResponseEntity uploadPost( + @Parameter(name = "file", description = "", required = true) @RequestPart(value = "file", required = true) MultipartFile file, + @Parameter(name = "metadata", description = "") @RequestPart(value = "metadata", required = false) MultipartFile metadata ) { + getRequest().ifPresent(request -> { + for (MediaType mediaType: MediaType.parseMediaTypes(request.getHeader("Accept"))) { + if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { + String exampleString = "{ \"id\" : \"046b6c7f-0b8a-43b9-b35d-6489e6daee91\" }"; + ApiUtil.setExampleResponse(request, "application/json", exampleString); + break; + } + } + }); return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED); } diff --git a/samples/openapi3/server/petstore/springboot-4-jspecify/src/main/java/org/openapitools/model/UploadPostDefaultResponse.java b/samples/openapi3/server/petstore/springboot-4-jspecify/src/main/java/org/openapitools/model/UploadPostDefaultResponse.java new file mode 100644 index 000000000000..14774d8b0057 --- /dev/null +++ b/samples/openapi3/server/petstore/springboot-4-jspecify/src/main/java/org/openapitools/model/UploadPostDefaultResponse.java @@ -0,0 +1,163 @@ +package org.openapitools.model; + +import java.net.URI; +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import java.util.UUID; +import org.jspecify.annotations.Nullable; +import java.time.OffsetDateTime; +import jakarta.validation.Valid; +import jakarta.validation.constraints.*; +import tools.jackson.dataformat.xml.annotation.JacksonXmlRootElement; +import tools.jackson.dataformat.xml.annotation.JacksonXmlProperty; +import tools.jackson.dataformat.xml.annotation.JacksonXmlElementWrapper; +import io.swagger.v3.oas.annotations.media.Schema; + +import jakarta.xml.bind.annotation.*; + +import java.util.*; +import jakarta.annotation.Generated; + +/** + * UploadPostDefaultResponse + */ + +@JsonTypeName("_upload_post_default_response") +@JacksonXmlRootElement(localName = "UploadPostDefaultResponse") +@XmlRootElement(name = "UploadPostDefaultResponse") +@XmlAccessorType(XmlAccessType.FIELD) +@Generated(value = "org.openapitools.codegen.languages.SpringCodegen", comments = "Generator version: 7.23.0-SNAPSHOT") +public class UploadPostDefaultResponse { + + private @Nullable UUID id; + + public UploadPostDefaultResponse() { + super(); + } + + /** + * Constructor with all args parameters + */ + public UploadPostDefaultResponse(UUID id) { + this.id = id; + } + + public UploadPostDefaultResponse id(UUID id) { + this.id = id; + return this; + } + + /** + * Get id + * @return id + */ + @Valid + @Schema(name = "id", requiredMode = Schema.RequiredMode.NOT_REQUIRED) + @JsonProperty("id") + @JacksonXmlProperty(localName = "id") + @XmlElement(name = "id") + public @Nullable UUID getId() { + return id; + } + + @JsonProperty("id") + @JacksonXmlProperty(localName = "id") + public void setId(@Nullable UUID id) { + this.id = id; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + UploadPostDefaultResponse uploadPostDefaultResponse = (UploadPostDefaultResponse) o; + return Objects.equals(this.id, uploadPostDefaultResponse.id); + } + + @Override + public int hashCode() { + return Objects.hash(id); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class UploadPostDefaultResponse {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + public static class Builder { + + private UploadPostDefaultResponse instance; + + public Builder() { + this(new UploadPostDefaultResponse()); + } + + protected Builder(UploadPostDefaultResponse instance) { + this.instance = instance; + } + + protected Builder copyOf(UploadPostDefaultResponse value) { + this.instance.setId(value.id); + return this; + } + + public UploadPostDefaultResponse.Builder id(UUID id) { + this.instance.id(id); + return this; + } + + /** + * returns a built UploadPostDefaultResponse instance. + * + * The builder is not reusable (NullPointerException) + */ + public UploadPostDefaultResponse build() { + try { + return this.instance; + } finally { + // ensure that this.instance is not reused + this.instance = null; + } + } + + @Override + public String toString() { + return getClass() + "=(" + instance + ")"; + } + } + + /** + * Create a builder with no initialized field (except for the default values). + */ + public static UploadPostDefaultResponse.Builder builder() { + return new UploadPostDefaultResponse.Builder(); + } + + /** + * Create a builder with a shallow copy of this instance. + */ + public UploadPostDefaultResponse.Builder toBuilder() { + UploadPostDefaultResponse.Builder builder = new UploadPostDefaultResponse.Builder(); + return builder.copyOf(this); + } + +} +