Skip to content

Commit a436034

Browse files
specific unit test for binary response
1 parent a65d0b8 commit a436034

158 files changed

Lines changed: 656 additions & 4832 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
generatorName: dart-dio
2+
outputDir: samples/openapi3/client/petstore/dart-dio/binary_response
3+
inputSpec: modules/openapi-generator/src/test/resources/3_0/issue_20682.yaml
4+
templateDir: modules/openapi-generator/src/main/resources/dart/libraries/dio
5+
additionalProperties:
6+
hideGenerationTimestamp: "true"
7+
enumUnknownDefaultCase: "true"
8+
serializationLibrary: "json_serializable"
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
openapi: 3.0.0
2+
info:
3+
version: 1.0.0
4+
title: Binary response
5+
paths:
6+
/limits:
7+
get:
8+
operationId: binaryResponse
9+
responses:
10+
'200':
11+
description: OK
12+
content:
13+
application/zip:
14+
schema:
15+
type: string
16+
format: binary

modules/openapi-generator/src/test/resources/3_0/petstore-with-fake-endpoints-models-for-testing.yaml

Lines changed: 0 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -311,33 +311,6 @@ paths:
311311
description: file to upload
312312
type: string
313313
format: binary
314-
'/pet/{petId}/downloadImage':
315-
post:
316-
tags:
317-
- pet
318-
summary: downloads an image
319-
description: ''
320-
operationId: downloadFile
321-
parameters:
322-
- name: petId
323-
in: path
324-
description: ID of pet to update
325-
required: true
326-
schema:
327-
type: integer
328-
format: int64
329-
responses:
330-
'200':
331-
description: successful operation
332-
content:
333-
application/zip:
334-
schema:
335-
type: string
336-
format: binary
337-
security:
338-
- petstore_auth:
339-
- 'write:pets'
340-
- 'read:pets'
341314
/store/inventory:
342315
get:
343316
tags:

samples/client/petstore/java-helidon-client/v3/mp/docs/PetApi.md

