From 322612718b85cb865887b86c63a52e0ac628c120 Mon Sep 17 00:00:00 2001 From: William Cheng <wing328hk@gmail.com> Date: Thu, 5 Jul 2018 23:38:10 +0800 Subject: [PATCH] update petstore samples --- .../petstore/java/webclient/docs/FakeApi.md | 45 +++++++ .../webclient/docs/FileSchemaTestClass.md | 11 ++ .../org/openapitools/client/api/FakeApi.java | 34 +++++ .../client/model/FileSchemaTestClass.java | 124 ++++++++++++++++++ .../php/OpenAPIClient-php/lib/Api/PetApi.php | 4 +- 5 files changed, 216 insertions(+), 2 deletions(-) create mode 100644 samples/client/petstore/java/webclient/docs/FileSchemaTestClass.md create mode 100644 samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/model/FileSchemaTestClass.java diff --git a/samples/client/petstore/java/webclient/docs/FakeApi.md b/samples/client/petstore/java/webclient/docs/FakeApi.md index 19206a20147..b550c716171 100644 --- a/samples/client/petstore/java/webclient/docs/FakeApi.md +++ b/samples/client/petstore/java/webclient/docs/FakeApi.md @@ -8,6 +8,7 @@ Method | HTTP request | Description [**fakeOuterCompositeSerialize**](FakeApi.md#fakeOuterCompositeSerialize) | **POST** /fake/outer/composite | [**fakeOuterNumberSerialize**](FakeApi.md#fakeOuterNumberSerialize) | **POST** /fake/outer/number | [**fakeOuterStringSerialize**](FakeApi.md#fakeOuterStringSerialize) | **POST** /fake/outer/string | +[**testBodyWithFileSchema**](FakeApi.md#testBodyWithFileSchema) | **PUT** /fake/body-with-file-schema | [**testBodyWithQueryParams**](FakeApi.md#testBodyWithQueryParams) | **PUT** /fake/body-with-query-params | [**testClientModel**](FakeApi.md#testClientModel) | **PATCH** /fake | To test \"client\" model [**testEndpointParameters**](FakeApi.md#testEndpointParameters) | **POST** /fake | Fake endpoint for testing various parameters å‡ç«¯é»ž å½ã®ã‚¨ãƒ³ãƒ‰ãƒã‚¤ãƒ³ãƒˆ 가짜 엔드 í¬ì¸íЏ @@ -196,6 +197,50 @@ No authorization required - **Content-Type**: Not defined - **Accept**: */* +<a name="testBodyWithFileSchema"></a> +# **testBodyWithFileSchema** +> testBodyWithFileSchema(fileSchemaTestClass) + + + +For this test, the body for this request much reference a schema named `File`. + +### Example +```java +// Import classes: +//import org.openapitools.client.ApiException; +//import org.openapitools.client.api.FakeApi; + + +FakeApi apiInstance = new FakeApi(); +FileSchemaTestClass fileSchemaTestClass = new FileSchemaTestClass(); // FileSchemaTestClass | +try { + apiInstance.testBodyWithFileSchema(fileSchemaTestClass); +} catch (ApiException e) { + System.err.println("Exception when calling FakeApi#testBodyWithFileSchema"); + e.printStackTrace(); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **fileSchemaTestClass** | [**FileSchemaTestClass**](FileSchemaTestClass.md)| | + +### Return type + +null (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: Not defined + <a name="testBodyWithQueryParams"></a> # **testBodyWithQueryParams** > testBodyWithQueryParams(query, user) diff --git a/samples/client/petstore/java/webclient/docs/FileSchemaTestClass.md b/samples/client/petstore/java/webclient/docs/FileSchemaTestClass.md new file mode 100644 index 00000000000..95ba647df6f --- /dev/null +++ b/samples/client/petstore/java/webclient/docs/FileSchemaTestClass.md @@ -0,0 +1,11 @@ + +# FileSchemaTestClass + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**file** | [**java.io.File**](java.io.File.md) | | [optional] +**files** | [**List<java.io.File>**](java.io.File.md) | | [optional] + + + diff --git a/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/api/FakeApi.java b/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/api/FakeApi.java index 5337a13513d..6cde4a7f633 100644 --- a/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/api/FakeApi.java +++ b/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/api/FakeApi.java @@ -5,6 +5,7 @@ import org.openapitools.client.ApiClient; import java.math.BigDecimal; import org.openapitools.client.model.Client; import java.io.File; +import org.openapitools.client.model.FileSchemaTestClass; import java.time.LocalDate; import java.time.OffsetDateTime; import org.openapitools.client.model.OuterComposite; @@ -167,6 +168,39 @@ public class FakeApi { ParameterizedTypeReference<String> returnType = new ParameterizedTypeReference<String>() {}; return apiClient.invokeAPI(path, HttpMethod.POST, queryParams, postBody, headerParams, formParams, accept, contentType, authNames, returnType); } + /** + * + * For this test, the body for this request much reference a schema named `File`. + * <p><b>200</b> - Success + * @param fileSchemaTestClass The fileSchemaTestClass parameter + * @throws RestClientException if an error occurs while attempting to invoke the API + */ + public Mono<Void> testBodyWithFileSchema(FileSchemaTestClass fileSchemaTestClass) throws RestClientException { + Object postBody = fileSchemaTestClass; + + // verify the required parameter 'fileSchemaTestClass' is set + if (fileSchemaTestClass == null) { + throw new HttpClientErrorException(HttpStatus.BAD_REQUEST, "Missing the required parameter 'fileSchemaTestClass' when calling testBodyWithFileSchema"); + } + + String path = UriComponentsBuilder.fromPath("/fake/body-with-file-schema").build().toUriString(); + + final MultiValueMap<String, String> queryParams = new LinkedMultiValueMap<String, String>(); + final HttpHeaders headerParams = new HttpHeaders(); + final MultiValueMap<String, Object> formParams = new LinkedMultiValueMap<String, Object>(); + + final String[] accepts = { }; + final List<MediaType> accept = apiClient.selectHeaderAccept(accepts); + final String[] contentTypes = { + "application/json" + }; + final MediaType contentType = apiClient.selectHeaderContentType(contentTypes); + + String[] authNames = new String[] { }; + + ParameterizedTypeReference<Void> returnType = new ParameterizedTypeReference<Void>() {}; + return apiClient.invokeAPI(path, HttpMethod.PUT, queryParams, postBody, headerParams, formParams, accept, contentType, authNames, returnType); + } /** * * diff --git a/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/model/FileSchemaTestClass.java b/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/model/FileSchemaTestClass.java new file mode 100644 index 00000000000..4b58ad0b154 --- /dev/null +++ b/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/model/FileSchemaTestClass.java @@ -0,0 +1,124 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * OpenAPI spec version: 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.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.util.ArrayList; +import java.util.List; + +/** + * FileSchemaTestClass + */ + +public class FileSchemaTestClass { + @JsonProperty("file") + private java.io.File file = null; + + @JsonProperty("files") + private List<java.io.File> files = null; + + public FileSchemaTestClass file(java.io.File file) { + this.file = file; + return this; + } + + /** + * Get file + * @return file + **/ + @ApiModelProperty(value = "") + public java.io.File getFile() { + return file; + } + + public void setFile(java.io.File file) { + this.file = file; + } + + public FileSchemaTestClass files(List<java.io.File> files) { + this.files = files; + return this; + } + + public FileSchemaTestClass addFilesItem(java.io.File filesItem) { + if (this.files == null) { + this.files = new ArrayList<>(); + } + this.files.add(filesItem); + return this; + } + + /** + * Get files + * @return files + **/ + @ApiModelProperty(value = "") + public List<java.io.File> getFiles() { + return files; + } + + public void setFiles(List<java.io.File> files) { + this.files = files; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + FileSchemaTestClass fileSchemaTestClass = (FileSchemaTestClass) o; + return Objects.equals(this.file, fileSchemaTestClass.file) && + Objects.equals(this.files, fileSchemaTestClass.files); + } + + @Override + public int hashCode() { + return Objects.hash(file, files); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class FileSchemaTestClass {\n"); + + sb.append(" file: ").append(toIndentedString(file)).append("\n"); + sb.append(" files: ").append(toIndentedString(files)).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(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/samples/openapi3/client/petstore/php/OpenAPIClient-php/lib/Api/PetApi.php b/samples/openapi3/client/petstore/php/OpenAPIClient-php/lib/Api/PetApi.php index 83e005f110c..7a020d03881 100644 --- a/samples/openapi3/client/petstore/php/OpenAPIClient-php/lib/Api/PetApi.php +++ b/samples/openapi3/client/petstore/php/OpenAPIClient-php/lib/Api/PetApi.php @@ -756,7 +756,7 @@ class PetApi // query params if (is_array($status)) { - $status = ObjectSerializer::serializeCollection($status, 'multi', true); + $status = ObjectSerializer::serializeCollection($status, 'csv', true); } if ($status !== null) { $queryParams['status'] = ObjectSerializer::toQueryValue($status); @@ -1040,7 +1040,7 @@ class PetApi // query params if (is_array($tags)) { - $tags = ObjectSerializer::serializeCollection($tags, 'multi', true); + $tags = ObjectSerializer::serializeCollection($tags, 'csv', true); } if ($tags !== null) { $queryParams['tags'] = ObjectSerializer::toQueryValue($tags); -- GitLab