Skip to content

Commit

Permalink
update petstore samples (OpenAPITools#478)
Browse files Browse the repository at this point in the history
  • Loading branch information
wing328 authored Jul 6, 2018
1 parent 850d4b5 commit b70ae5c
Show file tree
Hide file tree
Showing 5 changed files with 216 additions and 2 deletions.
45 changes: 45 additions & 0 deletions samples/client/petstore/java/webclient/docs/FakeApi.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 假端點 偽のエンドポイント 가짜 엔드 포인트
Expand Down Expand Up @@ -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 &#x60;File&#x60;.

### 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)
Expand Down
11 changes: 11 additions & 0 deletions samples/client/petstore/java/webclient/docs/FileSchemaTestClass.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@

# FileSchemaTestClass

## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**file** | [**java.io.File**](java.io.File.md) | | [optional]
**files** | [**List&lt;java.io.File&gt;**](java.io.File.md) | | [optional]



Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
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;
Expand Down Expand Up @@ -167,6 +168,39 @@ public Mono<String> fakeOuterStringSerialize(String body) throws RestClientExcep
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 &#x60;File&#x60;.
* <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);
}
/**
*
*
Expand Down
Original file line number Diff line number Diff line change
@@ -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 ");
}

}

Original file line number Diff line number Diff line change
Expand Up @@ -756,7 +756,7 @@ protected function findPetsByStatusRequest($status)

// 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);
Expand Down Expand Up @@ -1040,7 +1040,7 @@ protected function findPetsByTagsRequest($tags)

// 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);
Expand Down

0 comments on commit b70ae5c

Please sign in to comment.