Lines changed: 0 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ All URIs are relative to *http://petstore.swagger.io:80/v2*
66
|------------- | ------------- | -------------|
77
| [**addPet**](PetApi.md#addPet) | **POST** /pet | Add a new pet to the store |
88
| [**deletePet**](PetApi.md#deletePet) | **DELETE** /pet/{petId} | Deletes a pet |
9-
| [**downloadFile**](PetApi.md#downloadFile) | **POST** /pet/{petId}/downloadImage | downloads an image |
109
| [**findPetsByStatus**](PetApi.md#findPetsByStatus) | **GET** /pet/findByStatus | Finds Pets by status |
1110
| [**findPetsByTags**](PetApi.md#findPetsByTags) | **GET** /pet/findByTags | Finds Pets by tags |
1211
| [**getPetById**](PetApi.md#getPetById) | **GET** /pet/{petId} | Find pet by ID |
@@ -90,41 +89,6 @@ Deletes a pet
9089
| **400** | Invalid pet value | - |
9190

9291

93-
## downloadFile
94-
95-
> File downloadFile(petId)
96-
97-
downloads an image
98-
99-
100-
101-
### Parameters
102-
103-
104-
| Name | Type | Description | Notes |
105-
|------------- | ------------- | ------------- | -------------|
106-
| **petId** | **Long**| ID of pet to update | |
107-
108-
### Return type
109-
110-
[**File**](File.md)
111-
112-
### Authorization
113-
114-
[petstore_auth](../README.md#petstore_auth)
115-
116-
### HTTP request headers
117-
118-
- **Content-Type**: Not defined
119-
- **Accept**: application/zip
120-
121-
122-
### HTTP response details
123-
| Status code | Description | Response headers |
124-
|-------------|-------------|------------------|
125-
| **200** | successful operation | - |
126-
127-
12892
## findPetsByStatus
12993

13094
> List<Pet> findPetsByStatus(status)

samples/client/petstore/java-helidon-client/v3/mp/src/main/java/org/openapitools/client/api/PetApi.java

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -57,15 +57,6 @@ public interface PetApi {
5757
@Path("/pet/{petId}")
5858
void deletePet(@PathParam("petId") Long petId, @HeaderParam("api_key") String apiKey) throws ApiException, ProcessingException;
5959

60-
/**
61-
* downloads an image
62-
*
63-
*/
64-
@POST
65-
@Path("/pet/{petId}/downloadImage")
66-
@Produces({ "application/zip" })
67-
File downloadFile(@PathParam("petId") Long petId) throws ApiException, ProcessingException;
68-
6960
/**
7061
* Finds Pets by status
7162
* Multiple status values can be provided with comma separated strings

samples/client/petstore/java-helidon-client/v3/se/docs/PetApi.md

Lines changed: 0 additions & 72 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ All URIs are relative to *http://petstore.swagger.io:80/v2*
66
|------------- | ------------- | -------------|
77
| [**addPet**](PetApi.md#addPet) | **POST** /pet | Add a new pet to the store |
88
| [**deletePet**](PetApi.md#deletePet) | **DELETE** /pet/{petId} | Deletes a pet |
9-
| [**downloadFile**](PetApi.md#downloadFile) | **POST** /pet/{petId}/downloadImage | downloads an image |
109
| [**findPetsByStatus**](PetApi.md#findPetsByStatus) | **GET** /pet/findByStatus | Finds Pets by status |
1110
| [**findPetsByTags**](PetApi.md#findPetsByTags) | **GET** /pet/findByTags | Finds Pets by tags |
1211
| [**getPetById**](PetApi.md#getPetById) | **GET** /pet/{petId} | Find pet by ID |
@@ -161,77 +160,6 @@ null (empty response body)
161160
| **400** | Invalid pet value | - |
162161

163162

164-
## downloadFile
165-
166-
> File downloadFile(petId)
167-
168-
downloads an image
169-
170-
171-
172-
### Example
173-
174-
```java
175-
// Import classes:
176-
import org.openapitools.client.ApiClient;
177-
import org.openapitools.client.ApiException;
178-
import org.openapitools.client.Configuration;
179-
import org.openapitools.client.auth.*;
180-
import org.openapitools.client.models.*;
181-
import org.openapitools.client.api.PetApi;
182-
183-
public class Example {
184-
public static void main(String[] args) {
185-
ApiClient defaultClient = Configuration.getDefaultApiClient();
186-
defaultClient.setBasePath("http://petstore.swagger.io:80/v2");
187-
188-
// Configure OAuth2 access token for authorization: petstore_auth
189-
OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth");
190-
petstore_auth.setAccessToken("YOUR ACCESS TOKEN");
191-
192-
PetApi apiInstance = new PetApi(defaultClient);
193-
Long petId = 56L; // Long | ID of pet to update
194-
try {
195-
File result = apiInstance.downloadFile(petId);
196-
System.out.println(result);
197-
} catch (ApiException e) {
198-
System.err.println("Exception when calling PetApi#downloadFile");
199-
System.err.println("Status code: " + e.getCode());
200-
System.err.println("Reason: " + e.getResponseBody());
201-
System.err.println("Response headers: " + e.getResponseHeaders());
202-
e.printStackTrace();
203-
}
204-
}
205-
}
206-
```
207-
208-
### Parameters
209-
210-
211-
| Name | Type | Description | Notes |
212-
|------------- | ------------- | ------------- | -------------|
213-
| **petId** | **Long**| ID of pet to update | |
214-
215-
### Return type
216-
217-
[**File**](File.md)
218-
219-
### Authorization
220-
221-
[petstore_auth](../README.md#petstore_auth)
222-
223-
### HTTP request headers
224-
225-
- **Content-Type**: Not defined
226-
- **Accept**: application/zip
227-
228-
229-
### HTTP response details
230-
| Status code | Description | Response headers |
231-
|-------------|-------------|------------------|
232-
| **200** | successful operation | - |
233-
234-
235163
## findPetsByStatus
236164

237165
> List<Pet> findPetsByStatus(status)

samples/client/petstore/java-helidon-client/v3/se/src/main/java/org/openapitools/client/api/PetApi.java

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -44,14 +44,6 @@ public interface PetApi {
4444
*/
4545
ApiResponse<Void> deletePet(Long petId, String apiKey);
4646

47-
/**
48-
* downloads an image
49-
*
50-
* @param petId ID of pet to update (required)
51-
* @return {@code ApiResponse<File>}
52-
*/
53-
ApiResponse<File> downloadFile(Long petId);
54-
5547
/**
5648
* Finds Pets by status
5749
* Multiple status values can be provided with comma separated strings

samples/client/petstore/java-helidon-client/v3/se/src/main/java/org/openapitools/client/api/PetApiImpl.java

Lines changed: 0 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,6 @@ public class PetApiImpl implements PetApi {
5151

5252
protected static final GenericType<Void> RESPONSE_TYPE_addPet = ResponseType.create(Void.class);
5353
protected static final GenericType<Void> RESPONSE_TYPE_deletePet = ResponseType.create(Void.class);
54-
protected static final GenericType<File> RESPONSE_TYPE_downloadFile = ResponseType.create(File.class);
5554
protected static final GenericType<List<Pet>> RESPONSE_TYPE_findPetsByStatus = ResponseType.create(List.class, Pet.class);
5655
protected static final GenericType<List<Pet>> RESPONSE_TYPE_findPetsByTags = ResponseType.create(List.class, Pet.class);
5756
protected static final GenericType<Pet> RESPONSE_TYPE_getPetById = ResponseType.create(Pet.class);
@@ -156,45 +155,6 @@ protected ApiResponse<Void> deletePetSubmit(WebClientRequestBuilder webClientReq
156155
return ApiResponse.create(RESPONSE_TYPE_deletePet, webClientResponse);
157156
}
158157

159-
@Override
160-
public ApiResponse<File> downloadFile(Long petId) {
161-
Objects.requireNonNull(petId, "Required parameter 'petId' not specified");
162-
WebClientRequestBuilder webClientRequestBuilder = downloadFileRequestBuilder(petId);
163-
return downloadFileSubmit(webClientRequestBuilder, petId);
164-
}
165-
166-
/**
167-
* Creates a {@code WebClientRequestBuilder} for the downloadFile operation.
168-
* Optional customization point for subclasses.
169-
*
170-
* @param petId ID of pet to update (required)
171-
* @return WebClientRequestBuilder for downloadFile
172-
*/
173-
protected WebClientRequestBuilder downloadFileRequestBuilder(Long petId) {
174-
WebClientRequestBuilder webClientRequestBuilder = apiClient.webClient()
175-
.method("POST");
176-
177-
String path = "/pet/{petId}/downloadImage"
178-
.replace("{petId}", ApiClient.urlEncode(petId.toString()));
179-
webClientRequestBuilder.path(path);
180-
webClientRequestBuilder.accept(MediaType.APPLICATION_JSON);
181-
182-
return webClientRequestBuilder;
183-
}
184-
185-
/**
186-
* Initiates the request for the downloadFile operation.
187-
* Optional customization point for subclasses.
188-
*
189-
* @param webClientRequestBuilder the request builder to use for submitting the request
190-
* @param petId ID of pet to update (required)
191-
* @return {@code ApiResponse<File>} for the submitted request
192-
*/
193-
protected ApiResponse<File> downloadFileSubmit(WebClientRequestBuilder webClientRequestBuilder, Long petId) {
194-
Single<WebClientResponse> webClientResponse = webClientRequestBuilder.submit();
195-
return ApiResponse.create(RESPONSE_TYPE_downloadFile, webClientResponse);
196-
}
197-
198158
@Override
199159
public ApiResponse<List<Pet>> findPetsByStatus(List<String> status) {
200160
Objects.requireNonNull(status, "Required parameter 'status' not specified");

samples/client/petstore/java-helidon-client/v4/mp/docs/PetApi.md

Lines changed: 0 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ All URIs are relative to *http://petstore.swagger.io:80/v2*
66
|------------- | ------------- | -------------|
77
| [**addPet**](PetApi.md#addPet) | **POST** /pet | Add a new pet to the store |
88
| [**deletePet**](PetApi.md#deletePet) | **DELETE** /pet/{petId} | Deletes a pet |
9-
| [**downloadFile**](PetApi.md#downloadFile) | **POST** /pet/{petId}/downloadImage | downloads an image |
109
| [**findPetsByStatus**](PetApi.md#findPetsByStatus) | **GET** /pet/findByStatus | Finds Pets by status |
1110
| [**findPetsByTags**](PetApi.md#findPetsByTags) | **GET** /pet/findByTags | Finds Pets by tags |
1211
| [**getPetById**](PetApi.md#getPetById) | **GET** /pet/{petId} | Find pet by ID |
@@ -90,41 +89,6 @@ Deletes a pet
9089
| **400** | Invalid pet value | - |
9190

9291

93-
## downloadFile
94-
95-
> File downloadFile(petId)
96-
97-
downloads an image
98-
99-
100-
101-
### Parameters
102-
103-
104-
| Name | Type | Description | Notes |
105-
|------------- | ------------- | ------------- | -------------|
106-
| **petId** | **Long**| ID of pet to update | |
107-
108-
### Return type
109-
110-
[**File**](File.md)
111-
112-
### Authorization
113-
114-
[petstore_auth](../README.md#petstore_auth)
115-
116-
### HTTP request headers
117-
118-
- **Content-Type**: Not defined
119-
- **Accept**: application/zip
120-
121-
122-
### HTTP response details
123-
| Status code | Description | Response headers |
124-
|-------------|-------------|------------------|
125-
| **200** | successful operation | - |
126-
127-
12892
## findPetsByStatus
12993

13094
> List&lt;Pet&gt; findPetsByStatus(status)

samples/client/petstore/java-helidon-client/v4/mp/src/main/java/org/openapitools/client/api/PetApi.java

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -58,15 +58,6 @@ public interface PetApi {
5858
@Path("/pet/{petId}")
5959
void deletePet(@PathParam("petId") Long petId, @HeaderParam("api_key") String apiKey) throws ApiException, ProcessingException;
6060

61-
/**
62-
* downloads an image
63-
*
64-
*/
65-
@POST
66-
@Path("/pet/{petId}/downloadImage")
67-
@Produces({ "application/zip" })
68-
File downloadFile(@PathParam("petId") Long petId) throws ApiException, ProcessingException;
69-
7061
/**
7162
* Finds Pets by status
7263
* Multiple status values can be provided with comma separated strings

0 commit comments

Comments
 (0)