forked from loafle/openapi-generator-original
Update java client samples OAS2 (#140)
* Update java client examples * Rename artifactId in json config files * Add imports in api.mustache for play24 and play25
This commit is contained in:
@@ -1,11 +1,11 @@
|
||||
# Swagger Codegen Ignore
|
||||
# Generated by swagger-codegen https://github.com/swagger-api/swagger-codegen
|
||||
# OpenAPI Generator Ignore
|
||||
# Generated by openapi-generator https://github.com/openapitools/openapi-generator
|
||||
|
||||
# Use this file to prevent files from being overwritten by the generator.
|
||||
# The patterns follow closely to .gitignore or .dockerignore.
|
||||
|
||||
# As an example, the C# client generator defines ApiClient.cs.
|
||||
# You can make changes and tell Swagger Codgen to ignore just this file by uncommenting the following line:
|
||||
# You can make changes and tell OpenAPI Generator to ignore just this file by uncommenting the following line:
|
||||
#ApiClient.cs
|
||||
|
||||
# You can match any string of characters against a directory, file or extension with a single asterisk (*):
|
||||
|
||||
@@ -1,24 +1,35 @@
|
||||
# swagger-petstore-resttemplate
|
||||
# petstore-resttemplate
|
||||
|
||||
Swagger Petstore
|
||||
- API version: 1.0.0
|
||||
|
||||
This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
|
||||
|
||||
|
||||
*Automatically generated by the [Swagger Codegen](https://github.com/swagger-api/swagger-codegen)*
|
||||
|
||||
|
||||
## Requirements
|
||||
|
||||
Building the API client library requires [Maven](https://maven.apache.org/) to be installed.
|
||||
Building the API client library requires:
|
||||
1. Java 1.7+
|
||||
2. Maven/Gradle
|
||||
|
||||
## Installation
|
||||
|
||||
To install the API client library to your local Maven repository, simply execute:
|
||||
|
||||
```shell
|
||||
mvn install
|
||||
mvn clean install
|
||||
```
|
||||
|
||||
To deploy it to a remote Maven repository instead, configure the settings of the repository and execute:
|
||||
|
||||
```shell
|
||||
mvn deploy
|
||||
mvn clean deploy
|
||||
```
|
||||
|
||||
Refer to the [official documentation](https://maven.apache.org/plugins/maven-deploy-plugin/usage.html) for more information.
|
||||
Refer to the [OSSRH Guide](http://central.sonatype.org/pages/ossrh-guide.html) for more information.
|
||||
|
||||
### Maven users
|
||||
|
||||
@@ -26,10 +37,10 @@ Add this dependency to your project's POM:
|
||||
|
||||
```xml
|
||||
<dependency>
|
||||
<groupId>io.swagger</groupId>
|
||||
<artifactId>swagger-petstore-resttemplate</artifactId>
|
||||
<version>1.0.0</version>
|
||||
<scope>compile</scope>
|
||||
<groupId>org.openapitools</groupId>
|
||||
<artifactId>petstore-resttemplate</artifactId>
|
||||
<version>1.0.0</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
```
|
||||
|
||||
@@ -38,19 +49,21 @@ Add this dependency to your project's POM:
|
||||
Add this dependency to your project's build file:
|
||||
|
||||
```groovy
|
||||
compile "io.swagger:swagger-petstore-resttemplate:1.0.0"
|
||||
compile "org.openapitools:petstore-resttemplate:1.0.0"
|
||||
```
|
||||
|
||||
### Others
|
||||
|
||||
At first generate the JAR by executing:
|
||||
|
||||
mvn package
|
||||
```shell
|
||||
mvn clean package
|
||||
```
|
||||
|
||||
Then manually install the following JARs:
|
||||
|
||||
* target/swagger-petstore-resttemplate-1.0.0.jar
|
||||
* target/lib/*.jar
|
||||
* `target/petstore-resttemplate-1.0.0.jar`
|
||||
* `target/lib/*.jar`
|
||||
|
||||
## Getting Started
|
||||
|
||||
@@ -61,22 +74,22 @@ Please follow the [installation](#installation) instruction and execute the foll
|
||||
import io.swagger.client.*;
|
||||
import io.swagger.client.auth.*;
|
||||
import io.swagger.client.model.*;
|
||||
import io.swagger.client.api.FakeApi;
|
||||
import io.swagger.client.api.AnotherFakeApi;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.*;
|
||||
|
||||
public class FakeApiExample {
|
||||
public class AnotherFakeApiExample {
|
||||
|
||||
public static void main(String[] args) {
|
||||
|
||||
FakeApi apiInstance = new FakeApi();
|
||||
Boolean body = true; // Boolean | Input boolean as post body
|
||||
AnotherFakeApi apiInstance = new AnotherFakeApi();
|
||||
Client client = new Client(); // Client | client model
|
||||
try {
|
||||
Boolean result = apiInstance.fakeOuterBooleanSerialize(body);
|
||||
Client result = apiInstance.testSpecialTags(client);
|
||||
System.out.println(result);
|
||||
} catch (ApiException e) {
|
||||
System.err.println("Exception when calling FakeApi#fakeOuterBooleanSerialize");
|
||||
System.err.println("Exception when calling AnotherFakeApi#testSpecialTags");
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
@@ -90,13 +103,16 @@ All URIs are relative to *http://petstore.swagger.io:80/v2*
|
||||
|
||||
Class | Method | HTTP request | Description
|
||||
------------ | ------------- | ------------- | -------------
|
||||
*AnotherFakeApi* | [**testSpecialTags**](docs/AnotherFakeApi.md#testSpecialTags) | **PATCH** /another-fake/dummy | To test special tags
|
||||
*FakeApi* | [**fakeOuterBooleanSerialize**](docs/FakeApi.md#fakeOuterBooleanSerialize) | **POST** /fake/outer/boolean |
|
||||
*FakeApi* | [**fakeOuterCompositeSerialize**](docs/FakeApi.md#fakeOuterCompositeSerialize) | **POST** /fake/outer/composite |
|
||||
*FakeApi* | [**fakeOuterNumberSerialize**](docs/FakeApi.md#fakeOuterNumberSerialize) | **POST** /fake/outer/number |
|
||||
*FakeApi* | [**fakeOuterStringSerialize**](docs/FakeApi.md#fakeOuterStringSerialize) | **POST** /fake/outer/string |
|
||||
*FakeApi* | [**testBodyWithQueryParams**](docs/FakeApi.md#testBodyWithQueryParams) | **PUT** /fake/body-with-query-params |
|
||||
*FakeApi* | [**testClientModel**](docs/FakeApi.md#testClientModel) | **PATCH** /fake | To test \"client\" model
|
||||
*FakeApi* | [**testEndpointParameters**](docs/FakeApi.md#testEndpointParameters) | **POST** /fake | Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트
|
||||
*FakeApi* | [**testEnumParameters**](docs/FakeApi.md#testEnumParameters) | **GET** /fake | To test enum parameters
|
||||
*FakeApi* | [**testInlineAdditionalProperties**](docs/FakeApi.md#testInlineAdditionalProperties) | **POST** /fake/inline-additionalProperties | test inline additionalProperties
|
||||
*FakeApi* | [**testJsonFormData**](docs/FakeApi.md#testJsonFormData) | **GET** /fake/jsonFormData | test json serialization of form data
|
||||
*FakeClassnameTags123Api* | [**testClassname**](docs/FakeClassnameTags123Api.md#testClassname) | **PATCH** /fake_classname_test | To test class name in snake case
|
||||
*PetApi* | [**addPet**](docs/PetApi.md#addPet) | **POST** /pet | Add a new pet to the store
|
||||
@@ -130,9 +146,11 @@ Class | Method | HTTP request | Description
|
||||
- [ArrayOfNumberOnly](docs/ArrayOfNumberOnly.md)
|
||||
- [ArrayTest](docs/ArrayTest.md)
|
||||
- [Capitalization](docs/Capitalization.md)
|
||||
- [Cat](docs/Cat.md)
|
||||
- [Category](docs/Category.md)
|
||||
- [ClassModel](docs/ClassModel.md)
|
||||
- [Client](docs/Client.md)
|
||||
- [Dog](docs/Dog.md)
|
||||
- [EnumArrays](docs/EnumArrays.md)
|
||||
- [EnumClass](docs/EnumClass.md)
|
||||
- [EnumTest](docs/EnumTest.md)
|
||||
@@ -146,15 +164,16 @@ Class | Method | HTTP request | Description
|
||||
- [Name](docs/Name.md)
|
||||
- [NumberOnly](docs/NumberOnly.md)
|
||||
- [Order](docs/Order.md)
|
||||
- [OuterBoolean](docs/OuterBoolean.md)
|
||||
- [OuterComposite](docs/OuterComposite.md)
|
||||
- [OuterEnum](docs/OuterEnum.md)
|
||||
- [OuterNumber](docs/OuterNumber.md)
|
||||
- [OuterString](docs/OuterString.md)
|
||||
- [Pet](docs/Pet.md)
|
||||
- [ReadOnlyFirst](docs/ReadOnlyFirst.md)
|
||||
- [SpecialModelName](docs/SpecialModelName.md)
|
||||
- [Tag](docs/Tag.md)
|
||||
- [User](docs/User.md)
|
||||
- [Cat](docs/Cat.md)
|
||||
- [Dog](docs/Dog.md)
|
||||
|
||||
|
||||
## Documentation for Authorization
|
||||
@@ -166,6 +185,12 @@ Authentication schemes defined for the API:
|
||||
- **API key parameter name**: api_key
|
||||
- **Location**: HTTP header
|
||||
|
||||
### api_key_query
|
||||
|
||||
- **Type**: API key
|
||||
- **API key parameter name**: api_key_query
|
||||
- **Location**: URL query string
|
||||
|
||||
### http_basic_test
|
||||
|
||||
- **Type**: HTTP basic authentication
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
apply plugin: 'idea'
|
||||
apply plugin: 'eclipse'
|
||||
|
||||
group = 'io.swagger'
|
||||
group = 'org.openapitools'
|
||||
version = '1.0.0'
|
||||
|
||||
buildscript {
|
||||
@@ -83,7 +83,7 @@ if(hasProperty('target') && target == 'android') {
|
||||
|
||||
install {
|
||||
repositories.mavenInstaller {
|
||||
pom.artifactId = 'swagger-petstore-resttemplate'
|
||||
pom.artifactId = 'petstore-resttemplate'
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@ Method | HTTP request | Description
|
||||
|
||||
<a name="testSpecialTags"></a>
|
||||
# **testSpecialTags**
|
||||
> Client testSpecialTags(body)
|
||||
> Client testSpecialTags(client)
|
||||
|
||||
To test special tags
|
||||
|
||||
@@ -23,9 +23,9 @@ To test special tags
|
||||
|
||||
|
||||
AnotherFakeApi apiInstance = new AnotherFakeApi();
|
||||
Client body = new Client(); // Client | client model
|
||||
Client client = new Client(); // Client | client model
|
||||
try {
|
||||
Client result = apiInstance.testSpecialTags(body);
|
||||
Client result = apiInstance.testSpecialTags(client);
|
||||
System.out.println(result);
|
||||
} catch (ApiException e) {
|
||||
System.err.println("Exception when calling AnotherFakeApi#testSpecialTags");
|
||||
@@ -37,7 +37,7 @@ try {
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**body** | [**Client**](Client.md)| client model |
|
||||
**client** | [**Client**](Client.md)| client model |
|
||||
|
||||
### Return type
|
||||
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
Name | Type | Description | Notes
|
||||
------------ | ------------- | ------------- | -------------
|
||||
**enumString** | [**EnumStringEnum**](#EnumStringEnum) | | [optional]
|
||||
**enumStringRequired** | [**EnumStringRequiredEnum**](#EnumStringRequiredEnum) | |
|
||||
**enumInteger** | [**EnumIntegerEnum**](#EnumIntegerEnum) | | [optional]
|
||||
**enumNumber** | [**EnumNumberEnum**](#EnumNumberEnum) | | [optional]
|
||||
**outerEnum** | [**OuterEnum**](OuterEnum.md) | | [optional]
|
||||
@@ -19,6 +20,15 @@ LOWER | "lower"
|
||||
EMPTY | ""
|
||||
|
||||
|
||||
<a name="EnumStringRequiredEnum"></a>
|
||||
## Enum: EnumStringRequiredEnum
|
||||
Name | Value
|
||||
---- | -----
|
||||
UPPER | "UPPER"
|
||||
LOWER | "lower"
|
||||
EMPTY | ""
|
||||
|
||||
|
||||
<a name="EnumIntegerEnum"></a>
|
||||
## Enum: EnumIntegerEnum
|
||||
Name | Value
|
||||
|
||||
@@ -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 |
|
||||
[**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 假端點 偽のエンドポイント 가짜 엔드 포인트
|
||||
[**testEnumParameters**](FakeApi.md#testEnumParameters) | **GET** /fake | To test enum parameters
|
||||
@@ -17,7 +18,7 @@ Method | HTTP request | Description
|
||||
|
||||
<a name="fakeOuterBooleanSerialize"></a>
|
||||
# **fakeOuterBooleanSerialize**
|
||||
> Boolean fakeOuterBooleanSerialize(body)
|
||||
> Boolean fakeOuterBooleanSerialize(booleanPostBody)
|
||||
|
||||
|
||||
|
||||
@@ -31,9 +32,9 @@ Test serialization of outer boolean types
|
||||
|
||||
|
||||
FakeApi apiInstance = new FakeApi();
|
||||
Boolean body = true; // Boolean | Input boolean as post body
|
||||
Boolean booleanPostBody = true; // Boolean | Input boolean as post body
|
||||
try {
|
||||
Boolean result = apiInstance.fakeOuterBooleanSerialize(body);
|
||||
Boolean result = apiInstance.fakeOuterBooleanSerialize(booleanPostBody);
|
||||
System.out.println(result);
|
||||
} catch (ApiException e) {
|
||||
System.err.println("Exception when calling FakeApi#fakeOuterBooleanSerialize");
|
||||
@@ -45,7 +46,7 @@ try {
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**body** | [**Boolean**](Boolean.md)| Input boolean as post body | [optional]
|
||||
**booleanPostBody** | **Boolean**| Input boolean as post body | [optional]
|
||||
|
||||
### Return type
|
||||
|
||||
@@ -58,11 +59,11 @@ No authorization required
|
||||
### HTTP request headers
|
||||
|
||||
- **Content-Type**: Not defined
|
||||
- **Accept**: Not defined
|
||||
- **Accept**: */*
|
||||
|
||||
<a name="fakeOuterCompositeSerialize"></a>
|
||||
# **fakeOuterCompositeSerialize**
|
||||
> OuterComposite fakeOuterCompositeSerialize(body)
|
||||
> OuterComposite fakeOuterCompositeSerialize(outerComposite)
|
||||
|
||||
|
||||
|
||||
@@ -76,9 +77,9 @@ Test serialization of object with outer number type
|
||||
|
||||
|
||||
FakeApi apiInstance = new FakeApi();
|
||||
OuterComposite body = new OuterComposite(); // OuterComposite | Input composite as post body
|
||||
OuterComposite outerComposite = new OuterComposite(); // OuterComposite | Input composite as post body
|
||||
try {
|
||||
OuterComposite result = apiInstance.fakeOuterCompositeSerialize(body);
|
||||
OuterComposite result = apiInstance.fakeOuterCompositeSerialize(outerComposite);
|
||||
System.out.println(result);
|
||||
} catch (ApiException e) {
|
||||
System.err.println("Exception when calling FakeApi#fakeOuterCompositeSerialize");
|
||||
@@ -90,7 +91,7 @@ try {
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**body** | [**OuterComposite**](OuterComposite.md)| Input composite as post body | [optional]
|
||||
**outerComposite** | [**OuterComposite**](OuterComposite.md)| Input composite as post body | [optional]
|
||||
|
||||
### Return type
|
||||
|
||||
@@ -103,7 +104,7 @@ No authorization required
|
||||
### HTTP request headers
|
||||
|
||||
- **Content-Type**: Not defined
|
||||
- **Accept**: Not defined
|
||||
- **Accept**: */*
|
||||
|
||||
<a name="fakeOuterNumberSerialize"></a>
|
||||
# **fakeOuterNumberSerialize**
|
||||
@@ -135,7 +136,7 @@ try {
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**body** | [**BigDecimal**](BigDecimal.md)| Input number as post body | [optional]
|
||||
**body** | **BigDecimal**| Input number as post body | [optional]
|
||||
|
||||
### Return type
|
||||
|
||||
@@ -148,7 +149,7 @@ No authorization required
|
||||
### HTTP request headers
|
||||
|
||||
- **Content-Type**: Not defined
|
||||
- **Accept**: Not defined
|
||||
- **Accept**: */*
|
||||
|
||||
<a name="fakeOuterStringSerialize"></a>
|
||||
# **fakeOuterStringSerialize**
|
||||
@@ -180,7 +181,7 @@ try {
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**body** | [**String**](String.md)| Input string as post body | [optional]
|
||||
**body** | **String**| Input string as post body | [optional]
|
||||
|
||||
### Return type
|
||||
|
||||
@@ -193,11 +194,55 @@ No authorization required
|
||||
### HTTP request headers
|
||||
|
||||
- **Content-Type**: Not defined
|
||||
- **Accept**: */*
|
||||
|
||||
<a name="testBodyWithQueryParams"></a>
|
||||
# **testBodyWithQueryParams**
|
||||
> testBodyWithQueryParams(query, user)
|
||||
|
||||
|
||||
|
||||
### Example
|
||||
```java
|
||||
// Import classes:
|
||||
//import io.swagger.client.ApiException;
|
||||
//import io.swagger.client.api.FakeApi;
|
||||
|
||||
|
||||
FakeApi apiInstance = new FakeApi();
|
||||
String query = "query_example"; // String |
|
||||
User user = new User(); // User |
|
||||
try {
|
||||
apiInstance.testBodyWithQueryParams(query, user);
|
||||
} catch (ApiException e) {
|
||||
System.err.println("Exception when calling FakeApi#testBodyWithQueryParams");
|
||||
e.printStackTrace();
|
||||
}
|
||||
```
|
||||
|
||||
### Parameters
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**query** | **String**| |
|
||||
**user** | [**User**](User.md)| |
|
||||
|
||||
### Return type
|
||||
|
||||
null (empty response body)
|
||||
|
||||
### Authorization
|
||||
|
||||
No authorization required
|
||||
|
||||
### HTTP request headers
|
||||
|
||||
- **Content-Type**: application/json
|
||||
- **Accept**: Not defined
|
||||
|
||||
<a name="testClientModel"></a>
|
||||
# **testClientModel**
|
||||
> Client testClientModel(body)
|
||||
> Client testClientModel(client)
|
||||
|
||||
To test \"client\" model
|
||||
|
||||
@@ -211,9 +256,9 @@ To test \"client\" model
|
||||
|
||||
|
||||
FakeApi apiInstance = new FakeApi();
|
||||
Client body = new Client(); // Client | client model
|
||||
Client client = new Client(); // Client | client model
|
||||
try {
|
||||
Client result = apiInstance.testClientModel(body);
|
||||
Client result = apiInstance.testClientModel(client);
|
||||
System.out.println(result);
|
||||
} catch (ApiException e) {
|
||||
System.err.println("Exception when calling FakeApi#testClientModel");
|
||||
@@ -225,7 +270,7 @@ try {
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**body** | [**Client**](Client.md)| client model |
|
||||
**client** | [**Client**](Client.md)| client model |
|
||||
|
||||
### Return type
|
||||
|
||||
@@ -268,13 +313,13 @@ FakeApi apiInstance = new FakeApi();
|
||||
BigDecimal number = new BigDecimal(); // BigDecimal | None
|
||||
Double _double = 3.4D; // Double | None
|
||||
String patternWithoutDelimiter = "patternWithoutDelimiter_example"; // String | None
|
||||
byte[] _byte = B; // byte[] | None
|
||||
byte[] _byte = null; // byte[] | None
|
||||
Integer integer = 56; // Integer | None
|
||||
Integer int32 = 56; // Integer | None
|
||||
Long int64 = 789L; // Long | None
|
||||
Long int64 = 56L; // Long | None
|
||||
Float _float = 3.4F; // Float | None
|
||||
String string = "string_example"; // String | None
|
||||
byte[] binary = B; // byte[] | None
|
||||
File binary = new File("/path/to/file"); // File | None
|
||||
LocalDate date = new LocalDate(); // LocalDate | None
|
||||
OffsetDateTime dateTime = new OffsetDateTime(); // OffsetDateTime | None
|
||||
String password = "password_example"; // String | None
|
||||
@@ -295,12 +340,12 @@ Name | Type | Description | Notes
|
||||
**_double** | **Double**| None |
|
||||
**patternWithoutDelimiter** | **String**| None |
|
||||
**_byte** | **byte[]**| None |
|
||||
**integer** | **Integer**| None | [optional]
|
||||
**int32** | **Integer**| None | [optional]
|
||||
**integer** | **Integer**| None | [optional] [enum: ]
|
||||
**int32** | **Integer**| None | [optional] [enum: ]
|
||||
**int64** | **Long**| None | [optional]
|
||||
**_float** | **Float**| None | [optional]
|
||||
**string** | **String**| None | [optional]
|
||||
**binary** | **byte[]**| None | [optional]
|
||||
**binary** | **File**| None | [optional]
|
||||
**date** | **LocalDate**| None | [optional]
|
||||
**dateTime** | **OffsetDateTime**| None | [optional]
|
||||
**password** | **String**| None | [optional]
|
||||
@@ -316,12 +361,12 @@ null (empty response body)
|
||||
|
||||
### HTTP request headers
|
||||
|
||||
- **Content-Type**: application/xml; charset=utf-8, application/json; charset=utf-8
|
||||
- **Accept**: application/xml; charset=utf-8, application/json; charset=utf-8
|
||||
- **Content-Type**: application/x-www-form-urlencoded
|
||||
- **Accept**: Not defined
|
||||
|
||||
<a name="testEnumParameters"></a>
|
||||
# **testEnumParameters**
|
||||
> testEnumParameters(enumFormStringArray, enumFormString, enumHeaderStringArray, enumHeaderString, enumQueryStringArray, enumQueryString, enumQueryInteger, enumQueryDouble)
|
||||
> testEnumParameters(enumHeaderStringArray, enumHeaderString, enumQueryStringArray, enumQueryString, enumQueryInteger, enumQueryDouble, enumFormStringArray, enumFormString)
|
||||
|
||||
To test enum parameters
|
||||
|
||||
@@ -335,16 +380,16 @@ To test enum parameters
|
||||
|
||||
|
||||
FakeApi apiInstance = new FakeApi();
|
||||
List<String> enumFormStringArray = Arrays.asList("enumFormStringArray_example"); // List<String> | Form parameter enum test (string array)
|
||||
String enumFormString = "-efg"; // String | Form parameter enum test (string)
|
||||
List<String> enumHeaderStringArray = Arrays.asList("enumHeaderStringArray_example"); // List<String> | Header parameter enum test (string array)
|
||||
String enumHeaderString = "-efg"; // String | Header parameter enum test (string)
|
||||
List<String> enumQueryStringArray = Arrays.asList("enumQueryStringArray_example"); // List<String> | Query parameter enum test (string array)
|
||||
String enumQueryString = "-efg"; // String | Query parameter enum test (string)
|
||||
Integer enumQueryInteger = 56; // Integer | Query parameter enum test (double)
|
||||
Double enumQueryDouble = 3.4D; // Double | Query parameter enum test (double)
|
||||
List<String> enumFormStringArray = new List(); // List<String> | Form parameter enum test (string array)
|
||||
String enumFormString = "enumFormString_example"; // String | Form parameter enum test (string)
|
||||
try {
|
||||
apiInstance.testEnumParameters(enumFormStringArray, enumFormString, enumHeaderStringArray, enumHeaderString, enumQueryStringArray, enumQueryString, enumQueryInteger, enumQueryDouble);
|
||||
apiInstance.testEnumParameters(enumHeaderStringArray, enumHeaderString, enumQueryStringArray, enumQueryString, enumQueryInteger, enumQueryDouble, enumFormStringArray, enumFormString);
|
||||
} catch (ApiException e) {
|
||||
System.err.println("Exception when calling FakeApi#testEnumParameters");
|
||||
e.printStackTrace();
|
||||
@@ -355,14 +400,14 @@ try {
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**enumFormStringArray** | [**List<String>**](String.md)| Form parameter enum test (string array) | [optional] [enum: >, $]
|
||||
**enumFormString** | **String**| Form parameter enum test (string) | [optional] [default to -efg] [enum: _abc, -efg, (xyz)]
|
||||
**enumHeaderStringArray** | [**List<String>**](String.md)| Header parameter enum test (string array) | [optional] [enum: >, $]
|
||||
**enumHeaderString** | **String**| Header parameter enum test (string) | [optional] [default to -efg] [enum: _abc, -efg, (xyz)]
|
||||
**enumQueryStringArray** | [**List<String>**](String.md)| Query parameter enum test (string array) | [optional] [enum: >, $]
|
||||
**enumQueryString** | **String**| Query parameter enum test (string) | [optional] [default to -efg] [enum: _abc, -efg, (xyz)]
|
||||
**enumQueryInteger** | **Integer**| Query parameter enum test (double) | [optional] [enum: 1, -2]
|
||||
**enumQueryDouble** | **Double**| Query parameter enum test (double) | [optional] [enum: 1.1, -1.2]
|
||||
**enumFormStringArray** | [**List<String>**](List.md)| Form parameter enum test (string array) | [optional] [enum: >, $]
|
||||
**enumFormString** | **String**| Form parameter enum test (string) | [optional] [enum: _abc, -efg, (xyz)]
|
||||
|
||||
### Return type
|
||||
|
||||
@@ -374,17 +419,15 @@ No authorization required
|
||||
|
||||
### HTTP request headers
|
||||
|
||||
- **Content-Type**: */*
|
||||
- **Accept**: */*
|
||||
- **Content-Type**: application/x-www-form-urlencoded
|
||||
- **Accept**: Not defined
|
||||
|
||||
<a name="testInlineAdditionalProperties"></a>
|
||||
# **testInlineAdditionalProperties**
|
||||
> testInlineAdditionalProperties(param)
|
||||
> testInlineAdditionalProperties(requestBody)
|
||||
|
||||
test inline additionalProperties
|
||||
|
||||
|
||||
|
||||
### Example
|
||||
```java
|
||||
// Import classes:
|
||||
@@ -393,9 +436,9 @@ test inline additionalProperties
|
||||
|
||||
|
||||
FakeApi apiInstance = new FakeApi();
|
||||
Object param = null; // Object | request body
|
||||
String requestBody = new HashMap(); // String | request body
|
||||
try {
|
||||
apiInstance.testInlineAdditionalProperties(param);
|
||||
apiInstance.testInlineAdditionalProperties(requestBody);
|
||||
} catch (ApiException e) {
|
||||
System.err.println("Exception when calling FakeApi#testInlineAdditionalProperties");
|
||||
e.printStackTrace();
|
||||
@@ -406,7 +449,7 @@ try {
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**param** | **Object**| request body |
|
||||
**requestBody** | [**String**](String.md)| request body |
|
||||
|
||||
### Return type
|
||||
|
||||
@@ -427,8 +470,6 @@ No authorization required
|
||||
|
||||
test json serialization of form data
|
||||
|
||||
|
||||
|
||||
### Example
|
||||
```java
|
||||
// Import classes:
|
||||
@@ -464,6 +505,6 @@ No authorization required
|
||||
|
||||
### HTTP request headers
|
||||
|
||||
- **Content-Type**: application/json
|
||||
- **Content-Type**: application/x-www-form-urlencoded
|
||||
- **Accept**: Not defined
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@ Method | HTTP request | Description
|
||||
|
||||
<a name="testClassname"></a>
|
||||
# **testClassname**
|
||||
> Client testClassname(body)
|
||||
> Client testClassname(client)
|
||||
|
||||
To test class name in snake case
|
||||
|
||||
@@ -33,9 +33,9 @@ api_key_query.setApiKey("YOUR API KEY");
|
||||
//api_key_query.setApiKeyPrefix("Token");
|
||||
|
||||
FakeClassnameTags123Api apiInstance = new FakeClassnameTags123Api();
|
||||
Client body = new Client(); // Client | client model
|
||||
Client client = new Client(); // Client | client model
|
||||
try {
|
||||
Client result = apiInstance.testClassname(body);
|
||||
Client result = apiInstance.testClassname(client);
|
||||
System.out.println(result);
|
||||
} catch (ApiException e) {
|
||||
System.err.println("Exception when calling FakeClassnameTags123Api#testClassname");
|
||||
@@ -47,7 +47,7 @@ try {
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**body** | [**Client**](Client.md)| client model |
|
||||
**client** | [**Client**](Client.md)| client model |
|
||||
|
||||
### Return type
|
||||
|
||||
|
||||
@@ -12,7 +12,7 @@ Name | Type | Description | Notes
|
||||
**_double** | **Double** | | [optional]
|
||||
**string** | **String** | | [optional]
|
||||
**_byte** | **byte[]** | |
|
||||
**binary** | **byte[]** | | [optional]
|
||||
**binary** | [**File**](File.md) | | [optional]
|
||||
**date** | [**LocalDate**](LocalDate.md) | |
|
||||
**dateTime** | [**OffsetDateTime**](OffsetDateTime.md) | | [optional]
|
||||
**uuid** | [**UUID**](UUID.md) | | [optional]
|
||||
|
||||
@@ -7,7 +7,7 @@ Name | Type | Description | Notes
|
||||
**name** | **Integer** | |
|
||||
**snakeCase** | **Integer** | | [optional]
|
||||
**property** | **String** | | [optional]
|
||||
**_123Number** | **Integer** | | [optional]
|
||||
**_123number** | **Integer** | | [optional]
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
|
||||
# OuterBoolean
|
||||
|
||||
## Properties
|
||||
Name | Type | Description | Notes
|
||||
------------ | ------------- | ------------- | -------------
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
|
||||
# OuterNumber
|
||||
|
||||
## Properties
|
||||
Name | Type | Description | Notes
|
||||
------------ | ------------- | ------------- | -------------
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
|
||||
# OuterString
|
||||
|
||||
## Properties
|
||||
Name | Type | Description | Notes
|
||||
------------ | ------------- | ------------- | -------------
|
||||
|
||||
|
||||
|
||||
@@ -16,12 +16,10 @@ Method | HTTP request | Description
|
||||
|
||||
<a name="addPet"></a>
|
||||
# **addPet**
|
||||
> addPet(body)
|
||||
> addPet(pet)
|
||||
|
||||
Add a new pet to the store
|
||||
|
||||
|
||||
|
||||
### Example
|
||||
```java
|
||||
// Import classes:
|
||||
@@ -38,9 +36,9 @@ OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth");
|
||||
petstore_auth.setAccessToken("YOUR ACCESS TOKEN");
|
||||
|
||||
PetApi apiInstance = new PetApi();
|
||||
Pet body = new Pet(); // Pet | Pet object that needs to be added to the store
|
||||
Pet pet = new Pet(); // Pet | Pet object that needs to be added to the store
|
||||
try {
|
||||
apiInstance.addPet(body);
|
||||
apiInstance.addPet(pet);
|
||||
} catch (ApiException e) {
|
||||
System.err.println("Exception when calling PetApi#addPet");
|
||||
e.printStackTrace();
|
||||
@@ -51,7 +49,7 @@ try {
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**body** | [**Pet**](Pet.md)| Pet object that needs to be added to the store |
|
||||
**pet** | [**Pet**](Pet.md)| Pet object that needs to be added to the store |
|
||||
|
||||
### Return type
|
||||
|
||||
@@ -64,7 +62,7 @@ null (empty response body)
|
||||
### HTTP request headers
|
||||
|
||||
- **Content-Type**: application/json, application/xml
|
||||
- **Accept**: application/xml, application/json
|
||||
- **Accept**: Not defined
|
||||
|
||||
<a name="deletePet"></a>
|
||||
# **deletePet**
|
||||
@@ -72,8 +70,6 @@ null (empty response body)
|
||||
|
||||
Deletes a pet
|
||||
|
||||
|
||||
|
||||
### Example
|
||||
```java
|
||||
// Import classes:
|
||||
@@ -90,7 +86,7 @@ OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth");
|
||||
petstore_auth.setAccessToken("YOUR ACCESS TOKEN");
|
||||
|
||||
PetApi apiInstance = new PetApi();
|
||||
Long petId = 789L; // Long | Pet id to delete
|
||||
Long petId = 56L; // Long | Pet id to delete
|
||||
String apiKey = "apiKey_example"; // String |
|
||||
try {
|
||||
apiInstance.deletePet(petId, apiKey);
|
||||
@@ -118,7 +114,7 @@ null (empty response body)
|
||||
### HTTP request headers
|
||||
|
||||
- **Content-Type**: Not defined
|
||||
- **Accept**: application/xml, application/json
|
||||
- **Accept**: Not defined
|
||||
|
||||
<a name="findPetsByStatus"></a>
|
||||
# **findPetsByStatus**
|
||||
@@ -252,7 +248,7 @@ api_key.setApiKey("YOUR API KEY");
|
||||
//api_key.setApiKeyPrefix("Token");
|
||||
|
||||
PetApi apiInstance = new PetApi();
|
||||
Long petId = 789L; // Long | ID of pet to return
|
||||
Long petId = 56L; // Long | ID of pet to return
|
||||
try {
|
||||
Pet result = apiInstance.getPetById(petId);
|
||||
System.out.println(result);
|
||||
@@ -283,12 +279,10 @@ Name | Type | Description | Notes
|
||||
|
||||
<a name="updatePet"></a>
|
||||
# **updatePet**
|
||||
> updatePet(body)
|
||||
> updatePet(pet)
|
||||
|
||||
Update an existing pet
|
||||
|
||||
|
||||
|
||||
### Example
|
||||
```java
|
||||
// Import classes:
|
||||
@@ -305,9 +299,9 @@ OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth");
|
||||
petstore_auth.setAccessToken("YOUR ACCESS TOKEN");
|
||||
|
||||
PetApi apiInstance = new PetApi();
|
||||
Pet body = new Pet(); // Pet | Pet object that needs to be added to the store
|
||||
Pet pet = new Pet(); // Pet | Pet object that needs to be added to the store
|
||||
try {
|
||||
apiInstance.updatePet(body);
|
||||
apiInstance.updatePet(pet);
|
||||
} catch (ApiException e) {
|
||||
System.err.println("Exception when calling PetApi#updatePet");
|
||||
e.printStackTrace();
|
||||
@@ -318,7 +312,7 @@ try {
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**body** | [**Pet**](Pet.md)| Pet object that needs to be added to the store |
|
||||
**pet** | [**Pet**](Pet.md)| Pet object that needs to be added to the store |
|
||||
|
||||
### Return type
|
||||
|
||||
@@ -331,7 +325,7 @@ null (empty response body)
|
||||
### HTTP request headers
|
||||
|
||||
- **Content-Type**: application/json, application/xml
|
||||
- **Accept**: application/xml, application/json
|
||||
- **Accept**: Not defined
|
||||
|
||||
<a name="updatePetWithForm"></a>
|
||||
# **updatePetWithForm**
|
||||
@@ -339,8 +333,6 @@ null (empty response body)
|
||||
|
||||
Updates a pet in the store with form data
|
||||
|
||||
|
||||
|
||||
### Example
|
||||
```java
|
||||
// Import classes:
|
||||
@@ -357,7 +349,7 @@ OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth");
|
||||
petstore_auth.setAccessToken("YOUR ACCESS TOKEN");
|
||||
|
||||
PetApi apiInstance = new PetApi();
|
||||
Long petId = 789L; // Long | ID of pet that needs to be updated
|
||||
Long petId = 56L; // Long | ID of pet that needs to be updated
|
||||
String name = "name_example"; // String | Updated name of the pet
|
||||
String status = "status_example"; // String | Updated status of the pet
|
||||
try {
|
||||
@@ -387,7 +379,7 @@ null (empty response body)
|
||||
### HTTP request headers
|
||||
|
||||
- **Content-Type**: application/x-www-form-urlencoded
|
||||
- **Accept**: application/xml, application/json
|
||||
- **Accept**: Not defined
|
||||
|
||||
<a name="uploadFile"></a>
|
||||
# **uploadFile**
|
||||
@@ -395,8 +387,6 @@ null (empty response body)
|
||||
|
||||
uploads an image
|
||||
|
||||
|
||||
|
||||
### Example
|
||||
```java
|
||||
// Import classes:
|
||||
@@ -413,9 +403,9 @@ OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth");
|
||||
petstore_auth.setAccessToken("YOUR ACCESS TOKEN");
|
||||
|
||||
PetApi apiInstance = new PetApi();
|
||||
Long petId = 789L; // Long | ID of pet to update
|
||||
Long petId = 56L; // Long | ID of pet to update
|
||||
String additionalMetadata = "additionalMetadata_example"; // String | Additional data to pass to server
|
||||
File file = new File("/path/to/file.txt"); // File | file to upload
|
||||
File file = new File("/path/to/file"); // File | file to upload
|
||||
try {
|
||||
ModelApiResponse result = apiInstance.uploadFile(petId, additionalMetadata, file);
|
||||
System.out.println(result);
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
## Properties
|
||||
Name | Type | Description | Notes
|
||||
------------ | ------------- | ------------- | -------------
|
||||
**specialPropertyName** | **Long** | | [optional]
|
||||
**$specialPropertyName** | **Long** | | [optional]
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -52,7 +52,7 @@ No authorization required
|
||||
### HTTP request headers
|
||||
|
||||
- **Content-Type**: Not defined
|
||||
- **Accept**: application/xml, application/json
|
||||
- **Accept**: Not defined
|
||||
|
||||
<a name="getInventory"></a>
|
||||
# **getInventory**
|
||||
@@ -121,7 +121,7 @@ For valid response try integer IDs with value <= 5 or > 10. Other val
|
||||
|
||||
|
||||
StoreApi apiInstance = new StoreApi();
|
||||
Long orderId = 789L; // Long | ID of pet that needs to be fetched
|
||||
Long orderId = 56L; // Long | ID of pet that needs to be fetched
|
||||
try {
|
||||
Order result = apiInstance.getOrderById(orderId);
|
||||
System.out.println(result);
|
||||
@@ -135,7 +135,7 @@ try {
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**orderId** | **Long**| ID of pet that needs to be fetched |
|
||||
**orderId** | **Long**| ID of pet that needs to be fetched | [enum: ]
|
||||
|
||||
### Return type
|
||||
|
||||
@@ -152,12 +152,10 @@ No authorization required
|
||||
|
||||
<a name="placeOrder"></a>
|
||||
# **placeOrder**
|
||||
> Order placeOrder(body)
|
||||
> Order placeOrder(order)
|
||||
|
||||
Place an order for a pet
|
||||
|
||||
|
||||
|
||||
### Example
|
||||
```java
|
||||
// Import classes:
|
||||
@@ -166,9 +164,9 @@ Place an order for a pet
|
||||
|
||||
|
||||
StoreApi apiInstance = new StoreApi();
|
||||
Order body = new Order(); // Order | order placed for purchasing the pet
|
||||
Order order = new Order(); // Order | order placed for purchasing the pet
|
||||
try {
|
||||
Order result = apiInstance.placeOrder(body);
|
||||
Order result = apiInstance.placeOrder(order);
|
||||
System.out.println(result);
|
||||
} catch (ApiException e) {
|
||||
System.err.println("Exception when calling StoreApi#placeOrder");
|
||||
@@ -180,7 +178,7 @@ try {
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**body** | [**Order**](Order.md)| order placed for purchasing the pet |
|
||||
**order** | [**Order**](Order.md)| order placed for purchasing the pet |
|
||||
|
||||
### Return type
|
||||
|
||||
|
||||
@@ -16,7 +16,7 @@ Method | HTTP request | Description
|
||||
|
||||
<a name="createUser"></a>
|
||||
# **createUser**
|
||||
> createUser(body)
|
||||
> createUser(user)
|
||||
|
||||
Create user
|
||||
|
||||
@@ -30,9 +30,9 @@ This can only be done by the logged in user.
|
||||
|
||||
|
||||
UserApi apiInstance = new UserApi();
|
||||
User body = new User(); // User | Created user object
|
||||
User user = new User(); // User | Created user object
|
||||
try {
|
||||
apiInstance.createUser(body);
|
||||
apiInstance.createUser(user);
|
||||
} catch (ApiException e) {
|
||||
System.err.println("Exception when calling UserApi#createUser");
|
||||
e.printStackTrace();
|
||||
@@ -43,7 +43,7 @@ try {
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**body** | [**User**](User.md)| Created user object |
|
||||
**user** | [**User**](User.md)| Created user object |
|
||||
|
||||
### Return type
|
||||
|
||||
@@ -56,16 +56,14 @@ No authorization required
|
||||
### HTTP request headers
|
||||
|
||||
- **Content-Type**: Not defined
|
||||
- **Accept**: application/xml, application/json
|
||||
- **Accept**: Not defined
|
||||
|
||||
<a name="createUsersWithArrayInput"></a>
|
||||
# **createUsersWithArrayInput**
|
||||
> createUsersWithArrayInput(body)
|
||||
> createUsersWithArrayInput(user)
|
||||
|
||||
Creates list of users with given input array
|
||||
|
||||
|
||||
|
||||
### Example
|
||||
```java
|
||||
// Import classes:
|
||||
@@ -74,9 +72,9 @@ Creates list of users with given input array
|
||||
|
||||
|
||||
UserApi apiInstance = new UserApi();
|
||||
List<User> body = Arrays.asList(new User()); // List<User> | List of user object
|
||||
List<User> user = Arrays.asList(new List()); // List<User> | List of user object
|
||||
try {
|
||||
apiInstance.createUsersWithArrayInput(body);
|
||||
apiInstance.createUsersWithArrayInput(user);
|
||||
} catch (ApiException e) {
|
||||
System.err.println("Exception when calling UserApi#createUsersWithArrayInput");
|
||||
e.printStackTrace();
|
||||
@@ -87,7 +85,7 @@ try {
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**body** | [**List<User>**](User.md)| List of user object |
|
||||
**user** | [**List<User>**](List.md)| List of user object |
|
||||
|
||||
### Return type
|
||||
|
||||
@@ -100,16 +98,14 @@ No authorization required
|
||||
### HTTP request headers
|
||||
|
||||
- **Content-Type**: Not defined
|
||||
- **Accept**: application/xml, application/json
|
||||
- **Accept**: Not defined
|
||||
|
||||
<a name="createUsersWithListInput"></a>
|
||||
# **createUsersWithListInput**
|
||||
> createUsersWithListInput(body)
|
||||
> createUsersWithListInput(user)
|
||||
|
||||
Creates list of users with given input array
|
||||
|
||||
|
||||
|
||||
### Example
|
||||
```java
|
||||
// Import classes:
|
||||
@@ -118,9 +114,9 @@ Creates list of users with given input array
|
||||
|
||||
|
||||
UserApi apiInstance = new UserApi();
|
||||
List<User> body = Arrays.asList(new User()); // List<User> | List of user object
|
||||
List<User> user = Arrays.asList(new List()); // List<User> | List of user object
|
||||
try {
|
||||
apiInstance.createUsersWithListInput(body);
|
||||
apiInstance.createUsersWithListInput(user);
|
||||
} catch (ApiException e) {
|
||||
System.err.println("Exception when calling UserApi#createUsersWithListInput");
|
||||
e.printStackTrace();
|
||||
@@ -131,7 +127,7 @@ try {
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**body** | [**List<User>**](User.md)| List of user object |
|
||||
**user** | [**List<User>**](List.md)| List of user object |
|
||||
|
||||
### Return type
|
||||
|
||||
@@ -144,7 +140,7 @@ No authorization required
|
||||
### HTTP request headers
|
||||
|
||||
- **Content-Type**: Not defined
|
||||
- **Accept**: application/xml, application/json
|
||||
- **Accept**: Not defined
|
||||
|
||||
<a name="deleteUser"></a>
|
||||
# **deleteUser**
|
||||
@@ -188,7 +184,7 @@ No authorization required
|
||||
### HTTP request headers
|
||||
|
||||
- **Content-Type**: Not defined
|
||||
- **Accept**: application/xml, application/json
|
||||
- **Accept**: Not defined
|
||||
|
||||
<a name="getUserByName"></a>
|
||||
# **getUserByName**
|
||||
@@ -196,8 +192,6 @@ No authorization required
|
||||
|
||||
Get user by user name
|
||||
|
||||
|
||||
|
||||
### Example
|
||||
```java
|
||||
// Import classes:
|
||||
@@ -241,8 +235,6 @@ No authorization required
|
||||
|
||||
Logs user into the system
|
||||
|
||||
|
||||
|
||||
### Example
|
||||
```java
|
||||
// Import classes:
|
||||
@@ -288,8 +280,6 @@ No authorization required
|
||||
|
||||
Logs out current logged in user session
|
||||
|
||||
|
||||
|
||||
### Example
|
||||
```java
|
||||
// Import classes:
|
||||
@@ -320,11 +310,11 @@ No authorization required
|
||||
### HTTP request headers
|
||||
|
||||
- **Content-Type**: Not defined
|
||||
- **Accept**: application/xml, application/json
|
||||
- **Accept**: Not defined
|
||||
|
||||
<a name="updateUser"></a>
|
||||
# **updateUser**
|
||||
> updateUser(username, body)
|
||||
> updateUser(username, user)
|
||||
|
||||
Updated user
|
||||
|
||||
@@ -339,9 +329,9 @@ This can only be done by the logged in user.
|
||||
|
||||
UserApi apiInstance = new UserApi();
|
||||
String username = "username_example"; // String | name that need to be deleted
|
||||
User body = new User(); // User | Updated user object
|
||||
User user = new User(); // User | Updated user object
|
||||
try {
|
||||
apiInstance.updateUser(username, body);
|
||||
apiInstance.updateUser(username, user);
|
||||
} catch (ApiException e) {
|
||||
System.err.println("Exception when calling UserApi#updateUser");
|
||||
e.printStackTrace();
|
||||
@@ -353,7 +343,7 @@ try {
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**username** | **String**| name that need to be deleted |
|
||||
**body** | [**User**](User.md)| Updated user object |
|
||||
**user** | [**User**](User.md)| Updated user object |
|
||||
|
||||
### Return type
|
||||
|
||||
@@ -366,5 +356,5 @@ No authorization required
|
||||
### HTTP request headers
|
||||
|
||||
- **Content-Type**: Not defined
|
||||
- **Accept**: application/xml, application/json
|
||||
- **Accept**: Not defined
|
||||
|
||||
|
||||
@@ -1,17 +1,17 @@
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>io.swagger</groupId>
|
||||
<artifactId>swagger-petstore-resttemplate</artifactId>
|
||||
<groupId>org.openapitools</groupId>
|
||||
<artifactId>petstore-resttemplate</artifactId>
|
||||
<packaging>jar</packaging>
|
||||
<name>swagger-petstore-resttemplate</name>
|
||||
<name>petstore-resttemplate</name>
|
||||
<version>1.0.0</version>
|
||||
<url>https://github.com/swagger-api/swagger-codegen</url>
|
||||
<description>Swagger Java</description>
|
||||
<url>https://github.com/openapitools/openapi-generator</url>
|
||||
<description>OpenAPI Java</description>
|
||||
<scm>
|
||||
<connection>scm:git:git@github.com:swagger-api/swagger-codegen.git</connection>
|
||||
<developerConnection>scm:git:git@github.com:swagger-api/swagger-codegen.git</developerConnection>
|
||||
<url>https://github.com/swagger-api/swagger-codegen</url>
|
||||
<connection>scm:git:git@github.com:openapitools/openapi-generator.git</connection>
|
||||
<developerConnection>scm:git:git@github.com:openapitools/openapi-generator.git</developerConnection>
|
||||
<url>https://github.com/openapitools/openapi-generator</url>
|
||||
</scm>
|
||||
|
||||
<licenses>
|
||||
@@ -24,10 +24,10 @@
|
||||
|
||||
<developers>
|
||||
<developer>
|
||||
<name>Swagger</name>
|
||||
<email>apiteam@swagger.io</email>
|
||||
<organization>Swagger</organization>
|
||||
<organizationUrl>http://swagger.io</organizationUrl>
|
||||
<name>OpenAPI</name>
|
||||
<email>team@openapitools.org</email>
|
||||
<organization>OpenAPI</organization>
|
||||
<organizationUrl>http://openapitools.org</organizationUrl>
|
||||
</developer>
|
||||
</developers>
|
||||
|
||||
@@ -139,8 +139,7 @@
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<version>3.6.1</version>
|
||||
<configuration>
|
||||
<source>
|
||||
1.7</source>
|
||||
<source>1.7</source>
|
||||
<target>1.7</target>
|
||||
</configuration>
|
||||
</plugin>
|
||||
|
||||
@@ -1 +1 @@
|
||||
rootProject.name = "swagger-petstore-resttemplate"
|
||||
rootProject.name = "petstore-resttemplate"
|
||||
@@ -49,16 +49,16 @@ public class AnotherFakeApi {
|
||||
* To test special tags
|
||||
* To test special tags
|
||||
* <p><b>200</b> - successful operation
|
||||
* @param body client model
|
||||
* @param client client model
|
||||
* @return Client
|
||||
* @throws RestClientException if an error occurs while attempting to invoke the API
|
||||
*/
|
||||
public Client testSpecialTags(Client body) throws RestClientException {
|
||||
Object postBody = body;
|
||||
public Client testSpecialTags(Client client) throws RestClientException {
|
||||
Object postBody = client;
|
||||
|
||||
// verify the required parameter 'body' is set
|
||||
if (body == null) {
|
||||
throw new HttpClientErrorException(HttpStatus.BAD_REQUEST, "Missing the required parameter 'body' when calling testSpecialTags");
|
||||
// verify the required parameter 'client' is set
|
||||
if (client == null) {
|
||||
throw new HttpClientErrorException(HttpStatus.BAD_REQUEST, "Missing the required parameter 'client' when calling testSpecialTags");
|
||||
}
|
||||
|
||||
String path = UriComponentsBuilder.fromPath("/another-fake/dummy").build().toUriString();
|
||||
|
||||
@@ -4,9 +4,11 @@ import io.swagger.client.ApiClient;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import io.swagger.client.model.Client;
|
||||
import java.io.File;
|
||||
import org.threeten.bp.LocalDate;
|
||||
import org.threeten.bp.OffsetDateTime;
|
||||
import io.swagger.client.model.OuterComposite;
|
||||
import io.swagger.client.model.User;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
@@ -53,12 +55,12 @@ public class FakeApi {
|
||||
*
|
||||
* Test serialization of outer boolean types
|
||||
* <p><b>200</b> - Output boolean
|
||||
* @param body Input boolean as post body
|
||||
* @param booleanPostBody Input boolean as post body
|
||||
* @return Boolean
|
||||
* @throws RestClientException if an error occurs while attempting to invoke the API
|
||||
*/
|
||||
public Boolean fakeOuterBooleanSerialize(Boolean body) throws RestClientException {
|
||||
Object postBody = body;
|
||||
public Boolean fakeOuterBooleanSerialize(Boolean booleanPostBody) throws RestClientException {
|
||||
Object postBody = booleanPostBody;
|
||||
|
||||
String path = UriComponentsBuilder.fromPath("/fake/outer/boolean").build().toUriString();
|
||||
|
||||
@@ -66,7 +68,9 @@ public class FakeApi {
|
||||
final HttpHeaders headerParams = new HttpHeaders();
|
||||
final MultiValueMap<String, Object> formParams = new LinkedMultiValueMap<String, Object>();
|
||||
|
||||
final String[] accepts = { };
|
||||
final String[] accepts = {
|
||||
"*/*"
|
||||
};
|
||||
final List<MediaType> accept = apiClient.selectHeaderAccept(accepts);
|
||||
final String[] contentTypes = { };
|
||||
final MediaType contentType = apiClient.selectHeaderContentType(contentTypes);
|
||||
@@ -80,12 +84,12 @@ public class FakeApi {
|
||||
*
|
||||
* Test serialization of object with outer number type
|
||||
* <p><b>200</b> - Output composite
|
||||
* @param body Input composite as post body
|
||||
* @param outerComposite Input composite as post body
|
||||
* @return OuterComposite
|
||||
* @throws RestClientException if an error occurs while attempting to invoke the API
|
||||
*/
|
||||
public OuterComposite fakeOuterCompositeSerialize(OuterComposite body) throws RestClientException {
|
||||
Object postBody = body;
|
||||
public OuterComposite fakeOuterCompositeSerialize(OuterComposite outerComposite) throws RestClientException {
|
||||
Object postBody = outerComposite;
|
||||
|
||||
String path = UriComponentsBuilder.fromPath("/fake/outer/composite").build().toUriString();
|
||||
|
||||
@@ -93,7 +97,9 @@ public class FakeApi {
|
||||
final HttpHeaders headerParams = new HttpHeaders();
|
||||
final MultiValueMap<String, Object> formParams = new LinkedMultiValueMap<String, Object>();
|
||||
|
||||
final String[] accepts = { };
|
||||
final String[] accepts = {
|
||||
"*/*"
|
||||
};
|
||||
final List<MediaType> accept = apiClient.selectHeaderAccept(accepts);
|
||||
final String[] contentTypes = { };
|
||||
final MediaType contentType = apiClient.selectHeaderContentType(contentTypes);
|
||||
@@ -120,7 +126,9 @@ public class FakeApi {
|
||||
final HttpHeaders headerParams = new HttpHeaders();
|
||||
final MultiValueMap<String, Object> formParams = new LinkedMultiValueMap<String, Object>();
|
||||
|
||||
final String[] accepts = { };
|
||||
final String[] accepts = {
|
||||
"*/*"
|
||||
};
|
||||
final List<MediaType> accept = apiClient.selectHeaderAccept(accepts);
|
||||
final String[] contentTypes = { };
|
||||
final MediaType contentType = apiClient.selectHeaderContentType(contentTypes);
|
||||
@@ -147,7 +155,9 @@ public class FakeApi {
|
||||
final HttpHeaders headerParams = new HttpHeaders();
|
||||
final MultiValueMap<String, Object> formParams = new LinkedMultiValueMap<String, Object>();
|
||||
|
||||
final String[] accepts = { };
|
||||
final String[] accepts = {
|
||||
"*/*"
|
||||
};
|
||||
final List<MediaType> accept = apiClient.selectHeaderAccept(accepts);
|
||||
final String[] contentTypes = { };
|
||||
final MediaType contentType = apiClient.selectHeaderContentType(contentTypes);
|
||||
@@ -157,20 +167,61 @@ public class FakeApi {
|
||||
ParameterizedTypeReference<String> returnType = new ParameterizedTypeReference<String>() {};
|
||||
return apiClient.invokeAPI(path, HttpMethod.POST, queryParams, postBody, headerParams, formParams, accept, contentType, authNames, returnType);
|
||||
}
|
||||
/**
|
||||
*
|
||||
*
|
||||
* <p><b>200</b> - Success
|
||||
* @param query The query parameter
|
||||
* @param user The user parameter
|
||||
* @throws RestClientException if an error occurs while attempting to invoke the API
|
||||
*/
|
||||
public void testBodyWithQueryParams(String query, User user) throws RestClientException {
|
||||
Object postBody = user;
|
||||
|
||||
// verify the required parameter 'query' is set
|
||||
if (query == null) {
|
||||
throw new HttpClientErrorException(HttpStatus.BAD_REQUEST, "Missing the required parameter 'query' when calling testBodyWithQueryParams");
|
||||
}
|
||||
|
||||
// verify the required parameter 'user' is set
|
||||
if (user == null) {
|
||||
throw new HttpClientErrorException(HttpStatus.BAD_REQUEST, "Missing the required parameter 'user' when calling testBodyWithQueryParams");
|
||||
}
|
||||
|
||||
String path = UriComponentsBuilder.fromPath("/fake/body-with-query-params").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>();
|
||||
|
||||
queryParams.putAll(apiClient.parameterToMultiValueMap(null, "query", query));
|
||||
|
||||
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>() {};
|
||||
apiClient.invokeAPI(path, HttpMethod.PUT, queryParams, postBody, headerParams, formParams, accept, contentType, authNames, returnType);
|
||||
}
|
||||
/**
|
||||
* To test \"client\" model
|
||||
* To test \"client\" model
|
||||
* <p><b>200</b> - successful operation
|
||||
* @param body client model
|
||||
* @param client client model
|
||||
* @return Client
|
||||
* @throws RestClientException if an error occurs while attempting to invoke the API
|
||||
*/
|
||||
public Client testClientModel(Client body) throws RestClientException {
|
||||
Object postBody = body;
|
||||
public Client testClientModel(Client client) throws RestClientException {
|
||||
Object postBody = client;
|
||||
|
||||
// verify the required parameter 'body' is set
|
||||
if (body == null) {
|
||||
throw new HttpClientErrorException(HttpStatus.BAD_REQUEST, "Missing the required parameter 'body' when calling testClientModel");
|
||||
// verify the required parameter 'client' is set
|
||||
if (client == null) {
|
||||
throw new HttpClientErrorException(HttpStatus.BAD_REQUEST, "Missing the required parameter 'client' when calling testClientModel");
|
||||
}
|
||||
|
||||
String path = UriComponentsBuilder.fromPath("/fake").build().toUriString();
|
||||
@@ -214,7 +265,7 @@ public class FakeApi {
|
||||
* @param paramCallback None
|
||||
* @throws RestClientException if an error occurs while attempting to invoke the API
|
||||
*/
|
||||
public void testEndpointParameters(BigDecimal number, Double _double, String patternWithoutDelimiter, byte[] _byte, Integer integer, Integer int32, Long int64, Float _float, String string, byte[] binary, LocalDate date, OffsetDateTime dateTime, String password, String paramCallback) throws RestClientException {
|
||||
public void testEndpointParameters(BigDecimal number, Double _double, String patternWithoutDelimiter, byte[] _byte, Integer integer, Integer int32, Long int64, Float _float, String string, File binary, LocalDate date, OffsetDateTime dateTime, String password, String paramCallback) throws RestClientException {
|
||||
Object postBody = null;
|
||||
|
||||
// verify the required parameter 'number' is set
|
||||
@@ -262,7 +313,7 @@ public class FakeApi {
|
||||
if (_byte != null)
|
||||
formParams.add("byte", _byte);
|
||||
if (binary != null)
|
||||
formParams.add("binary", binary);
|
||||
formParams.add("binary", new FileSystemResource(binary));
|
||||
if (date != null)
|
||||
formParams.add("date", date);
|
||||
if (dateTime != null)
|
||||
@@ -272,12 +323,10 @@ public class FakeApi {
|
||||
if (paramCallback != null)
|
||||
formParams.add("callback", paramCallback);
|
||||
|
||||
final String[] accepts = {
|
||||
"application/xml; charset=utf-8", "application/json; charset=utf-8"
|
||||
};
|
||||
final String[] accepts = { };
|
||||
final List<MediaType> accept = apiClient.selectHeaderAccept(accepts);
|
||||
final String[] contentTypes = {
|
||||
"application/xml; charset=utf-8", "application/json; charset=utf-8"
|
||||
"application/x-www-form-urlencoded"
|
||||
};
|
||||
final MediaType contentType = apiClient.selectHeaderContentType(contentTypes);
|
||||
|
||||
@@ -291,17 +340,17 @@ public class FakeApi {
|
||||
* To test enum parameters
|
||||
* <p><b>400</b> - Invalid request
|
||||
* <p><b>404</b> - Not found
|
||||
* @param enumFormStringArray Form parameter enum test (string array)
|
||||
* @param enumFormString Form parameter enum test (string)
|
||||
* @param enumHeaderStringArray Header parameter enum test (string array)
|
||||
* @param enumHeaderString Header parameter enum test (string)
|
||||
* @param enumQueryStringArray Query parameter enum test (string array)
|
||||
* @param enumQueryString Query parameter enum test (string)
|
||||
* @param enumQueryInteger Query parameter enum test (double)
|
||||
* @param enumQueryDouble Query parameter enum test (double)
|
||||
* @param enumFormStringArray Form parameter enum test (string array)
|
||||
* @param enumFormString Form parameter enum test (string)
|
||||
* @throws RestClientException if an error occurs while attempting to invoke the API
|
||||
*/
|
||||
public void testEnumParameters(List<String> enumFormStringArray, String enumFormString, List<String> enumHeaderStringArray, String enumHeaderString, List<String> enumQueryStringArray, String enumQueryString, Integer enumQueryInteger, Double enumQueryDouble) throws RestClientException {
|
||||
public void testEnumParameters(List<String> enumHeaderStringArray, String enumHeaderString, List<String> enumQueryStringArray, String enumQueryString, Integer enumQueryInteger, Double enumQueryDouble, List<String> enumFormStringArray, String enumFormString) throws RestClientException {
|
||||
Object postBody = null;
|
||||
|
||||
String path = UriComponentsBuilder.fromPath("/fake").build().toUriString();
|
||||
@@ -313,6 +362,7 @@ public class FakeApi {
|
||||
queryParams.putAll(apiClient.parameterToMultiValueMap(ApiClient.CollectionFormat.valueOf("csv".toUpperCase()), "enum_query_string_array", enumQueryStringArray));
|
||||
queryParams.putAll(apiClient.parameterToMultiValueMap(null, "enum_query_string", enumQueryString));
|
||||
queryParams.putAll(apiClient.parameterToMultiValueMap(null, "enum_query_integer", enumQueryInteger));
|
||||
queryParams.putAll(apiClient.parameterToMultiValueMap(null, "enum_query_double", enumQueryDouble));
|
||||
|
||||
if (enumHeaderStringArray != null)
|
||||
headerParams.add("enum_header_string_array", apiClient.parameterToString(enumHeaderStringArray));
|
||||
@@ -323,15 +373,11 @@ public class FakeApi {
|
||||
formParams.add("enum_form_string_array", enumFormStringArray);
|
||||
if (enumFormString != null)
|
||||
formParams.add("enum_form_string", enumFormString);
|
||||
if (enumQueryDouble != null)
|
||||
formParams.add("enum_query_double", enumQueryDouble);
|
||||
|
||||
final String[] accepts = {
|
||||
"*/*"
|
||||
};
|
||||
final String[] accepts = { };
|
||||
final List<MediaType> accept = apiClient.selectHeaderAccept(accepts);
|
||||
final String[] contentTypes = {
|
||||
"*/*"
|
||||
"application/x-www-form-urlencoded"
|
||||
};
|
||||
final MediaType contentType = apiClient.selectHeaderContentType(contentTypes);
|
||||
|
||||
@@ -344,15 +390,15 @@ public class FakeApi {
|
||||
* test inline additionalProperties
|
||||
*
|
||||
* <p><b>200</b> - successful operation
|
||||
* @param param request body
|
||||
* @param requestBody request body
|
||||
* @throws RestClientException if an error occurs while attempting to invoke the API
|
||||
*/
|
||||
public void testInlineAdditionalProperties(Object param) throws RestClientException {
|
||||
Object postBody = param;
|
||||
public void testInlineAdditionalProperties(String requestBody) throws RestClientException {
|
||||
Object postBody = requestBody;
|
||||
|
||||
// verify the required parameter 'param' is set
|
||||
if (param == null) {
|
||||
throw new HttpClientErrorException(HttpStatus.BAD_REQUEST, "Missing the required parameter 'param' when calling testInlineAdditionalProperties");
|
||||
// verify the required parameter 'requestBody' is set
|
||||
if (requestBody == null) {
|
||||
throw new HttpClientErrorException(HttpStatus.BAD_REQUEST, "Missing the required parameter 'requestBody' when calling testInlineAdditionalProperties");
|
||||
}
|
||||
|
||||
String path = UriComponentsBuilder.fromPath("/fake/inline-additionalProperties").build().toUriString();
|
||||
@@ -408,7 +454,7 @@ public class FakeApi {
|
||||
final String[] accepts = { };
|
||||
final List<MediaType> accept = apiClient.selectHeaderAccept(accepts);
|
||||
final String[] contentTypes = {
|
||||
"application/json"
|
||||
"application/x-www-form-urlencoded"
|
||||
};
|
||||
final MediaType contentType = apiClient.selectHeaderContentType(contentTypes);
|
||||
|
||||
|
||||
@@ -49,16 +49,16 @@ public class FakeClassnameTags123Api {
|
||||
* To test class name in snake case
|
||||
* To test class name in snake case
|
||||
* <p><b>200</b> - successful operation
|
||||
* @param body client model
|
||||
* @param client client model
|
||||
* @return Client
|
||||
* @throws RestClientException if an error occurs while attempting to invoke the API
|
||||
*/
|
||||
public Client testClassname(Client body) throws RestClientException {
|
||||
Object postBody = body;
|
||||
public Client testClassname(Client client) throws RestClientException {
|
||||
Object postBody = client;
|
||||
|
||||
// verify the required parameter 'body' is set
|
||||
if (body == null) {
|
||||
throw new HttpClientErrorException(HttpStatus.BAD_REQUEST, "Missing the required parameter 'body' when calling testClassname");
|
||||
// verify the required parameter 'client' is set
|
||||
if (client == null) {
|
||||
throw new HttpClientErrorException(HttpStatus.BAD_REQUEST, "Missing the required parameter 'client' when calling testClassname");
|
||||
}
|
||||
|
||||
String path = UriComponentsBuilder.fromPath("/fake_classname_test").build().toUriString();
|
||||
|
||||
@@ -51,15 +51,15 @@ public class PetApi {
|
||||
* Add a new pet to the store
|
||||
*
|
||||
* <p><b>405</b> - Invalid input
|
||||
* @param body Pet object that needs to be added to the store
|
||||
* @param pet Pet object that needs to be added to the store
|
||||
* @throws RestClientException if an error occurs while attempting to invoke the API
|
||||
*/
|
||||
public void addPet(Pet body) throws RestClientException {
|
||||
Object postBody = body;
|
||||
public void addPet(Pet pet) throws RestClientException {
|
||||
Object postBody = pet;
|
||||
|
||||
// verify the required parameter 'body' is set
|
||||
if (body == null) {
|
||||
throw new HttpClientErrorException(HttpStatus.BAD_REQUEST, "Missing the required parameter 'body' when calling addPet");
|
||||
// verify the required parameter 'pet' is set
|
||||
if (pet == null) {
|
||||
throw new HttpClientErrorException(HttpStatus.BAD_REQUEST, "Missing the required parameter 'pet' when calling addPet");
|
||||
}
|
||||
|
||||
String path = UriComponentsBuilder.fromPath("/pet").build().toUriString();
|
||||
@@ -68,9 +68,7 @@ public class PetApi {
|
||||
final HttpHeaders headerParams = new HttpHeaders();
|
||||
final MultiValueMap<String, Object> formParams = new LinkedMultiValueMap<String, Object>();
|
||||
|
||||
final String[] accepts = {
|
||||
"application/xml", "application/json"
|
||||
};
|
||||
final String[] accepts = { };
|
||||
final List<MediaType> accept = apiClient.selectHeaderAccept(accepts);
|
||||
final String[] contentTypes = {
|
||||
"application/json", "application/xml"
|
||||
@@ -110,9 +108,7 @@ public class PetApi {
|
||||
if (apiKey != null)
|
||||
headerParams.add("api_key", apiClient.parameterToString(apiKey));
|
||||
|
||||
final String[] accepts = {
|
||||
"application/xml", "application/json"
|
||||
};
|
||||
final String[] accepts = { };
|
||||
final List<MediaType> accept = apiClient.selectHeaderAccept(accepts);
|
||||
final String[] contentTypes = { };
|
||||
final MediaType contentType = apiClient.selectHeaderContentType(contentTypes);
|
||||
@@ -241,15 +237,15 @@ public class PetApi {
|
||||
* <p><b>400</b> - Invalid ID supplied
|
||||
* <p><b>404</b> - Pet not found
|
||||
* <p><b>405</b> - Validation exception
|
||||
* @param body Pet object that needs to be added to the store
|
||||
* @param pet Pet object that needs to be added to the store
|
||||
* @throws RestClientException if an error occurs while attempting to invoke the API
|
||||
*/
|
||||
public void updatePet(Pet body) throws RestClientException {
|
||||
Object postBody = body;
|
||||
public void updatePet(Pet pet) throws RestClientException {
|
||||
Object postBody = pet;
|
||||
|
||||
// verify the required parameter 'body' is set
|
||||
if (body == null) {
|
||||
throw new HttpClientErrorException(HttpStatus.BAD_REQUEST, "Missing the required parameter 'body' when calling updatePet");
|
||||
// verify the required parameter 'pet' is set
|
||||
if (pet == null) {
|
||||
throw new HttpClientErrorException(HttpStatus.BAD_REQUEST, "Missing the required parameter 'pet' when calling updatePet");
|
||||
}
|
||||
|
||||
String path = UriComponentsBuilder.fromPath("/pet").build().toUriString();
|
||||
@@ -258,9 +254,7 @@ public class PetApi {
|
||||
final HttpHeaders headerParams = new HttpHeaders();
|
||||
final MultiValueMap<String, Object> formParams = new LinkedMultiValueMap<String, Object>();
|
||||
|
||||
final String[] accepts = {
|
||||
"application/xml", "application/json"
|
||||
};
|
||||
final String[] accepts = { };
|
||||
final List<MediaType> accept = apiClient.selectHeaderAccept(accepts);
|
||||
final String[] contentTypes = {
|
||||
"application/json", "application/xml"
|
||||
@@ -303,9 +297,7 @@ public class PetApi {
|
||||
if (status != null)
|
||||
formParams.add("status", status);
|
||||
|
||||
final String[] accepts = {
|
||||
"application/xml", "application/json"
|
||||
};
|
||||
final String[] accepts = { };
|
||||
final List<MediaType> accept = apiClient.selectHeaderAccept(accepts);
|
||||
final String[] contentTypes = {
|
||||
"application/x-www-form-urlencoded"
|
||||
|
||||
@@ -70,9 +70,7 @@ public class StoreApi {
|
||||
final HttpHeaders headerParams = new HttpHeaders();
|
||||
final MultiValueMap<String, Object> formParams = new LinkedMultiValueMap<String, Object>();
|
||||
|
||||
final String[] accepts = {
|
||||
"application/xml", "application/json"
|
||||
};
|
||||
final String[] accepts = { };
|
||||
final List<MediaType> accept = apiClient.selectHeaderAccept(accepts);
|
||||
final String[] contentTypes = { };
|
||||
final MediaType contentType = apiClient.selectHeaderContentType(contentTypes);
|
||||
@@ -154,16 +152,16 @@ public class StoreApi {
|
||||
*
|
||||
* <p><b>200</b> - successful operation
|
||||
* <p><b>400</b> - Invalid Order
|
||||
* @param body order placed for purchasing the pet
|
||||
* @param order order placed for purchasing the pet
|
||||
* @return Order
|
||||
* @throws RestClientException if an error occurs while attempting to invoke the API
|
||||
*/
|
||||
public Order placeOrder(Order body) throws RestClientException {
|
||||
Object postBody = body;
|
||||
public Order placeOrder(Order order) throws RestClientException {
|
||||
Object postBody = order;
|
||||
|
||||
// verify the required parameter 'body' is set
|
||||
if (body == null) {
|
||||
throw new HttpClientErrorException(HttpStatus.BAD_REQUEST, "Missing the required parameter 'body' when calling placeOrder");
|
||||
// verify the required parameter 'order' is set
|
||||
if (order == null) {
|
||||
throw new HttpClientErrorException(HttpStatus.BAD_REQUEST, "Missing the required parameter 'order' when calling placeOrder");
|
||||
}
|
||||
|
||||
String path = UriComponentsBuilder.fromPath("/store/order").build().toUriString();
|
||||
|
||||
@@ -49,15 +49,15 @@ public class UserApi {
|
||||
* Create user
|
||||
* This can only be done by the logged in user.
|
||||
* <p><b>0</b> - successful operation
|
||||
* @param body Created user object
|
||||
* @param user Created user object
|
||||
* @throws RestClientException if an error occurs while attempting to invoke the API
|
||||
*/
|
||||
public void createUser(User body) throws RestClientException {
|
||||
Object postBody = body;
|
||||
public void createUser(User user) throws RestClientException {
|
||||
Object postBody = user;
|
||||
|
||||
// verify the required parameter 'body' is set
|
||||
if (body == null) {
|
||||
throw new HttpClientErrorException(HttpStatus.BAD_REQUEST, "Missing the required parameter 'body' when calling createUser");
|
||||
// verify the required parameter 'user' is set
|
||||
if (user == null) {
|
||||
throw new HttpClientErrorException(HttpStatus.BAD_REQUEST, "Missing the required parameter 'user' when calling createUser");
|
||||
}
|
||||
|
||||
String path = UriComponentsBuilder.fromPath("/user").build().toUriString();
|
||||
@@ -66,9 +66,7 @@ public class UserApi {
|
||||
final HttpHeaders headerParams = new HttpHeaders();
|
||||
final MultiValueMap<String, Object> formParams = new LinkedMultiValueMap<String, Object>();
|
||||
|
||||
final String[] accepts = {
|
||||
"application/xml", "application/json"
|
||||
};
|
||||
final String[] accepts = { };
|
||||
final List<MediaType> accept = apiClient.selectHeaderAccept(accepts);
|
||||
final String[] contentTypes = { };
|
||||
final MediaType contentType = apiClient.selectHeaderContentType(contentTypes);
|
||||
@@ -82,15 +80,15 @@ public class UserApi {
|
||||
* Creates list of users with given input array
|
||||
*
|
||||
* <p><b>0</b> - successful operation
|
||||
* @param body List of user object
|
||||
* @param user List of user object
|
||||
* @throws RestClientException if an error occurs while attempting to invoke the API
|
||||
*/
|
||||
public void createUsersWithArrayInput(List<User> body) throws RestClientException {
|
||||
Object postBody = body;
|
||||
public void createUsersWithArrayInput(List<User> user) throws RestClientException {
|
||||
Object postBody = user;
|
||||
|
||||
// verify the required parameter 'body' is set
|
||||
if (body == null) {
|
||||
throw new HttpClientErrorException(HttpStatus.BAD_REQUEST, "Missing the required parameter 'body' when calling createUsersWithArrayInput");
|
||||
// verify the required parameter 'user' is set
|
||||
if (user == null) {
|
||||
throw new HttpClientErrorException(HttpStatus.BAD_REQUEST, "Missing the required parameter 'user' when calling createUsersWithArrayInput");
|
||||
}
|
||||
|
||||
String path = UriComponentsBuilder.fromPath("/user/createWithArray").build().toUriString();
|
||||
@@ -99,9 +97,7 @@ public class UserApi {
|
||||
final HttpHeaders headerParams = new HttpHeaders();
|
||||
final MultiValueMap<String, Object> formParams = new LinkedMultiValueMap<String, Object>();
|
||||
|
||||
final String[] accepts = {
|
||||
"application/xml", "application/json"
|
||||
};
|
||||
final String[] accepts = { };
|
||||
final List<MediaType> accept = apiClient.selectHeaderAccept(accepts);
|
||||
final String[] contentTypes = { };
|
||||
final MediaType contentType = apiClient.selectHeaderContentType(contentTypes);
|
||||
@@ -115,15 +111,15 @@ public class UserApi {
|
||||
* Creates list of users with given input array
|
||||
*
|
||||
* <p><b>0</b> - successful operation
|
||||
* @param body List of user object
|
||||
* @param user List of user object
|
||||
* @throws RestClientException if an error occurs while attempting to invoke the API
|
||||
*/
|
||||
public void createUsersWithListInput(List<User> body) throws RestClientException {
|
||||
Object postBody = body;
|
||||
public void createUsersWithListInput(List<User> user) throws RestClientException {
|
||||
Object postBody = user;
|
||||
|
||||
// verify the required parameter 'body' is set
|
||||
if (body == null) {
|
||||
throw new HttpClientErrorException(HttpStatus.BAD_REQUEST, "Missing the required parameter 'body' when calling createUsersWithListInput");
|
||||
// verify the required parameter 'user' is set
|
||||
if (user == null) {
|
||||
throw new HttpClientErrorException(HttpStatus.BAD_REQUEST, "Missing the required parameter 'user' when calling createUsersWithListInput");
|
||||
}
|
||||
|
||||
String path = UriComponentsBuilder.fromPath("/user/createWithList").build().toUriString();
|
||||
@@ -132,9 +128,7 @@ public class UserApi {
|
||||
final HttpHeaders headerParams = new HttpHeaders();
|
||||
final MultiValueMap<String, Object> formParams = new LinkedMultiValueMap<String, Object>();
|
||||
|
||||
final String[] accepts = {
|
||||
"application/xml", "application/json"
|
||||
};
|
||||
final String[] accepts = { };
|
||||
final List<MediaType> accept = apiClient.selectHeaderAccept(accepts);
|
||||
final String[] contentTypes = { };
|
||||
final MediaType contentType = apiClient.selectHeaderContentType(contentTypes);
|
||||
@@ -169,9 +163,7 @@ public class UserApi {
|
||||
final HttpHeaders headerParams = new HttpHeaders();
|
||||
final MultiValueMap<String, Object> formParams = new LinkedMultiValueMap<String, Object>();
|
||||
|
||||
final String[] accepts = {
|
||||
"application/xml", "application/json"
|
||||
};
|
||||
final String[] accepts = { };
|
||||
final List<MediaType> accept = apiClient.selectHeaderAccept(accepts);
|
||||
final String[] contentTypes = { };
|
||||
final MediaType contentType = apiClient.selectHeaderContentType(contentTypes);
|
||||
@@ -279,9 +271,7 @@ public class UserApi {
|
||||
final HttpHeaders headerParams = new HttpHeaders();
|
||||
final MultiValueMap<String, Object> formParams = new LinkedMultiValueMap<String, Object>();
|
||||
|
||||
final String[] accepts = {
|
||||
"application/xml", "application/json"
|
||||
};
|
||||
final String[] accepts = { };
|
||||
final List<MediaType> accept = apiClient.selectHeaderAccept(accepts);
|
||||
final String[] contentTypes = { };
|
||||
final MediaType contentType = apiClient.selectHeaderContentType(contentTypes);
|
||||
@@ -297,20 +287,20 @@ public class UserApi {
|
||||
* <p><b>400</b> - Invalid user supplied
|
||||
* <p><b>404</b> - User not found
|
||||
* @param username name that need to be deleted
|
||||
* @param body Updated user object
|
||||
* @param user Updated user object
|
||||
* @throws RestClientException if an error occurs while attempting to invoke the API
|
||||
*/
|
||||
public void updateUser(String username, User body) throws RestClientException {
|
||||
Object postBody = body;
|
||||
public void updateUser(String username, User user) throws RestClientException {
|
||||
Object postBody = user;
|
||||
|
||||
// verify the required parameter 'username' is set
|
||||
if (username == null) {
|
||||
throw new HttpClientErrorException(HttpStatus.BAD_REQUEST, "Missing the required parameter 'username' when calling updateUser");
|
||||
}
|
||||
|
||||
// verify the required parameter 'body' is set
|
||||
if (body == null) {
|
||||
throw new HttpClientErrorException(HttpStatus.BAD_REQUEST, "Missing the required parameter 'body' when calling updateUser");
|
||||
// verify the required parameter 'user' is set
|
||||
if (user == null) {
|
||||
throw new HttpClientErrorException(HttpStatus.BAD_REQUEST, "Missing the required parameter 'user' when calling updateUser");
|
||||
}
|
||||
|
||||
// create path and map variables
|
||||
@@ -322,9 +312,7 @@ public class UserApi {
|
||||
final HttpHeaders headerParams = new HttpHeaders();
|
||||
final MultiValueMap<String, Object> formParams = new LinkedMultiValueMap<String, Object>();
|
||||
|
||||
final String[] accepts = {
|
||||
"application/xml", "application/json"
|
||||
};
|
||||
final String[] accepts = { };
|
||||
final List<MediaType> accept = apiClient.selectHeaderAccept(accepts);
|
||||
final String[] contentTypes = { };
|
||||
final MediaType contentType = apiClient.selectHeaderContentType(contentTypes);
|
||||
|
||||
@@ -67,6 +67,46 @@ public class EnumTest {
|
||||
@JsonProperty("enum_string")
|
||||
private EnumStringEnum enumString = null;
|
||||
|
||||
/**
|
||||
* Gets or Sets enumStringRequired
|
||||
*/
|
||||
public enum EnumStringRequiredEnum {
|
||||
UPPER("UPPER"),
|
||||
|
||||
LOWER("lower"),
|
||||
|
||||
EMPTY("");
|
||||
|
||||
private String value;
|
||||
|
||||
EnumStringRequiredEnum(String value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
@JsonValue
|
||||
public String getValue() {
|
||||
return value;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return String.valueOf(value);
|
||||
}
|
||||
|
||||
@JsonCreator
|
||||
public static EnumStringRequiredEnum fromValue(String text) {
|
||||
for (EnumStringRequiredEnum b : EnumStringRequiredEnum.values()) {
|
||||
if (String.valueOf(b.value).equals(text)) {
|
||||
return b;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@JsonProperty("enum_string_required")
|
||||
private EnumStringRequiredEnum enumStringRequired = null;
|
||||
|
||||
/**
|
||||
* Gets or Sets enumInteger
|
||||
*/
|
||||
@@ -164,6 +204,24 @@ public class EnumTest {
|
||||
this.enumString = enumString;
|
||||
}
|
||||
|
||||
public EnumTest enumStringRequired(EnumStringRequiredEnum enumStringRequired) {
|
||||
this.enumStringRequired = enumStringRequired;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get enumStringRequired
|
||||
* @return enumStringRequired
|
||||
**/
|
||||
@ApiModelProperty(required = true, value = "")
|
||||
public EnumStringRequiredEnum getEnumStringRequired() {
|
||||
return enumStringRequired;
|
||||
}
|
||||
|
||||
public void setEnumStringRequired(EnumStringRequiredEnum enumStringRequired) {
|
||||
this.enumStringRequired = enumStringRequired;
|
||||
}
|
||||
|
||||
public EnumTest enumInteger(EnumIntegerEnum enumInteger) {
|
||||
this.enumInteger = enumInteger;
|
||||
return this;
|
||||
@@ -229,6 +287,7 @@ public class EnumTest {
|
||||
}
|
||||
EnumTest enumTest = (EnumTest) o;
|
||||
return Objects.equals(this.enumString, enumTest.enumString) &&
|
||||
Objects.equals(this.enumStringRequired, enumTest.enumStringRequired) &&
|
||||
Objects.equals(this.enumInteger, enumTest.enumInteger) &&
|
||||
Objects.equals(this.enumNumber, enumTest.enumNumber) &&
|
||||
Objects.equals(this.outerEnum, enumTest.outerEnum);
|
||||
@@ -236,7 +295,7 @@ public class EnumTest {
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash(enumString, enumInteger, enumNumber, outerEnum);
|
||||
return Objects.hash(enumString, enumStringRequired, enumInteger, enumNumber, outerEnum);
|
||||
}
|
||||
|
||||
|
||||
@@ -246,6 +305,7 @@ public class EnumTest {
|
||||
sb.append("class EnumTest {\n");
|
||||
|
||||
sb.append(" enumString: ").append(toIndentedString(enumString)).append("\n");
|
||||
sb.append(" enumStringRequired: ").append(toIndentedString(enumStringRequired)).append("\n");
|
||||
sb.append(" enumInteger: ").append(toIndentedString(enumInteger)).append("\n");
|
||||
sb.append(" enumNumber: ").append(toIndentedString(enumNumber)).append("\n");
|
||||
sb.append(" outerEnum: ").append(toIndentedString(outerEnum)).append("\n");
|
||||
|
||||
@@ -20,6 +20,7 @@ import com.fasterxml.jackson.annotation.JsonCreator;
|
||||
import com.fasterxml.jackson.annotation.JsonValue;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import java.io.File;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.UUID;
|
||||
import org.threeten.bp.LocalDate;
|
||||
@@ -55,7 +56,7 @@ public class FormatTest {
|
||||
private byte[] _byte = null;
|
||||
|
||||
@JsonProperty("binary")
|
||||
private byte[] binary = null;
|
||||
private File binary = null;
|
||||
|
||||
@JsonProperty("date")
|
||||
private LocalDate date = null;
|
||||
@@ -223,7 +224,7 @@ public class FormatTest {
|
||||
this._byte = _byte;
|
||||
}
|
||||
|
||||
public FormatTest binary(byte[] binary) {
|
||||
public FormatTest binary(File binary) {
|
||||
this.binary = binary;
|
||||
return this;
|
||||
}
|
||||
@@ -233,11 +234,11 @@ public class FormatTest {
|
||||
* @return binary
|
||||
**/
|
||||
@ApiModelProperty(value = "")
|
||||
public byte[] getBinary() {
|
||||
public File getBinary() {
|
||||
return binary;
|
||||
}
|
||||
|
||||
public void setBinary(byte[] binary) {
|
||||
public void setBinary(File binary) {
|
||||
this.binary = binary;
|
||||
}
|
||||
|
||||
@@ -331,7 +332,7 @@ public class FormatTest {
|
||||
Objects.equals(this._double, formatTest._double) &&
|
||||
Objects.equals(this.string, formatTest.string) &&
|
||||
Arrays.equals(this._byte, formatTest._byte) &&
|
||||
Arrays.equals(this.binary, formatTest.binary) &&
|
||||
Objects.equals(this.binary, formatTest.binary) &&
|
||||
Objects.equals(this.date, formatTest.date) &&
|
||||
Objects.equals(this.dateTime, formatTest.dateTime) &&
|
||||
Objects.equals(this.uuid, formatTest.uuid) &&
|
||||
@@ -340,7 +341,7 @@ public class FormatTest {
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash(integer, int32, int64, number, _float, _double, string, Arrays.hashCode(_byte), Arrays.hashCode(binary), date, dateTime, uuid, password);
|
||||
return Objects.hash(integer, int32, int64, number, _float, _double, string, Arrays.hashCode(_byte), binary, date, dateTime, uuid, password);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -78,9 +78,9 @@ public class Model200Response {
|
||||
if (o == null || getClass() != o.getClass()) {
|
||||
return false;
|
||||
}
|
||||
Model200Response _200Response = (Model200Response) o;
|
||||
return Objects.equals(this.name, _200Response.name) &&
|
||||
Objects.equals(this.propertyClass, _200Response.propertyClass);
|
||||
Model200Response _200response = (Model200Response) o;
|
||||
return Objects.equals(this.name, _200response.name) &&
|
||||
Objects.equals(this.propertyClass, _200response.propertyClass);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -37,7 +37,7 @@ public class Name {
|
||||
private String property = null;
|
||||
|
||||
@JsonProperty("123Number")
|
||||
private Integer _123Number = null;
|
||||
private Integer _123number = null;
|
||||
|
||||
public Name name(Integer name) {
|
||||
this.name = name;
|
||||
@@ -85,12 +85,12 @@ public class Name {
|
||||
}
|
||||
|
||||
/**
|
||||
* Get _123Number
|
||||
* @return _123Number
|
||||
* Get _123number
|
||||
* @return _123number
|
||||
**/
|
||||
@ApiModelProperty(value = "")
|
||||
public Integer get123Number() {
|
||||
return _123Number;
|
||||
public Integer get123number() {
|
||||
return _123number;
|
||||
}
|
||||
|
||||
|
||||
@@ -106,12 +106,12 @@ public class Name {
|
||||
return Objects.equals(this.name, name.name) &&
|
||||
Objects.equals(this.snakeCase, name.snakeCase) &&
|
||||
Objects.equals(this.property, name.property) &&
|
||||
Objects.equals(this._123Number, name._123Number);
|
||||
Objects.equals(this._123number, name._123number);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash(name, snakeCase, property, _123Number);
|
||||
return Objects.hash(name, snakeCase, property, _123number);
|
||||
}
|
||||
|
||||
|
||||
@@ -123,7 +123,7 @@ public class Name {
|
||||
sb.append(" name: ").append(toIndentedString(name)).append("\n");
|
||||
sb.append(" snakeCase: ").append(toIndentedString(snakeCase)).append("\n");
|
||||
sb.append(" property: ").append(toIndentedString(property)).append("\n");
|
||||
sb.append(" _123Number: ").append(toIndentedString(_123Number)).append("\n");
|
||||
sb.append(" _123number: ").append(toIndentedString(_123number)).append("\n");
|
||||
sb.append("}");
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
@@ -0,0 +1,63 @@
|
||||
/*
|
||||
* Swagger 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
|
||||
* Contact: apiteam@swagger.io
|
||||
*
|
||||
* NOTE: This class is auto generated by the swagger code generator program.
|
||||
* https://github.com/swagger-api/swagger-codegen.git
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
|
||||
|
||||
package io.swagger.client.model;
|
||||
|
||||
import java.util.Objects;
|
||||
import java.util.Arrays;
|
||||
|
||||
/**
|
||||
* OuterBoolean
|
||||
*/
|
||||
|
||||
public class OuterBoolean {
|
||||
|
||||
@Override
|
||||
public boolean equals(java.lang.Object o) {
|
||||
if (this == o) {
|
||||
return true;
|
||||
}
|
||||
if (o == null || getClass() != o.getClass()) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append("class OuterBoolean {\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 ");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,63 @@
|
||||
/*
|
||||
* Swagger 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
|
||||
* Contact: apiteam@swagger.io
|
||||
*
|
||||
* NOTE: This class is auto generated by the swagger code generator program.
|
||||
* https://github.com/swagger-api/swagger-codegen.git
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
|
||||
|
||||
package io.swagger.client.model;
|
||||
|
||||
import java.util.Objects;
|
||||
import java.util.Arrays;
|
||||
|
||||
/**
|
||||
* OuterNumber
|
||||
*/
|
||||
|
||||
public class OuterNumber {
|
||||
|
||||
@Override
|
||||
public boolean equals(java.lang.Object o) {
|
||||
if (this == o) {
|
||||
return true;
|
||||
}
|
||||
if (o == null || getClass() != o.getClass()) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append("class OuterNumber {\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 ");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,63 @@
|
||||
/*
|
||||
* Swagger 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
|
||||
* Contact: apiteam@swagger.io
|
||||
*
|
||||
* NOTE: This class is auto generated by the swagger code generator program.
|
||||
* https://github.com/swagger-api/swagger-codegen.git
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
|
||||
|
||||
package io.swagger.client.model;
|
||||
|
||||
import java.util.Objects;
|
||||
import java.util.Arrays;
|
||||
|
||||
/**
|
||||
* OuterString
|
||||
*/
|
||||
|
||||
public class OuterString {
|
||||
|
||||
@Override
|
||||
public boolean equals(java.lang.Object o) {
|
||||
if (this == o) {
|
||||
return true;
|
||||
}
|
||||
if (o == null || getClass() != o.getClass()) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append("class OuterString {\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 ");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -27,24 +27,24 @@ import io.swagger.annotations.ApiModelProperty;
|
||||
|
||||
public class SpecialModelName {
|
||||
@JsonProperty("$special[property.name]")
|
||||
private Long specialPropertyName = null;
|
||||
private Long $specialPropertyName = null;
|
||||
|
||||
public SpecialModelName specialPropertyName(Long specialPropertyName) {
|
||||
this.specialPropertyName = specialPropertyName;
|
||||
public SpecialModelName $specialPropertyName(Long $specialPropertyName) {
|
||||
this.$specialPropertyName = $specialPropertyName;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get specialPropertyName
|
||||
* @return specialPropertyName
|
||||
* Get $specialPropertyName
|
||||
* @return $specialPropertyName
|
||||
**/
|
||||
@ApiModelProperty(value = "")
|
||||
public Long getSpecialPropertyName() {
|
||||
return specialPropertyName;
|
||||
public Long get$SpecialPropertyName() {
|
||||
return $specialPropertyName;
|
||||
}
|
||||
|
||||
public void setSpecialPropertyName(Long specialPropertyName) {
|
||||
this.specialPropertyName = specialPropertyName;
|
||||
public void set$SpecialPropertyName(Long $specialPropertyName) {
|
||||
this.$specialPropertyName = $specialPropertyName;
|
||||
}
|
||||
|
||||
|
||||
@@ -56,13 +56,13 @@ public class SpecialModelName {
|
||||
if (o == null || getClass() != o.getClass()) {
|
||||
return false;
|
||||
}
|
||||
SpecialModelName specialModelName = (SpecialModelName) o;
|
||||
return Objects.equals(this.specialPropertyName, specialModelName.specialPropertyName);
|
||||
SpecialModelName $specialModelName = (SpecialModelName) o;
|
||||
return Objects.equals(this.$specialPropertyName, $specialModelName.$specialPropertyName);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash(specialPropertyName);
|
||||
return Objects.hash($specialPropertyName);
|
||||
}
|
||||
|
||||
|
||||
@@ -71,7 +71,7 @@ public class SpecialModelName {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append("class SpecialModelName {\n");
|
||||
|
||||
sb.append(" specialPropertyName: ").append(toIndentedString(specialPropertyName)).append("\n");
|
||||
sb.append(" $specialPropertyName: ").append(toIndentedString($specialPropertyName)).append("\n");
|
||||
sb.append("}");
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
@@ -1,107 +0,0 @@
|
||||
package io.swagger;
|
||||
|
||||
import java.io.*;
|
||||
import java.util.*;
|
||||
|
||||
import io.swagger.client.*;
|
||||
import io.swagger.client.api.*;
|
||||
import io.swagger.client.model.*;
|
||||
import org.springframework.web.client.HttpClientErrorException;
|
||||
|
||||
public class PetstoreProfiling {
|
||||
public int total = 5;
|
||||
public Long newPetId = 50003L;
|
||||
public String outputFile = "./petstore_profiling.output";
|
||||
|
||||
public void callApis(int index, List<Map<String, String>> results) {
|
||||
long start;
|
||||
|
||||
try {
|
||||
PetApi petApi = new PetApi();
|
||||
|
||||
/* ADD PET */
|
||||
Pet pet = new Pet();
|
||||
pet.setId(newPetId);
|
||||
pet.setName("profiler");
|
||||
pet.setStatus(Pet.StatusEnum.AVAILABLE);
|
||||
pet.setPhotoUrls(Arrays.asList("http://profiler.com"));
|
||||
// new tag
|
||||
Tag tag = new Tag();
|
||||
tag.setId(newPetId); // use the same id as pet
|
||||
tag.setName("profile tag 1");
|
||||
// new category
|
||||
Category category = new Category();
|
||||
category.setId(newPetId); // use the same id as pet
|
||||
category.setName("profile category 1");
|
||||
|
||||
pet.setTags(Arrays.asList(tag));
|
||||
pet.setCategory(category);
|
||||
|
||||
/* ADD PET */
|
||||
start = System.nanoTime();
|
||||
petApi.addPet(pet);
|
||||
results.add(buildResult(index, "ADD PET", System.nanoTime() - start));
|
||||
|
||||
/* GET PET */
|
||||
start = System.nanoTime();
|
||||
pet = petApi.getPetById(newPetId);
|
||||
results.add(buildResult(index, "GET PET", System.nanoTime() - start));
|
||||
|
||||
/* UPDATE PET WITH FORM */
|
||||
start = System.nanoTime();
|
||||
petApi.updatePetWithForm(newPetId, "new profiler", "sold");
|
||||
results.add(buildResult(index, "UPDATE PET", System.nanoTime() - start));
|
||||
|
||||
/* DELETE PET */
|
||||
start = System.nanoTime();
|
||||
petApi.deletePet(newPetId, "special-key");
|
||||
results.add(buildResult(index, "DELETE PET", System.nanoTime() - start));
|
||||
} catch (HttpClientErrorException e) {
|
||||
System.out.println("Caught error: " + e.getMessage());
|
||||
System.out.println("HTTP response headers: " + e.getResponseHeaders());
|
||||
System.out.println("HTTP response body: " + e.getResponseBodyAsString());
|
||||
System.out.println("HTTP status code: " + e.getStatusCode());
|
||||
}
|
||||
}
|
||||
|
||||
public void run() {
|
||||
System.out.printf("Running profiling... (total: %s)\n", total);
|
||||
|
||||
List<Map<String, String>> results = new ArrayList<Map<String, String>>();
|
||||
for (int i = 0; i < total; i++) {
|
||||
callApis(i, results);
|
||||
}
|
||||
writeResultsToFile(results);
|
||||
|
||||
System.out.printf("Profiling results written to %s\n", outputFile);
|
||||
}
|
||||
|
||||
private Map<String, String> buildResult(int index, String name, long time) {
|
||||
Map<String, String> result = new HashMap<String, String>();
|
||||
result.put("index", String.valueOf(index));
|
||||
result.put("name", name);
|
||||
result.put("time", String.valueOf(time / 1000000000.0));
|
||||
return result;
|
||||
}
|
||||
|
||||
private void writeResultsToFile(List<Map<String, String>> results) {
|
||||
try {
|
||||
File file = new File(outputFile);
|
||||
PrintWriter writer = new PrintWriter(file);
|
||||
String command = "mvn compile test-compile exec:java -Dexec.classpathScope=test -Dexec.mainClass=\"io.swagger.PetstoreProfiling\"";
|
||||
writer.println("# To run the profiling:");
|
||||
writer.printf("# %s\n\n", command);
|
||||
for (Map<String, String> result : results) {
|
||||
writer.printf("%s: %s => %s\n", result.get("index"), result.get("name"), result.get("time"));
|
||||
}
|
||||
writer.close();
|
||||
} catch (FileNotFoundException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
final PetstoreProfiling profiling = new PetstoreProfiling();
|
||||
profiling.run();
|
||||
}
|
||||
}
|
||||
@@ -1,17 +0,0 @@
|
||||
package io.swagger;
|
||||
|
||||
import java.util.Random;
|
||||
import java.util.concurrent.atomic.AtomicLong;
|
||||
|
||||
public class TestUtils {
|
||||
private static final AtomicLong atomicId = createAtomicId();
|
||||
|
||||
public static long nextId() {
|
||||
return atomicId.getAndIncrement();
|
||||
}
|
||||
|
||||
private static AtomicLong createAtomicId() {
|
||||
int baseId = new Random(System.currentTimeMillis()).nextInt(1000000) + 20000;
|
||||
return new AtomicLong((long) baseId);
|
||||
}
|
||||
}
|
||||
@@ -1,254 +0,0 @@
|
||||
package io.swagger.client;
|
||||
|
||||
import io.swagger.client.auth.*;
|
||||
|
||||
import java.text.DateFormat;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.*;
|
||||
|
||||
import org.junit.*;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.util.MultiValueMap;
|
||||
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
|
||||
public class ApiClientTest {
|
||||
ApiClient apiClient = null;
|
||||
|
||||
@Before
|
||||
public void setup() {
|
||||
apiClient = new ApiClient();
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
@Test
|
||||
public void testParseAndFormatDate() {
|
||||
// default date format
|
||||
String dateStr = "2015-11-07T03:49:09.356Z";
|
||||
assertEquals(dateStr, apiClient.formatDate(apiClient.parseDate("2015-11-07T03:49:09.356+00:00")));
|
||||
assertEquals(dateStr, apiClient.formatDate(apiClient.parseDate("2015-11-07T03:49:09.356Z")));
|
||||
assertEquals(dateStr, apiClient.formatDate(apiClient.parseDate("2015-11-07T05:49:09.356+02:00")));
|
||||
assertEquals(dateStr, apiClient.formatDate(apiClient.parseDate("2015-11-07T02:49:09.356-01:00")));
|
||||
|
||||
// custom date format: without milli-seconds, custom time zone
|
||||
DateFormat format = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssXXX");
|
||||
format.setTimeZone(TimeZone.getTimeZone("GMT+10"));
|
||||
apiClient.setDateFormat(format);
|
||||
dateStr = "2015-11-07T13:49:09+10:00";
|
||||
assertEquals(dateStr, apiClient.formatDate(apiClient.parseDate("2015-11-07T03:49:09+00:00")));
|
||||
assertEquals(dateStr, apiClient.formatDate(apiClient.parseDate("2015-11-07T03:49:09Z")));
|
||||
assertEquals(dateStr, apiClient.formatDate(apiClient.parseDate("2015-11-07T00:49:09-03:00")));
|
||||
assertEquals(dateStr, apiClient.formatDate(apiClient.parseDate("2015-11-07T13:49:09+10:00")));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testIsJsonMime() {
|
||||
assertFalse(apiClient.isJsonMime((String) null));
|
||||
assertFalse(apiClient.isJsonMime(""));
|
||||
assertFalse(apiClient.isJsonMime("text/plain"));
|
||||
assertFalse(apiClient.isJsonMime("application/xml"));
|
||||
assertFalse(apiClient.isJsonMime("application/jsonp"));
|
||||
assertFalse(apiClient.isJsonMime("example/json"));
|
||||
assertFalse(apiClient.isJsonMime("example/foo+bar+jsonx"));
|
||||
assertFalse(apiClient.isJsonMime("example/foo+bar+xjson"));
|
||||
|
||||
assertTrue(apiClient.isJsonMime("application/json"));
|
||||
assertTrue(apiClient.isJsonMime("application/json; charset=UTF8"));
|
||||
assertTrue(apiClient.isJsonMime("APPLICATION/JSON"));
|
||||
|
||||
assertTrue(apiClient.isJsonMime("application/problem+json"));
|
||||
assertTrue(apiClient.isJsonMime("APPLICATION/PROBLEM+JSON"));
|
||||
assertTrue(apiClient.isJsonMime("application/json\t"));
|
||||
assertTrue(apiClient.isJsonMime("example/foo+bar+json"));
|
||||
assertTrue(apiClient.isJsonMime("example/foo+json;x;y"));
|
||||
assertTrue(apiClient.isJsonMime("example/foo+json\t;"));
|
||||
assertTrue(apiClient.isJsonMime("Example/fOO+JSON"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSelectHeaderAccept() {
|
||||
String[] accepts = {"application/json", "application/xml"};
|
||||
assertEquals(Arrays.asList(MediaType.parseMediaType("application/json")), apiClient.selectHeaderAccept(accepts));
|
||||
|
||||
accepts = new String[]{"APPLICATION/XML", "APPLICATION/JSON"};
|
||||
assertEquals(Arrays.asList(MediaType.parseMediaType("APPLICATION/JSON")), apiClient.selectHeaderAccept(accepts));
|
||||
|
||||
accepts = new String[]{"application/xml", "application/json; charset=UTF8"};
|
||||
assertEquals(Arrays.asList(MediaType.parseMediaType("application/json; charset=UTF8")), apiClient.selectHeaderAccept(accepts));
|
||||
|
||||
accepts = new String[]{"text/plain", "application/xml"};
|
||||
assertEquals(Arrays.asList(MediaType.parseMediaType("text/plain"),MediaType.parseMediaType("application/xml")), apiClient.selectHeaderAccept(accepts));
|
||||
|
||||
accepts = new String[]{};
|
||||
assertNull(apiClient.selectHeaderAccept(accepts));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSelectHeaderContentType() {
|
||||
String[] contentTypes = {"application/json", "application/xml"};
|
||||
assertEquals(MediaType.parseMediaType("application/json"), apiClient.selectHeaderContentType(contentTypes));
|
||||
|
||||
contentTypes = new String[]{"APPLICATION/JSON", "APPLICATION/XML"};
|
||||
assertEquals(MediaType.parseMediaType("APPLICATION/JSON"), apiClient.selectHeaderContentType(contentTypes));
|
||||
|
||||
contentTypes = new String[]{"application/xml", "application/json; charset=UTF8"};
|
||||
assertEquals(MediaType.parseMediaType("application/json; charset=UTF8"), apiClient.selectHeaderContentType(contentTypes));
|
||||
|
||||
contentTypes = new String[]{"text/plain", "application/xml"};
|
||||
assertEquals(MediaType.parseMediaType("text/plain"), apiClient.selectHeaderContentType(contentTypes));
|
||||
|
||||
contentTypes = new String[]{};
|
||||
assertEquals(MediaType.parseMediaType("application/json"), apiClient.selectHeaderContentType(contentTypes));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testGetAuthentications() {
|
||||
Map<String, Authentication> auths = apiClient.getAuthentications();
|
||||
|
||||
Authentication auth = auths.get("api_key");
|
||||
assertNotNull(auth);
|
||||
assertTrue(auth instanceof ApiKeyAuth);
|
||||
ApiKeyAuth apiKeyAuth = (ApiKeyAuth) auth;
|
||||
assertEquals("header", apiKeyAuth.getLocation());
|
||||
assertEquals("api_key", apiKeyAuth.getParamName());
|
||||
|
||||
auth = auths.get("petstore_auth");
|
||||
assertTrue(auth instanceof OAuth);
|
||||
assertSame(auth, apiClient.getAuthentication("petstore_auth"));
|
||||
|
||||
assertNull(auths.get("unknown"));
|
||||
|
||||
try {
|
||||
auths.put("my_auth", new HttpBasicAuth());
|
||||
fail("the authentications returned should not be modifiable");
|
||||
} catch (UnsupportedOperationException e) {
|
||||
}
|
||||
}
|
||||
|
||||
@Ignore("There is no more basic auth in petstore security definitions")
|
||||
@Test
|
||||
public void testSetUsernameAndPassword() {
|
||||
HttpBasicAuth auth = null;
|
||||
for (Authentication _auth : apiClient.getAuthentications().values()) {
|
||||
if (_auth instanceof HttpBasicAuth) {
|
||||
auth = (HttpBasicAuth) _auth;
|
||||
break;
|
||||
}
|
||||
}
|
||||
auth.setUsername(null);
|
||||
auth.setPassword(null);
|
||||
|
||||
apiClient.setUsername("my-username");
|
||||
apiClient.setPassword("my-password");
|
||||
assertEquals("my-username", auth.getUsername());
|
||||
assertEquals("my-password", auth.getPassword());
|
||||
|
||||
// reset values
|
||||
auth.setUsername(null);
|
||||
auth.setPassword(null);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSetApiKeyAndPrefix() {
|
||||
ApiKeyAuth auth = null;
|
||||
for (Authentication _auth : apiClient.getAuthentications().values()) {
|
||||
if (_auth instanceof ApiKeyAuth) {
|
||||
auth = (ApiKeyAuth) _auth;
|
||||
break;
|
||||
}
|
||||
}
|
||||
auth.setApiKey(null);
|
||||
auth.setApiKeyPrefix(null);
|
||||
|
||||
apiClient.setApiKey("my-api-key");
|
||||
apiClient.setApiKeyPrefix("Token");
|
||||
assertEquals("my-api-key", auth.getApiKey());
|
||||
assertEquals("Token", auth.getApiKeyPrefix());
|
||||
|
||||
// reset values
|
||||
auth.setApiKey(null);
|
||||
auth.setApiKeyPrefix(null);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testParameterToMultiValueMapWhenNameIsInvalid() throws Exception {
|
||||
MultiValueMap<String, String> pairs_a = apiClient.parameterToMultiValueMap(ApiClient.CollectionFormat.CSV, null, new Integer(1));
|
||||
MultiValueMap<String, String> pairs_b = apiClient.parameterToMultiValueMap(ApiClient.CollectionFormat.CSV, "", new Integer(1));
|
||||
|
||||
assertTrue(pairs_a.isEmpty());
|
||||
assertTrue(pairs_b.isEmpty());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testParameterToMultiValueMapWhenValueIsNull() throws Exception {
|
||||
MultiValueMap<String, String> pairs = apiClient.parameterToMultiValueMap(ApiClient.CollectionFormat.CSV, "param-a", null);
|
||||
|
||||
assertTrue(pairs.isEmpty());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testParameterToMultiValueMapWhenValueIsEmptyStrings() throws Exception {
|
||||
|
||||
// single empty string
|
||||
MultiValueMap<String, String> pairs = apiClient.parameterToMultiValueMap(ApiClient.CollectionFormat.CSV, "param-a", " ");
|
||||
assertEquals(1, pairs.size());
|
||||
|
||||
// list of empty strings
|
||||
List<String> strs = new ArrayList<String>();
|
||||
strs.add(" ");
|
||||
strs.add(" ");
|
||||
strs.add(" ");
|
||||
|
||||
MultiValueMap<String, String> concatStrings = apiClient.parameterToMultiValueMap(ApiClient.CollectionFormat.CSV, "param-a", strs);
|
||||
|
||||
assertEquals(1, concatStrings.get("param-a").size());
|
||||
assertFalse(concatStrings.get("param-a").isEmpty()); // should contain some delimiters
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testParameterToMultiValueMapWhenValueIsNotCollection() throws Exception {
|
||||
String name = "param-a";
|
||||
Integer value = 1;
|
||||
|
||||
MultiValueMap<String, String> pairs = apiClient.parameterToMultiValueMap(ApiClient.CollectionFormat.CSV, name, value);
|
||||
|
||||
assertEquals(1, pairs.get(name).size());
|
||||
assertEquals(value, Integer.valueOf(pairs.get(name).get(0)));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testParameterToMultiValueMapWhenValueIsCollection() throws Exception {
|
||||
Map<ApiClient.CollectionFormat, String> collectionFormatMap = new HashMap<ApiClient.CollectionFormat, String>();
|
||||
collectionFormatMap.put(ApiClient.CollectionFormat.CSV, ",");
|
||||
collectionFormatMap.put(ApiClient.CollectionFormat.TSV, "\t");
|
||||
collectionFormatMap.put(ApiClient.CollectionFormat.SSV, " ");
|
||||
collectionFormatMap.put(ApiClient.CollectionFormat.PIPES, "\\|");
|
||||
collectionFormatMap.put(null, ","); // no format, must default to csv
|
||||
|
||||
String name = "param-a";
|
||||
|
||||
List<Object> values = new ArrayList<Object>();
|
||||
values.add("value-a");
|
||||
values.add(123);
|
||||
values.add(new Date());
|
||||
|
||||
// check for multi separately
|
||||
MultiValueMap<String, String> multiValueMap = apiClient.parameterToMultiValueMap(ApiClient.CollectionFormat.MULTI, name, values);
|
||||
assertEquals(values.size(), multiValueMap.get(name).size());
|
||||
|
||||
// all other formats
|
||||
for (ApiClient.CollectionFormat collectionFormat : collectionFormatMap.keySet()) {
|
||||
MultiValueMap<String, String> pairs = apiClient.parameterToMultiValueMap(collectionFormat, name, values);
|
||||
|
||||
assertEquals(1, pairs.size());
|
||||
|
||||
String delimiter = collectionFormatMap.get(collectionFormat);
|
||||
String[] pairValueSplit = pairs.get(name).get(0).split(delimiter);
|
||||
|
||||
assertEquals(values.size(), pairValueSplit.length);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -41,8 +41,8 @@ public class AnotherFakeApiTest {
|
||||
*/
|
||||
@Test
|
||||
public void testSpecialTagsTest() {
|
||||
Client body = null;
|
||||
Client response = api.testSpecialTags(body);
|
||||
Client client = null;
|
||||
Client response = api.testSpecialTags(client);
|
||||
|
||||
// TODO: test validations
|
||||
}
|
||||
|
||||
@@ -15,9 +15,11 @@ package io.swagger.client.api;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import io.swagger.client.model.Client;
|
||||
import java.io.File;
|
||||
import org.threeten.bp.LocalDate;
|
||||
import org.threeten.bp.OffsetDateTime;
|
||||
import io.swagger.client.model.OuterComposite;
|
||||
import io.swagger.client.model.User;
|
||||
import org.junit.Test;
|
||||
import org.junit.Ignore;
|
||||
|
||||
@@ -45,8 +47,8 @@ public class FakeApiTest {
|
||||
*/
|
||||
@Test
|
||||
public void fakeOuterBooleanSerializeTest() {
|
||||
Boolean body = null;
|
||||
Boolean response = api.fakeOuterBooleanSerialize(body);
|
||||
Boolean booleanPostBody = null;
|
||||
Boolean response = api.fakeOuterBooleanSerialize(booleanPostBody);
|
||||
|
||||
// TODO: test validations
|
||||
}
|
||||
@@ -61,8 +63,8 @@ public class FakeApiTest {
|
||||
*/
|
||||
@Test
|
||||
public void fakeOuterCompositeSerializeTest() {
|
||||
OuterComposite body = null;
|
||||
OuterComposite response = api.fakeOuterCompositeSerialize(body);
|
||||
OuterComposite outerComposite = null;
|
||||
OuterComposite response = api.fakeOuterCompositeSerialize(outerComposite);
|
||||
|
||||
// TODO: test validations
|
||||
}
|
||||
@@ -99,6 +101,23 @@ public class FakeApiTest {
|
||||
// TODO: test validations
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
* @throws ApiException
|
||||
* if the Api call fails
|
||||
*/
|
||||
@Test
|
||||
public void testBodyWithQueryParamsTest() {
|
||||
String query = null;
|
||||
User user = null;
|
||||
api.testBodyWithQueryParams(query, user);
|
||||
|
||||
// TODO: test validations
|
||||
}
|
||||
|
||||
/**
|
||||
* To test \"client\" model
|
||||
*
|
||||
@@ -109,8 +128,8 @@ public class FakeApiTest {
|
||||
*/
|
||||
@Test
|
||||
public void testClientModelTest() {
|
||||
Client body = null;
|
||||
Client response = api.testClientModel(body);
|
||||
Client client = null;
|
||||
Client response = api.testClientModel(client);
|
||||
|
||||
// TODO: test validations
|
||||
}
|
||||
@@ -134,7 +153,7 @@ public class FakeApiTest {
|
||||
Long int64 = null;
|
||||
Float _float = null;
|
||||
String string = null;
|
||||
byte[] binary = null;
|
||||
File binary = null;
|
||||
LocalDate date = null;
|
||||
OffsetDateTime dateTime = null;
|
||||
String password = null;
|
||||
@@ -154,15 +173,31 @@ public class FakeApiTest {
|
||||
*/
|
||||
@Test
|
||||
public void testEnumParametersTest() {
|
||||
List<String> enumFormStringArray = null;
|
||||
String enumFormString = null;
|
||||
List<String> enumHeaderStringArray = null;
|
||||
String enumHeaderString = null;
|
||||
List<String> enumQueryStringArray = null;
|
||||
String enumQueryString = null;
|
||||
Integer enumQueryInteger = null;
|
||||
Double enumQueryDouble = null;
|
||||
api.testEnumParameters(enumFormStringArray, enumFormString, enumHeaderStringArray, enumHeaderString, enumQueryStringArray, enumQueryString, enumQueryInteger, enumQueryDouble);
|
||||
List<String> enumFormStringArray = null;
|
||||
String enumFormString = null;
|
||||
api.testEnumParameters(enumHeaderStringArray, enumHeaderString, enumQueryStringArray, enumQueryString, enumQueryInteger, enumQueryDouble, enumFormStringArray, enumFormString);
|
||||
|
||||
// TODO: test validations
|
||||
}
|
||||
|
||||
/**
|
||||
* test inline additionalProperties
|
||||
*
|
||||
*
|
||||
*
|
||||
* @throws ApiException
|
||||
* if the Api call fails
|
||||
*/
|
||||
@Test
|
||||
public void testInlineAdditionalPropertiesTest() {
|
||||
String requestBody = null;
|
||||
api.testInlineAdditionalProperties(requestBody);
|
||||
|
||||
// TODO: test validations
|
||||
}
|
||||
|
||||
@@ -34,15 +34,15 @@ public class FakeClassnameTags123ApiTest {
|
||||
/**
|
||||
* To test class name in snake case
|
||||
*
|
||||
*
|
||||
* To test class name in snake case
|
||||
*
|
||||
* @throws ApiException
|
||||
* if the Api call fails
|
||||
*/
|
||||
@Test
|
||||
public void testClassnameTest() {
|
||||
Client body = null;
|
||||
Client response = api.testClassname(body);
|
||||
Client client = null;
|
||||
Client response = api.testClassname(client);
|
||||
|
||||
// TODO: test validations
|
||||
}
|
||||
|
||||
@@ -1,317 +1,169 @@
|
||||
/*
|
||||
* Swagger 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
|
||||
* Contact: apiteam@swagger.io
|
||||
*
|
||||
* NOTE: This class is auto generated by the swagger code generator program.
|
||||
* https://github.com/swagger-api/swagger-codegen.git
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
|
||||
|
||||
package io.swagger.client.api;
|
||||
|
||||
import com.fasterxml.jackson.annotation.*;
|
||||
import com.fasterxml.jackson.databind.*;
|
||||
|
||||
import com.fasterxml.jackson.datatype.threetenbp.ThreeTenModule;
|
||||
import io.swagger.TestUtils;
|
||||
|
||||
import io.swagger.client.*;
|
||||
import io.swagger.client.api.*;
|
||||
import io.swagger.client.auth.*;
|
||||
import io.swagger.client.model.*;
|
||||
|
||||
import java.io.BufferedWriter;
|
||||
import java.io.File;
|
||||
import java.io.FileWriter;
|
||||
import io.swagger.client.model.ModelApiResponse;
|
||||
import io.swagger.client.model.Pet;
|
||||
import org.junit.Test;
|
||||
import org.junit.Ignore;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.junit.*;
|
||||
import org.springframework.web.client.HttpClientErrorException;
|
||||
import org.springframework.web.client.RestClientException;
|
||||
import org.threeten.bp.Instant;
|
||||
import org.threeten.bp.OffsetDateTime;
|
||||
import org.threeten.bp.ZonedDateTime;
|
||||
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
/**
|
||||
* API tests for PetApi
|
||||
*/
|
||||
@Ignore
|
||||
public class PetApiTest {
|
||||
private PetApi api;
|
||||
private ObjectMapper mapper;
|
||||
|
||||
@Before
|
||||
public void setup() {
|
||||
api = new PetApi();
|
||||
// setup authentication
|
||||
ApiKeyAuth apiKeyAuth = (ApiKeyAuth) api.getApiClient().getAuthentication("api_key");
|
||||
apiKeyAuth.setApiKey("special-key");
|
||||
}
|
||||
private final PetApi api = new PetApi();
|
||||
|
||||
|
||||
/**
|
||||
* Add a new pet to the store
|
||||
*
|
||||
*
|
||||
*
|
||||
* @throws ApiException
|
||||
* if the Api call fails
|
||||
*/
|
||||
@Test
|
||||
public void testApiClient() {
|
||||
// the default api client is used
|
||||
assertNotNull(api.getApiClient());
|
||||
assertEquals("http://petstore.swagger.io:80/v2", api.getApiClient().getBasePath());
|
||||
assertFalse(api.getApiClient().isDebugging());
|
||||
|
||||
ApiClient oldClient = api.getApiClient();
|
||||
|
||||
ApiClient newClient = new ApiClient();
|
||||
newClient.setBasePath("http://example.com");
|
||||
newClient.setDebugging(true);
|
||||
|
||||
// set api client via constructor
|
||||
api = new PetApi(newClient);
|
||||
assertNotNull(api.getApiClient());
|
||||
assertEquals("http://example.com", api.getApiClient().getBasePath());
|
||||
assertTrue(api.getApiClient().isDebugging());
|
||||
|
||||
// set api client via setter method
|
||||
api.setApiClient(oldClient);
|
||||
assertNotNull(api.getApiClient());
|
||||
assertEquals("http://petstore.swagger.io:80/v2", api.getApiClient().getBasePath());
|
||||
assertFalse(api.getApiClient().isDebugging());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testCreateAndGetPet() throws Exception {
|
||||
Pet pet = createRandomPet();
|
||||
public void addPetTest() {
|
||||
Pet pet = null;
|
||||
api.addPet(pet);
|
||||
|
||||
Pet fetched = api.getPetById(pet.getId());
|
||||
assertNotNull(fetched);
|
||||
assertEquals(pet.getId(), fetched.getId());
|
||||
assertNotNull(fetched.getCategory());
|
||||
assertEquals(fetched.getCategory().getName(), pet.getCategory().getName());
|
||||
// TODO: test validations
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
/**
|
||||
* Deletes a pet
|
||||
*
|
||||
*
|
||||
*
|
||||
* @throws ApiException
|
||||
* if the Api call fails
|
||||
*/
|
||||
@Test
|
||||
public void testCreateAndGetPetWithByteArray() throws Exception {
|
||||
Pet pet = createRandomPet();
|
||||
byte[] bytes = serializeJson(pet).getBytes();
|
||||
api.addPetUsingByteArray(bytes);
|
||||
public void deletePetTest() {
|
||||
Long petId = null;
|
||||
String apiKey = null;
|
||||
api.deletePet(petId, apiKey);
|
||||
|
||||
byte[] fetchedBytes = api.petPetIdtestingByteArraytrueGet(pet.getId());
|
||||
Pet fetched = deserializeJson(new String(fetchedBytes), Pet.class);
|
||||
assertNotNull(fetched);
|
||||
assertEquals(pet.getId(), fetched.getId());
|
||||
assertNotNull(fetched.getCategory());
|
||||
assertEquals(fetched.getCategory().getName(), pet.getCategory().getName());
|
||||
// TODO: test validations
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Finds Pets by status
|
||||
*
|
||||
* Multiple status values can be provided with comma separated strings
|
||||
*
|
||||
* @throws ApiException
|
||||
* if the Api call fails
|
||||
*/
|
||||
@Test
|
||||
public void testGetPetByIdInObject() throws Exception {
|
||||
Pet pet = new Pet();
|
||||
pet.setId(TestUtils.nextId());
|
||||
pet.setName("pet " + pet.getId());
|
||||
public void findPetsByStatusTest() {
|
||||
List<String> status = null;
|
||||
List<Pet> response = api.findPetsByStatus(status);
|
||||
|
||||
Category category = new Category();
|
||||
category.setId(TestUtils.nextId());
|
||||
category.setName("category " + category.getId());
|
||||
pet.setCategory(category);
|
||||
|
||||
pet.setStatus(Pet.StatusEnum.PENDING);
|
||||
List<String> photos = Arrays.asList(new String[]{"http://foo.bar.com/1"});
|
||||
pet.setPhotoUrls(photos);
|
||||
|
||||
api.addPet(pet);
|
||||
|
||||
InlineResponse200 fetched = api.getPetByIdInObject(pet.getId());
|
||||
assertEquals(pet.getId(), fetched.getId());
|
||||
assertEquals(pet.getName(), fetched.getName());
|
||||
|
||||
Object categoryObj = fetched.getCategory();
|
||||
assertNotNull(categoryObj);
|
||||
assertTrue(categoryObj instanceof Map);
|
||||
|
||||
Map categoryMap = (Map) categoryObj;
|
||||
Object categoryIdObj = categoryMap.get("id");
|
||||
assertTrue(categoryIdObj instanceof Integer);
|
||||
Integer categoryIdInt = (Integer) categoryIdObj;
|
||||
assertEquals(category.getId(), Long.valueOf(categoryIdInt));
|
||||
assertEquals(category.getName(), categoryMap.get("name"));
|
||||
// TODO: test validations
|
||||
}
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* Finds Pets by tags
|
||||
*
|
||||
* Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
|
||||
*
|
||||
* @throws ApiException
|
||||
* if the Api call fails
|
||||
*/
|
||||
@Test
|
||||
public void testUpdatePet() throws Exception {
|
||||
Pet pet = createRandomPet();
|
||||
pet.setName("programmer");
|
||||
public void findPetsByTagsTest() {
|
||||
List<String> tags = null;
|
||||
List<Pet> response = api.findPetsByTags(tags);
|
||||
|
||||
// TODO: test validations
|
||||
}
|
||||
|
||||
/**
|
||||
* Find pet by ID
|
||||
*
|
||||
* Returns a single pet
|
||||
*
|
||||
* @throws ApiException
|
||||
* if the Api call fails
|
||||
*/
|
||||
@Test
|
||||
public void getPetByIdTest() {
|
||||
Long petId = null;
|
||||
Pet response = api.getPetById(petId);
|
||||
|
||||
// TODO: test validations
|
||||
}
|
||||
|
||||
/**
|
||||
* Update an existing pet
|
||||
*
|
||||
*
|
||||
*
|
||||
* @throws ApiException
|
||||
* if the Api call fails
|
||||
*/
|
||||
@Test
|
||||
public void updatePetTest() {
|
||||
Pet pet = null;
|
||||
api.updatePet(pet);
|
||||
|
||||
Pet fetched = api.getPetById(pet.getId());
|
||||
assertNotNull(fetched);
|
||||
assertEquals(pet.getId(), fetched.getId());
|
||||
assertNotNull(fetched.getCategory());
|
||||
assertEquals(fetched.getCategory().getName(), pet.getCategory().getName());
|
||||
// TODO: test validations
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Updates a pet in the store with form data
|
||||
*
|
||||
*
|
||||
*
|
||||
* @throws ApiException
|
||||
* if the Api call fails
|
||||
*/
|
||||
@Test
|
||||
public void testFindPetsByStatus() throws Exception {
|
||||
Pet pet = createRandomPet();
|
||||
pet.setName("programmer");
|
||||
pet.setStatus(Pet.StatusEnum.AVAILABLE);
|
||||
public void updatePetWithFormTest() {
|
||||
Long petId = null;
|
||||
String name = null;
|
||||
String status = null;
|
||||
api.updatePetWithForm(petId, name, status);
|
||||
|
||||
api.updatePet(pet);
|
||||
|
||||
List<Pet> pets = api.findPetsByStatus(Arrays.asList(new String[]{"available"}));
|
||||
assertNotNull(pets);
|
||||
|
||||
boolean found = false;
|
||||
for (Pet fetched : pets) {
|
||||
if (fetched.getId().equals(pet.getId())) {
|
||||
found = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
assertTrue(found);
|
||||
// TODO: test validations
|
||||
}
|
||||
|
||||
// this API is deprecated
|
||||
// @Test
|
||||
// public void testFindPetsByTags() throws Exception {
|
||||
// Pet pet = createRandomPet();
|
||||
// pet.setName("monster");
|
||||
// pet.setStatus(Pet.StatusEnum.AVAILABLE);
|
||||
//
|
||||
// List<Tag> tags = new ArrayList<Tag>();
|
||||
// Tag tag1 = new Tag();
|
||||
// tag1.setName("friendly");
|
||||
// tags.add(tag1);
|
||||
// pet.setTags(tags);
|
||||
//
|
||||
// api.updatePet(pet);
|
||||
//
|
||||
// List<Pet> pets = api.findPetsByTags(Arrays.asList(new String[]{"friendly"}));
|
||||
// assertNotNull(pets);
|
||||
//
|
||||
// boolean found = false;
|
||||
// for (Pet fetched : pets) {
|
||||
// if (fetched.getId().equals(pet.getId())) {
|
||||
// found = true;
|
||||
// break;
|
||||
// }
|
||||
// }
|
||||
// assertTrue(found);
|
||||
// }
|
||||
|
||||
|
||||
/**
|
||||
* uploads an image
|
||||
*
|
||||
*
|
||||
*
|
||||
* @throws ApiException
|
||||
* if the Api call fails
|
||||
*/
|
||||
@Test
|
||||
public void testUpdatePetWithForm() throws Exception {
|
||||
Pet pet = createRandomPet();
|
||||
pet.setName("frank");
|
||||
api.addPet(pet);
|
||||
public void uploadFileTest() {
|
||||
Long petId = null;
|
||||
String additionalMetadata = null;
|
||||
File file = null;
|
||||
ModelApiResponse response = api.uploadFile(petId, additionalMetadata, file);
|
||||
|
||||
Pet fetched = api.getPetById(pet.getId());
|
||||
|
||||
api.updatePetWithForm(fetched.getId(), "furt", null);
|
||||
Pet updated = api.getPetById(fetched.getId());
|
||||
|
||||
assertEquals(updated.getName(), "furt");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testDeletePet() throws Exception {
|
||||
Pet pet = createRandomPet();
|
||||
api.addPet(pet);
|
||||
|
||||
Pet fetched = api.getPetById(pet.getId());
|
||||
api.deletePet(fetched.getId(), null);
|
||||
|
||||
try {
|
||||
fetched = api.getPetById(fetched.getId());
|
||||
fail("expected an error");
|
||||
} catch (RestClientException e) {
|
||||
assertTrue(e instanceof HttpClientErrorException);
|
||||
assertEquals(404, ((HttpClientErrorException) e).getStatusCode().value());
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testUploadFile() throws Exception {
|
||||
Pet pet = createRandomPet();
|
||||
api.addPet(pet);
|
||||
|
||||
File file = new File("hello.txt");
|
||||
BufferedWriter writer = new BufferedWriter(new FileWriter(file));
|
||||
writer.write("Hello world!");
|
||||
writer.close();
|
||||
|
||||
api.uploadFile(pet.getId(), "a test file", new File(file.getAbsolutePath()));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testEqualsAndHashCode() {
|
||||
Pet pet1 = new Pet();
|
||||
Pet pet2 = new Pet();
|
||||
assertTrue(pet1.equals(pet2));
|
||||
assertTrue(pet2.equals(pet1));
|
||||
assertTrue(pet1.hashCode() == pet2.hashCode());
|
||||
assertTrue(pet1.equals(pet1));
|
||||
assertTrue(pet1.hashCode() == pet1.hashCode());
|
||||
|
||||
pet2.setName("really-happy");
|
||||
pet2.setPhotoUrls(Arrays.asList(new String[]{"http://foo.bar.com/1", "http://foo.bar.com/2"}));
|
||||
assertFalse(pet1.equals(pet2));
|
||||
assertFalse(pet2.equals(pet1));
|
||||
assertFalse(pet1.hashCode() == (pet2.hashCode()));
|
||||
assertTrue(pet2.equals(pet2));
|
||||
assertTrue(pet2.hashCode() == pet2.hashCode());
|
||||
|
||||
pet1.setName("really-happy");
|
||||
pet1.setPhotoUrls(Arrays.asList(new String[]{"http://foo.bar.com/1", "http://foo.bar.com/2"}));
|
||||
assertTrue(pet1.equals(pet2));
|
||||
assertTrue(pet2.equals(pet1));
|
||||
assertTrue(pet1.hashCode() == pet2.hashCode());
|
||||
assertTrue(pet1.equals(pet1));
|
||||
assertTrue(pet1.hashCode() == pet1.hashCode());
|
||||
}
|
||||
|
||||
private Pet createRandomPet() {
|
||||
Pet pet = new Pet();
|
||||
pet.setId(TestUtils.nextId());
|
||||
pet.setName("gorilla");
|
||||
|
||||
Category category = new Category();
|
||||
category.setName("really-happy");
|
||||
|
||||
pet.setCategory(category);
|
||||
pet.setStatus(Pet.StatusEnum.AVAILABLE);
|
||||
List<String> photos = Arrays.asList(new String[]{"http://foo.bar.com/1", "http://foo.bar.com/2"});
|
||||
pet.setPhotoUrls(photos);
|
||||
|
||||
return pet;
|
||||
}
|
||||
|
||||
private String serializeJson(Object o) {
|
||||
if (mapper == null) {
|
||||
mapper = createObjectMapper();
|
||||
}
|
||||
try {
|
||||
return mapper.writeValueAsString(o);
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
|
||||
private <T> T deserializeJson(String json, Class<T> klass) {
|
||||
if (mapper == null) {
|
||||
mapper = createObjectMapper();
|
||||
}
|
||||
try {
|
||||
return mapper.readValue(json, klass);
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
|
||||
private ObjectMapper createObjectMapper() {
|
||||
ObjectMapper mapper = new ObjectMapper();
|
||||
mapper.setSerializationInclusion(JsonInclude.Include.NON_NULL);
|
||||
mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
|
||||
mapper.disable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS);
|
||||
mapper.enable(SerializationFeature.WRITE_ENUMS_USING_TO_STRING);
|
||||
mapper.enable(DeserializationFeature.READ_ENUMS_USING_TO_STRING);
|
||||
ThreeTenModule module = new ThreeTenModule();
|
||||
module.addDeserializer(Instant.class, CustomInstantDeserializer.INSTANT);
|
||||
module.addDeserializer(OffsetDateTime.class, CustomInstantDeserializer.OFFSET_DATE_TIME);
|
||||
module.addDeserializer(ZonedDateTime.class, CustomInstantDeserializer.ZONED_DATE_TIME);
|
||||
mapper.registerModule(module);
|
||||
return mapper;
|
||||
// TODO: test validations
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,102 +1,97 @@
|
||||
/*
|
||||
* Swagger 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
|
||||
* Contact: apiteam@swagger.io
|
||||
*
|
||||
* NOTE: This class is auto generated by the swagger code generator program.
|
||||
* https://github.com/swagger-api/swagger-codegen.git
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
|
||||
|
||||
package io.swagger.client.api;
|
||||
|
||||
import io.swagger.TestUtils;
|
||||
import io.swagger.client.model.Order;
|
||||
import org.junit.Test;
|
||||
import org.junit.Ignore;
|
||||
|
||||
import io.swagger.client.*;
|
||||
import io.swagger.client.api.*;
|
||||
import io.swagger.client.auth.*;
|
||||
import io.swagger.client.model.*;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.text.SimpleDateFormat;
|
||||
|
||||
import org.junit.*;
|
||||
import org.springframework.web.client.RestClientException;
|
||||
import org.threeten.bp.OffsetDateTime;
|
||||
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
/**
|
||||
* API tests for StoreApi
|
||||
*/
|
||||
@Ignore
|
||||
public class StoreApiTest {
|
||||
StoreApi api = null;
|
||||
|
||||
@Before
|
||||
public void setup() {
|
||||
api = new StoreApi();
|
||||
// setup authentication
|
||||
ApiKeyAuth apiKeyAuth = (ApiKeyAuth) api.getApiClient().getAuthentication("api_key");
|
||||
apiKeyAuth.setApiKey("special-key");
|
||||
// set custom date format that is used by the petstore server
|
||||
api.getApiClient().setDateFormat(new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSZ"));
|
||||
}
|
||||
private final StoreApi api = new StoreApi();
|
||||
|
||||
|
||||
/**
|
||||
* Delete purchase order by ID
|
||||
*
|
||||
* For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors
|
||||
*
|
||||
* @throws ApiException
|
||||
* if the Api call fails
|
||||
*/
|
||||
@Test
|
||||
public void testGetInventory() throws Exception {
|
||||
Map<String, Integer> inventory = api.getInventory();
|
||||
assertTrue(inventory.keySet().size() > 0);
|
||||
}
|
||||
public void deleteOrderTest() {
|
||||
String orderId = null;
|
||||
api.deleteOrder(orderId);
|
||||
|
||||
/*
|
||||
// TODO: test validations
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns pet inventories by status
|
||||
*
|
||||
* Returns a map of status codes to quantities
|
||||
*
|
||||
* @throws ApiException
|
||||
* if the Api call fails
|
||||
*/
|
||||
@Test
|
||||
public void testGetInventoryInObject() throws Exception {
|
||||
Object inventoryObj = api.getInventoryInObject();
|
||||
assertTrue(inventoryObj instanceof Map);
|
||||
public void getInventoryTest() {
|
||||
Map<String, Integer> response = api.getInventory();
|
||||
|
||||
Map inventoryMap = (Map) inventoryObj;
|
||||
assertTrue(inventoryMap.keySet().size() > 0);
|
||||
|
||||
Map.Entry firstEntry = (Map.Entry) inventoryMap.entrySet().iterator().next();
|
||||
assertTrue(firstEntry.getKey() instanceof String);
|
||||
assertTrue(firstEntry.getValue() instanceof Integer);
|
||||
// TODO: test validations
|
||||
}
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* Find purchase order by ID
|
||||
*
|
||||
* For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions
|
||||
*
|
||||
* @throws ApiException
|
||||
* if the Api call fails
|
||||
*/
|
||||
@Test
|
||||
public void testPlaceOrder() throws Exception {
|
||||
Order order = createOrder();
|
||||
api.placeOrder(order);
|
||||
public void getOrderByIdTest() {
|
||||
Long orderId = null;
|
||||
Order response = api.getOrderById(orderId);
|
||||
|
||||
Order fetched = api.getOrderById(order.getId());
|
||||
assertEquals(order.getId(), fetched.getId());
|
||||
assertEquals(order.getPetId(), fetched.getPetId());
|
||||
assertEquals(order.getQuantity(), fetched.getQuantity());
|
||||
assertTrue(order.getShipDate().isEqual(fetched.getShipDate()));
|
||||
// TODO: test validations
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Place an order for a pet
|
||||
*
|
||||
*
|
||||
*
|
||||
* @throws ApiException
|
||||
* if the Api call fails
|
||||
*/
|
||||
@Test
|
||||
public void testDeleteOrder() throws Exception {
|
||||
Order order = createOrder();
|
||||
api.placeOrder(order);
|
||||
public void placeOrderTest() {
|
||||
Order order = null;
|
||||
Order response = api.placeOrder(order);
|
||||
|
||||
Order fetched = api.getOrderById(order.getId());
|
||||
assertEquals(fetched.getId(), order.getId());
|
||||
|
||||
api.deleteOrder(String.valueOf(order.getId()));
|
||||
|
||||
try {
|
||||
api.getOrderById(order.getId());
|
||||
// fail("expected an error");
|
||||
} catch (RestClientException e) {
|
||||
// ok
|
||||
}
|
||||
}
|
||||
|
||||
private Order createOrder() {
|
||||
Order order = new Order();
|
||||
order.setPetId(new Long(200));
|
||||
order.setQuantity(new Integer(13));
|
||||
order.setShipDate(OffsetDateTime.now().withNano(123000000));
|
||||
order.setStatus(Order.StatusEnum.PLACED);
|
||||
order.setComplete(true);
|
||||
|
||||
try {
|
||||
Field idField = Order.class.getDeclaredField("id");
|
||||
idField.setAccessible(true);
|
||||
idField.set(order, TestUtils.nextId());
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
|
||||
return order;
|
||||
// TODO: test validations
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,88 +1,163 @@
|
||||
/*
|
||||
* Swagger 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
|
||||
* Contact: apiteam@swagger.io
|
||||
*
|
||||
* NOTE: This class is auto generated by the swagger code generator program.
|
||||
* https://github.com/swagger-api/swagger-codegen.git
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
|
||||
|
||||
package io.swagger.client.api;
|
||||
|
||||
import io.swagger.TestUtils;
|
||||
import io.swagger.client.model.User;
|
||||
import org.junit.Test;
|
||||
import org.junit.Ignore;
|
||||
|
||||
import io.swagger.client.api.*;
|
||||
import io.swagger.client.auth.*;
|
||||
import io.swagger.client.model.*;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
import org.junit.*;
|
||||
import static org.junit.Assert.*;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* API tests for UserApi
|
||||
*/
|
||||
@Ignore
|
||||
public class UserApiTest {
|
||||
UserApi api = null;
|
||||
|
||||
@Before
|
||||
public void setup() {
|
||||
api = new UserApi();
|
||||
// setup authentication
|
||||
ApiKeyAuth apiKeyAuth = (ApiKeyAuth) api.getApiClient().getAuthentication("api_key");
|
||||
apiKeyAuth.setApiKey("special-key");
|
||||
}
|
||||
private final UserApi api = new UserApi();
|
||||
|
||||
|
||||
/**
|
||||
* Create user
|
||||
*
|
||||
* This can only be done by the logged in user.
|
||||
*
|
||||
* @throws ApiException
|
||||
* if the Api call fails
|
||||
*/
|
||||
@Test
|
||||
public void testCreateUser() throws Exception {
|
||||
User user = createUser();
|
||||
|
||||
public void createUserTest() {
|
||||
User user = null;
|
||||
api.createUser(user);
|
||||
|
||||
User fetched = api.getUserByName(user.getUsername());
|
||||
assertEquals(user.getId(), fetched.getId());
|
||||
// TODO: test validations
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Creates list of users with given input array
|
||||
*
|
||||
*
|
||||
*
|
||||
* @throws ApiException
|
||||
* if the Api call fails
|
||||
*/
|
||||
@Test
|
||||
public void testCreateUsersWithArray() throws Exception {
|
||||
User user1 = createUser();
|
||||
user1.setUsername("user" + user1.getId());
|
||||
User user2 = createUser();
|
||||
user2.setUsername("user" + user2.getId());
|
||||
public void createUsersWithArrayInputTest() {
|
||||
List<User> user = null;
|
||||
api.createUsersWithArrayInput(user);
|
||||
|
||||
api.createUsersWithArrayInput(Arrays.asList(new User[]{user1, user2}));
|
||||
|
||||
User fetched = api.getUserByName(user1.getUsername());
|
||||
assertEquals(user1.getId(), fetched.getId());
|
||||
// TODO: test validations
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Creates list of users with given input array
|
||||
*
|
||||
*
|
||||
*
|
||||
* @throws ApiException
|
||||
* if the Api call fails
|
||||
*/
|
||||
@Test
|
||||
public void testCreateUsersWithList() throws Exception {
|
||||
User user1 = createUser();
|
||||
user1.setUsername("user" + user1.getId());
|
||||
User user2 = createUser();
|
||||
user2.setUsername("user" + user2.getId());
|
||||
public void createUsersWithListInputTest() {
|
||||
List<User> user = null;
|
||||
api.createUsersWithListInput(user);
|
||||
|
||||
api.createUsersWithListInput(Arrays.asList(new User[]{user1, user2}));
|
||||
|
||||
User fetched = api.getUserByName(user1.getUsername());
|
||||
assertEquals(user1.getId(), fetched.getId());
|
||||
// TODO: test validations
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Delete user
|
||||
*
|
||||
* This can only be done by the logged in user.
|
||||
*
|
||||
* @throws ApiException
|
||||
* if the Api call fails
|
||||
*/
|
||||
@Test
|
||||
public void testLoginUser() throws Exception {
|
||||
User user = createUser();
|
||||
api.createUser(user);
|
||||
public void deleteUserTest() {
|
||||
String username = null;
|
||||
api.deleteUser(username);
|
||||
|
||||
String token = api.loginUser(user.getUsername(), user.getPassword());
|
||||
assertTrue(token.startsWith("logged in user session:"));
|
||||
// TODO: test validations
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get user by user name
|
||||
*
|
||||
*
|
||||
*
|
||||
* @throws ApiException
|
||||
* if the Api call fails
|
||||
*/
|
||||
@Test
|
||||
public void logoutUser() throws Exception {
|
||||
public void getUserByNameTest() {
|
||||
String username = null;
|
||||
User response = api.getUserByName(username);
|
||||
|
||||
// TODO: test validations
|
||||
}
|
||||
|
||||
/**
|
||||
* Logs user into the system
|
||||
*
|
||||
*
|
||||
*
|
||||
* @throws ApiException
|
||||
* if the Api call fails
|
||||
*/
|
||||
@Test
|
||||
public void loginUserTest() {
|
||||
String username = null;
|
||||
String password = null;
|
||||
String response = api.loginUser(username, password);
|
||||
|
||||
// TODO: test validations
|
||||
}
|
||||
|
||||
/**
|
||||
* Logs out current logged in user session
|
||||
*
|
||||
*
|
||||
*
|
||||
* @throws ApiException
|
||||
* if the Api call fails
|
||||
*/
|
||||
@Test
|
||||
public void logoutUserTest() {
|
||||
api.logoutUser();
|
||||
}
|
||||
|
||||
private User createUser() {
|
||||
User user = new User();
|
||||
user.setId(TestUtils.nextId());
|
||||
user.setUsername("fred" + user.getId());
|
||||
user.setFirstName("Fred");
|
||||
user.setLastName("Meyer");
|
||||
user.setEmail("fred@fredmeyer.com");
|
||||
user.setPassword("xxXXxx");
|
||||
user.setPhone("408-867-5309");
|
||||
user.setUserStatus(123);
|
||||
|
||||
return user;
|
||||
// TODO: test validations
|
||||
}
|
||||
|
||||
/**
|
||||
* Updated user
|
||||
*
|
||||
* This can only be done by the logged in user.
|
||||
*
|
||||
* @throws ApiException
|
||||
* if the Api call fails
|
||||
*/
|
||||
@Test
|
||||
public void updateUserTest() {
|
||||
String username = null;
|
||||
User user = null;
|
||||
api.updateUser(username, user);
|
||||
|
||||
// TODO: test validations
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,47 +0,0 @@
|
||||
package io.swagger.client.auth;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Map;
|
||||
import java.util.List;
|
||||
|
||||
import org.junit.*;
|
||||
import org.springframework.http.HttpHeaders;
|
||||
import org.springframework.util.LinkedMultiValueMap;
|
||||
import org.springframework.util.MultiValueMap;
|
||||
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
public class ApiKeyAuthTest {
|
||||
@Test
|
||||
public void testApplyToParamsInQuery() {
|
||||
MultiValueMap<String, String> queryParams = new LinkedMultiValueMap<String, String>();
|
||||
HttpHeaders headerParams = new HttpHeaders();
|
||||
|
||||
ApiKeyAuth auth = new ApiKeyAuth("query", "api_key");
|
||||
auth.setApiKey("my-api-key");
|
||||
auth.applyToParams(queryParams, headerParams);
|
||||
|
||||
assertEquals(1, queryParams.size());
|
||||
assertEquals("my-api-key", queryParams.get("api_key").get(0));
|
||||
|
||||
// no changes to header parameters
|
||||
assertEquals(0, headerParams.size());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testApplyToParamsInHeaderWithPrefix() {
|
||||
MultiValueMap<String, String> queryParams = new LinkedMultiValueMap<String, String>();
|
||||
HttpHeaders headerParams = new HttpHeaders();
|
||||
|
||||
ApiKeyAuth auth = new ApiKeyAuth("header", "X-API-TOKEN");
|
||||
auth.setApiKey("my-api-token");
|
||||
auth.setApiKeyPrefix("Token");
|
||||
auth.applyToParams(queryParams, headerParams);
|
||||
|
||||
// no changes to query parameters
|
||||
assertEquals(0, queryParams.size());
|
||||
assertEquals(1, headerParams.size());
|
||||
assertEquals("Token my-api-token", headerParams.get("X-API-TOKEN").get(0));
|
||||
}
|
||||
}
|
||||
@@ -1,54 +0,0 @@
|
||||
package io.swagger.client.auth;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Map;
|
||||
import java.util.List;
|
||||
|
||||
import org.junit.*;
|
||||
import org.springframework.http.HttpHeaders;
|
||||
import org.springframework.util.LinkedMultiValueMap;
|
||||
import org.springframework.util.MultiValueMap;
|
||||
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
public class HttpBasicAuthTest {
|
||||
HttpBasicAuth auth = null;
|
||||
|
||||
@Before
|
||||
public void setup() {
|
||||
auth = new HttpBasicAuth();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testApplyToParams() {
|
||||
MultiValueMap<String, String> queryParams = new LinkedMultiValueMap<String, String>();
|
||||
HttpHeaders headerParams = new HttpHeaders();
|
||||
|
||||
auth.setUsername("my-username");
|
||||
auth.setPassword("my-password");
|
||||
auth.applyToParams(queryParams, headerParams);
|
||||
|
||||
// no changes to query parameters
|
||||
assertEquals(0, queryParams.size());
|
||||
assertEquals(1, headerParams.size());
|
||||
// the string below is base64-encoded result of "my-username:my-password" with the "Basic " prefix
|
||||
String expected = "Basic bXktdXNlcm5hbWU6bXktcGFzc3dvcmQ=";
|
||||
assertEquals(expected, headerParams.get("Authorization").get(0));
|
||||
|
||||
// null username should be treated as empty string
|
||||
auth.setUsername(null);
|
||||
auth.applyToParams(queryParams, headerParams);
|
||||
// the string below is base64-encoded result of ":my-password" with the "Basic " prefix
|
||||
expected = "Basic Om15LXBhc3N3b3Jk";
|
||||
assertEquals(expected, headerParams.get("Authorization").get(1));
|
||||
|
||||
// null password should be treated as empty string
|
||||
auth.setUsername("my-username");
|
||||
auth.setPassword(null);
|
||||
auth.applyToParams(queryParams, headerParams);
|
||||
// the string below is base64-encoded result of "my-username:" with the "Basic " prefix
|
||||
expected = "Basic bXktdXNlcm5hbWU6";
|
||||
assertEquals(expected, headerParams.get("Authorization").get(2));
|
||||
}
|
||||
}
|
||||
@@ -1,63 +0,0 @@
|
||||
package io.swagger.client.model;
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import com.fasterxml.jackson.databind.ObjectWriter;
|
||||
import com.fasterxml.jackson.databind.SerializationFeature;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
import static org.junit.Assert.fail;
|
||||
|
||||
public class EnumValueTest {
|
||||
|
||||
@Test
|
||||
public void testEnumClass() {
|
||||
assertEquals(EnumClass._ABC.toString(), "_abc");
|
||||
assertEquals(EnumClass._EFG.toString(), "-efg");
|
||||
assertEquals(EnumClass._XYZ_.toString(), "(xyz)");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testEnumTest() {
|
||||
// test enum value
|
||||
EnumTest enumTest = new EnumTest();
|
||||
enumTest.setEnumString(EnumTest.EnumStringEnum.LOWER);
|
||||
enumTest.setEnumInteger(EnumTest.EnumIntegerEnum.NUMBER_1);
|
||||
enumTest.setEnumNumber(EnumTest.EnumNumberEnum.NUMBER_1_DOT_1);
|
||||
|
||||
assertEquals(EnumTest.EnumStringEnum.UPPER.toString(), "UPPER");
|
||||
assertEquals(EnumTest.EnumStringEnum.UPPER.getValue(), "UPPER");
|
||||
assertEquals(EnumTest.EnumStringEnum.LOWER.toString(), "lower");
|
||||
assertEquals(EnumTest.EnumStringEnum.LOWER.getValue(), "lower");
|
||||
|
||||
assertEquals(EnumTest.EnumIntegerEnum.NUMBER_1.toString(), "1");
|
||||
assertTrue(EnumTest.EnumIntegerEnum.NUMBER_1.getValue() == 1);
|
||||
assertEquals(EnumTest.EnumIntegerEnum.NUMBER_MINUS_1.toString(), "-1");
|
||||
assertTrue(EnumTest.EnumIntegerEnum.NUMBER_MINUS_1.getValue() == -1);
|
||||
|
||||
assertEquals(EnumTest.EnumNumberEnum.NUMBER_1_DOT_1.toString(), "1.1");
|
||||
assertTrue(EnumTest.EnumNumberEnum.NUMBER_1_DOT_1.getValue() == 1.1);
|
||||
assertEquals(EnumTest.EnumNumberEnum.NUMBER_MINUS_1_DOT_2.toString(), "-1.2");
|
||||
assertTrue(EnumTest.EnumNumberEnum.NUMBER_MINUS_1_DOT_2.getValue() == -1.2);
|
||||
|
||||
try {
|
||||
// test serialization (object => json)
|
||||
ObjectMapper mapper = new ObjectMapper();
|
||||
mapper.enable(SerializationFeature.WRITE_ENUMS_USING_TO_STRING);
|
||||
ObjectWriter ow = mapper.writer();
|
||||
String json = ow.writeValueAsString(enumTest);
|
||||
assertEquals(json, "{\"enum_string\":\"lower\",\"enum_integer\":1,\"enum_number\":1.1,\"outerEnum\":null}");
|
||||
|
||||
// test deserialization (json => object)
|
||||
EnumTest fromString = mapper.readValue(json, EnumTest.class);
|
||||
assertEquals(fromString.getEnumString().toString(), "lower");
|
||||
assertEquals(fromString.getEnumInteger().toString(), "1");
|
||||
assertEquals(fromString.getEnumNumber().toString(), "1.1");
|
||||
|
||||
} catch (Exception e) {
|
||||
fail("Exception thrown during serialization/deserialzation of JSON: " + e.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user