Skip to content

Commit 867aaa4

Browse files
authored
update petstore samples (#478)
1 parent d43801a commit 867aaa4

5 files changed

Lines changed: 216 additions & 2 deletions

File tree

samples/client/petstore/java/webclient/docs/FakeApi.md

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ Method | HTTP request | Description
88
[**fakeOuterCompositeSerialize**](FakeApi.md#fakeOuterCompositeSerialize) | **POST** /fake/outer/composite |
99
[**fakeOuterNumberSerialize**](FakeApi.md#fakeOuterNumberSerialize) | **POST** /fake/outer/number |
1010
[**fakeOuterStringSerialize**](FakeApi.md#fakeOuterStringSerialize) | **POST** /fake/outer/string |
11+
[**testBodyWithFileSchema**](FakeApi.md#testBodyWithFileSchema) | **PUT** /fake/body-with-file-schema |
1112
[**testBodyWithQueryParams**](FakeApi.md#testBodyWithQueryParams) | **PUT** /fake/body-with-query-params |
1213
[**testClientModel**](FakeApi.md#testClientModel) | **PATCH** /fake | To test \"client\" model
1314
[**testEndpointParameters**](FakeApi.md#testEndpointParameters) | **POST** /fake | Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트
@@ -196,6 +197,50 @@ No authorization required
196197
- **Content-Type**: Not defined
197198
- **Accept**: */*
198199

200+
<a name="testBodyWithFileSchema"></a>
201+
# **testBodyWithFileSchema**
202+
> testBodyWithFileSchema(fileSchemaTestClass)
203+
204+
205+
206+
For this test, the body for this request much reference a schema named &#x60;File&#x60;.
207+
208+
### Example
209+
```java
210+
// Import classes:
211+
//import org.openapitools.client.ApiException;
212+
//import org.openapitools.client.api.FakeApi;
213+
214+
215+
FakeApi apiInstance = new FakeApi();
216+
FileSchemaTestClass fileSchemaTestClass = new FileSchemaTestClass(); // FileSchemaTestClass |
217+
try {
218+
apiInstance.testBodyWithFileSchema(fileSchemaTestClass);
219+
} catch (ApiException e) {
220+
System.err.println("Exception when calling FakeApi#testBodyWithFileSchema");
221+
e.printStackTrace();
222+
}
223+
```
224+
225+
### Parameters
226+
227+
Name | Type | Description | Notes
228+
------------- | ------------- | ------------- | -------------
229+
**fileSchemaTestClass** | [**FileSchemaTestClass**](FileSchemaTestClass.md)| |
230+
231+
### Return type
232+
233+
null (empty response body)
234+
235+
### Authorization
236+
237+
No authorization required
238+
239+
### HTTP request headers
240+
241+
- **Content-Type**: application/json
242+
- **Accept**: Not defined
243+
199244
<a name="testBodyWithQueryParams"></a>
200245
# **testBodyWithQueryParams**
201246
> testBodyWithQueryParams(query, user)
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
2+
# FileSchemaTestClass
3+
4+
## Properties
5+
Name | Type | Description | Notes
6+
------------ | ------------- | ------------- | -------------
7+
**file** | [**java.io.File**](java.io.File.md) | | [optional]
8+
**files** | [**List&lt;java.io.File&gt;**](java.io.File.md) | | [optional]
9+
10+
11+

samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/api/FakeApi.java

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
import java.math.BigDecimal;
66
import org.openapitools.client.model.Client;
77
import java.io.File;
8+
import org.openapitools.client.model.FileSchemaTestClass;
89
import java.time.LocalDate;
910
import java.time.OffsetDateTime;
1011
import org.openapitools.client.model.OuterComposite;
@@ -167,6 +168,39 @@ public Mono<String> fakeOuterStringSerialize(String body) throws RestClientExcep
167168
ParameterizedTypeReference<String> returnType = new ParameterizedTypeReference<String>() {};
168169
return apiClient.invokeAPI(path, HttpMethod.POST, queryParams, postBody, headerParams, formParams, accept, contentType, authNames, returnType);
169170
}
171+
/**
172+
*
173+
* For this test, the body for this request much reference a schema named &#x60;File&#x60;.
174+
* <p><b>200</b> - Success
175+
* @param fileSchemaTestClass The fileSchemaTestClass parameter
176+
* @throws RestClientException if an error occurs while attempting to invoke the API
177+
*/
178+
public Mono<Void> testBodyWithFileSchema(FileSchemaTestClass fileSchemaTestClass) throws RestClientException {
179+
Object postBody = fileSchemaTestClass;
180+
181+
// verify the required parameter 'fileSchemaTestClass' is set
182+
if (fileSchemaTestClass == null) {
183+
throw new HttpClientErrorException(HttpStatus.BAD_REQUEST, "Missing the required parameter 'fileSchemaTestClass' when calling testBodyWithFileSchema");
184+
}
185+
186+
String path = UriComponentsBuilder.fromPath("/fake/body-with-file-schema").build().toUriString();
187+
188+
final MultiValueMap<String, String> queryParams = new LinkedMultiValueMap<String, String>();
189+
final HttpHeaders headerParams = new HttpHeaders();
190+
final MultiValueMap<String, Object> formParams = new LinkedMultiValueMap<String, Object>();
191+
192+
final String[] accepts = { };
193+
final List<MediaType> accept = apiClient.selectHeaderAccept(accepts);
194+
final String[] contentTypes = {
195+
"application/json"
196+
};
197+
final MediaType contentType = apiClient.selectHeaderContentType(contentTypes);
198+
199+
String[] authNames = new String[] { };
200+
201+
ParameterizedTypeReference<Void> returnType = new ParameterizedTypeReference<Void>() {};
202+
return apiClient.invokeAPI(path, HttpMethod.PUT, queryParams, postBody, headerParams, formParams, accept, contentType, authNames, returnType);
203+
}
170204
/**
171205
*
172206
*
Lines changed: 124 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,124 @@
1+
/*
2+
* OpenAPI Petstore
3+
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
4+
*
5+
* OpenAPI spec version: 1.0.0
6+
*
7+
*
8+
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
9+
* https://openapi-generator.tech
10+
* Do not edit the class manually.
11+
*/
12+
13+
14+
package org.openapitools.client.model;
15+
16+
import java.util.Objects;
17+
import java.util.Arrays;
18+
import com.fasterxml.jackson.annotation.JsonProperty;
19+
import com.fasterxml.jackson.annotation.JsonCreator;
20+
import com.fasterxml.jackson.annotation.JsonValue;
21+
import io.swagger.annotations.ApiModel;
22+
import io.swagger.annotations.ApiModelProperty;
23+
import java.util.ArrayList;
24+
import java.util.List;
25+
26+
/**
27+
* FileSchemaTestClass
28+
*/
29+
30+
public class FileSchemaTestClass {
31+
@JsonProperty("file")
32+
private java.io.File file = null;
33+
34+
@JsonProperty("files")
35+
private List<java.io.File> files = null;
36+
37+
public FileSchemaTestClass file(java.io.File file) {
38+
this.file = file;
39+
return this;
40+
}
41+
42+
/**
43+
* Get file
44+
* @return file
45+
**/
46+
@ApiModelProperty(value = "")
47+
public java.io.File getFile() {
48+
return file;
49+
}
50+
51+
public void setFile(java.io.File file) {
52+
this.file = file;
53+
}
54+
55+
public FileSchemaTestClass files(List<java.io.File> files) {
56+
this.files = files;
57+
return this;
58+
}
59+
60+
public FileSchemaTestClass addFilesItem(java.io.File filesItem) {
61+
if (this.files == null) {
62+
this.files = new ArrayList<>();
63+
}
64+
this.files.add(filesItem);
65+
return this;
66+
}
67+
68+
/**
69+
* Get files
70+
* @return files
71+
**/
72+
@ApiModelProperty(value = "")
73+
public List<java.io.File> getFiles() {
74+
return files;
75+
}
76+
77+
public void setFiles(List<java.io.File> files) {
78+
this.files = files;
79+
}
80+
81+
82+
@Override
83+
public boolean equals(java.lang.Object o) {
84+
if (this == o) {
85+
return true;
86+
}
87+
if (o == null || getClass() != o.getClass()) {
88+
return false;
89+
}
90+
FileSchemaTestClass fileSchemaTestClass = (FileSchemaTestClass) o;
91+
return Objects.equals(this.file, fileSchemaTestClass.file) &&
92+
Objects.equals(this.files, fileSchemaTestClass.files);
93+
}
94+
95+
@Override
96+
public int hashCode() {
97+
return Objects.hash(file, files);
98+
}
99+
100+
101+
@Override
102+
public String toString() {
103+
StringBuilder sb = new StringBuilder();
104+
sb.append("class FileSchemaTestClass {\n");
105+
106+
sb.append(" file: ").append(toIndentedString(file)).append("\n");
107+
sb.append(" files: ").append(toIndentedString(files)).append("\n");
108+
sb.append("}");
109+
return sb.toString();
110+
}
111+
112+
/**
113+
* Convert the given object to string with each line indented by 4 spaces
114+
* (except the first line).
115+
*/
116+
private String toIndentedString(java.lang.Object o) {
117+
if (o == null) {
118+
return "null";
119+
}
120+
return o.toString().replace("\n", "\n ");
121+
}
122+
123+
}
124+

samples/openapi3/client/petstore/php/OpenAPIClient-php/lib/Api/PetApi.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -756,7 +756,7 @@ protected function findPetsByStatusRequest($status)
756756

757757
// query params
758758
if (is_array($status)) {
759-
$status = ObjectSerializer::serializeCollection($status, 'multi', true);
759+
$status = ObjectSerializer::serializeCollection($status, 'csv', true);
760760
}
761761
if ($status !== null) {
762762
$queryParams['status'] = ObjectSerializer::toQueryValue($status);
@@ -1040,7 +1040,7 @@ protected function findPetsByTagsRequest($tags)
10401040

10411041
// query params
10421042
if (is_array($tags)) {
1043-
$tags = ObjectSerializer::serializeCollection($tags, 'multi', true);
1043+
$tags = ObjectSerializer::serializeCollection($tags, 'csv', true);
10441044
}
10451045
if ($tags !== null) {
10461046
$queryParams['tags'] = ObjectSerializer::toQueryValue($tags);

0 commit comments

Comments
 (0)