[Golang][client] fix for schema definition name file (#433)

* fix schema/definition name as 'file'

* update samples

* Trigger CI due to previous Shippable race condition

* add fix with toModelName(openAPIType)

* update tests for file schema/definition name

* Update 3.0 test spec

* update samples

* update samples for jaxrs-cxf

* Trigger CI due to previous Shippable race condition

* add back explode
This commit is contained in:
John Wang
2018-07-05 05:32:24 -07:00
committed by William Cheng
parent 036570d93d
commit 0bffdf2463
185 changed files with 10409 additions and 11 deletions

View File

@@ -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 &#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)

View File

@@ -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]

View File

@@ -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 org.threeten.bp.LocalDate;
import org.threeten.bp.OffsetDateTime;
import org.openapitools.client.model.OuterComposite;
@@ -366,6 +367,90 @@ public class FakeApi {
}
/**
* 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 IOException if an error occurs while attempting to invoke the API
**/
public void testBodyWithFileSchema(FileSchemaTestClass fileSchemaTestClass) throws IOException {
testBodyWithFileSchemaForHttpResponse(fileSchemaTestClass);
}
/**
* 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
* @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param.
* @throws IOException if an error occurs while attempting to invoke the API
**/
public void testBodyWithFileSchema(FileSchemaTestClass fileSchemaTestClass, Map<String, Object> params) throws IOException {
testBodyWithFileSchemaForHttpResponse(fileSchemaTestClass, params);
}
public HttpResponse testBodyWithFileSchemaForHttpResponse(FileSchemaTestClass fileSchemaTestClass) throws IOException {
// verify the required parameter 'fileSchemaTestClass' is set
if (fileSchemaTestClass == null) {
throw new IllegalArgumentException("Missing the required parameter 'fileSchemaTestClass' when calling testBodyWithFileSchema");
}
UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/fake/body-with-file-schema");
String url = uriBuilder.build().toString();
GenericUrl genericUrl = new GenericUrl(url);
HttpContent content = apiClient.new JacksonJsonHttpContent(fileSchemaTestClass);
return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute();
}
public HttpResponse testBodyWithFileSchemaForHttpResponse(java.io.InputStream fileSchemaTestClass, String mediaType) throws IOException {
// verify the required parameter 'fileSchemaTestClass' is set
if (fileSchemaTestClass == null) {
throw new IllegalArgumentException("Missing the required parameter 'fileSchemaTestClass' when calling testBodyWithFileSchema");
}
UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/fake/body-with-file-schema");
String url = uriBuilder.build().toString();
GenericUrl genericUrl = new GenericUrl(url);
HttpContent content = fileSchemaTestClass == null ?
apiClient.new JacksonJsonHttpContent(null) :
new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, fileSchemaTestClass);
return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute();
}
public HttpResponse testBodyWithFileSchemaForHttpResponse(FileSchemaTestClass fileSchemaTestClass, Map<String, Object> params) throws IOException {
// verify the required parameter 'fileSchemaTestClass' is set
if (fileSchemaTestClass == null) {
throw new IllegalArgumentException("Missing the required parameter 'fileSchemaTestClass' when calling testBodyWithFileSchema");
}
UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/fake/body-with-file-schema");
// Copy the params argument if present, to allow passing in immutable maps
Map<String, Object> allParams = params == null ? new HashMap<String, Object>() : new HashMap<String, Object>(params);
for (Map.Entry<String, Object> entry: allParams.entrySet()) {
String key = entry.getKey();
Object value = entry.getValue();
if (key != null && value != null) {
if (value instanceof Collection) {
uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray());
} else if (value instanceof Object[]) {
uriBuilder = uriBuilder.queryParam(key, (Object[]) value);
} else {
uriBuilder = uriBuilder.queryParam(key, value);
}
}
}
String url = uriBuilder.build().toString();
GenericUrl genericUrl = new GenericUrl(url);
HttpContent content = apiClient.new JacksonJsonHttpContent(fileSchemaTestClass);
return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute();
}
/**
* <p><b>200</b> - Success
* @param query The query parameter

View File

@@ -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<java.io.File>();
}
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 ");
}
}