Update rust client with Petstore OAS2 (#148)

* update rust client with petstore oas2

* update rust with oas2 petstore, fix default value

* fix type mapping for file, update api_doc for rust client

* update rust client with oas3
This commit is contained in:
William Cheng 2018-05-04 01:38:40 +08:00 committed by GitHub
parent 4690325a2c
commit 18a40deb30
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
18 changed files with 158 additions and 144 deletions

32
bin/openapi3/rust-petstore.sh Executable file
View File

@ -0,0 +1,32 @@
#!/bin/sh
SCRIPT="$0"
echo "# START SCRIPT: $SCRIPT"
while [ -h "$SCRIPT" ] ; do
ls=$(ls -ld "$SCRIPT")
link=$(expr "$ls" : '.*-> \(.*\)$')
if expr "$link" : '/.*' > /dev/null; then
SCRIPT="$link"
else
SCRIPT=$(dirname "$SCRIPT")/"$link"
fi
done
if [ ! -d "${APP_DIR}" ]; then
APP_DIR=$(dirname "$SCRIPT")/..
APP_DIR=$(cd "${APP_DIR}"; pwd)
fi
executable="./modules/openapi-generator-cli/target/openapi-generator-cli.jar"
if [ ! -f "$executable" ]
then
mvn clean package
fi
# if you've executed sbt assembly previously it will use that instead.
export JAVA_OPTS="${JAVA_OPTS} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties"
ags="generate -t modules/openapi-generator/src/main/resources/rust -i modules/openapi-generator/src/test/resources/3_0/petstore.yaml -l rust -o samples/client/petstore/rust -DpackageName=petstore_client $@"
java ${JAVA_OPTS} -jar ${executable} ${ags}

View File

@ -46,7 +46,7 @@ public class RustClientCodegen extends DefaultCodegen implements CodegenConfig {
protected String apiDocPath = "docs/";
protected String modelDocPath = "docs/";
protected String apiFolder = "src/apis";
protected String modelFolder= "src/models";
protected String modelFolder = "src/models";
public CodegenType getTag() {
return CodegenType.CLIENT;
@ -75,34 +75,34 @@ public class RustClientCodegen extends DefaultCodegen implements CodegenConfig {
embeddedTemplateDir = templateDir = "rust";
setReservedWordsLowerCase(
Arrays.asList(
"abstract", "alignof", "as", "become", "box",
"break", "const", "continue", "crate", "do",
"else", "enum", "extern", "false", "final",
"fn", "for", "if", "impl", "in",
"let", "loop", "macro", "match", "mod",
"move", "mut", "offsetof", "override", "priv",
"proc", "pub", "pure", "ref", "return",
"Self", "self", "sizeof", "static", "struct",
"super", "trait", "true", "type", "typeof",
"unsafe", "unsized", "use", "virtual", "where",
"while", "yield"
)
Arrays.asList(
"abstract", "alignof", "as", "become", "box",
"break", "const", "continue", "crate", "do",
"else", "enum", "extern", "false", "final",
"fn", "for", "if", "impl", "in",
"let", "loop", "macro", "match", "mod",
"move", "mut", "offsetof", "override", "priv",
"proc", "pub", "pure", "ref", "return",
"Self", "self", "sizeof", "static", "struct",
"super", "trait", "true", "type", "typeof",
"unsafe", "unsized", "use", "virtual", "where",
"while", "yield"
)
);
defaultIncludes = new HashSet<String>(
Arrays.asList(
"map",
"array")
);
"map",
"array")
);
languageSpecificPrimitives = new HashSet<String>(
Arrays.asList(
"i8", "i16", "i32", "i64",
"u8", "u16", "u32", "u64",
"f32", "f64",
"char", "bool", "String", "Vec<u8>", "File")
);
Arrays.asList(
"i8", "i16", "i32", "i64",
"u8", "u16", "u32", "u64",
"f32", "f64",
"char", "bool", "String", "Vec<u8>", "File")
);
instantiationTypes.clear();
/*instantiationTypes.put("array", "GoArray");
@ -121,8 +121,8 @@ public class RustClientCodegen extends DefaultCodegen implements CodegenConfig {
typeMapping.put("DateTime", "String");
typeMapping.put("password", "String");
// TODO(farcaller): map file
typeMapping.put("file", "File");
typeMapping.put("binary", "Vec<u8>");
typeMapping.put("file", "::models::File");
typeMapping.put("binary", "::models::File");
typeMapping.put("ByteArray", "String");
typeMapping.put("object", "Value");
@ -145,15 +145,13 @@ public class RustClientCodegen extends DefaultCodegen implements CodegenConfig {
if (additionalProperties.containsKey(CodegenConstants.PACKAGE_NAME)) {
setPackageName((String) additionalProperties.get(CodegenConstants.PACKAGE_NAME));
}
else {
} else {
setPackageName("swagger");
}
if (additionalProperties.containsKey(CodegenConstants.PACKAGE_VERSION)) {
setPackageVersion((String) additionalProperties.get(CodegenConstants.PACKAGE_VERSION));
}
else {
} else {
setPackageVersion("1.0.0");
}
@ -180,8 +178,7 @@ public class RustClientCodegen extends DefaultCodegen implements CodegenConfig {
}
@Override
public String escapeReservedWord(String name)
{
public String escapeReservedWord(String name) {
if (this.reservedWordsMappings().containsKey(name)) {
return this.reservedWordsMappings().get(name);
}
@ -294,8 +291,7 @@ public class RustClientCodegen extends DefaultCodegen implements CodegenConfig {
ArraySchema ap = (ArraySchema) p;
Schema inner = ap.getItems();
return "Vec<" + getTypeDeclaration(inner) + ">";
}
else if (ModelUtils.isMapSchema(p)) {
} else if (ModelUtils.isMapSchema(p)) {
Schema inner = (Schema) p.getAdditionalProperties();
return "::std::collections::HashMap<String, " + getTypeDeclaration(inner) + ">";
}
@ -324,12 +320,11 @@ public class RustClientCodegen extends DefaultCodegen implements CodegenConfig {
public String getSchemaType(Schema p) {
String schemaType = super.getSchemaType(p);
String type = null;
if(typeMapping.containsKey(schemaType)) {
if (typeMapping.containsKey(schemaType)) {
type = typeMapping.get(schemaType);
if(languageSpecificPrimitives.contains(type))
if (languageSpecificPrimitives.contains(type))
return (type);
}
else
} else
type = schemaType;
return type;
}
@ -413,7 +408,7 @@ public class RustClientCodegen extends DefaultCodegen implements CodegenConfig {
@Override
protected boolean needToImport(String type) {
return !defaultIncludes.contains(type)
&& !languageSpecificPrimitives.contains(type);
&& !languageSpecificPrimitives.contains(type);
}
public void setPackageName(String packageName) {
@ -495,4 +490,13 @@ public class RustClientCodegen extends DefaultCodegen implements CodegenConfig {
return enumName;
}
}
@Override
public String toDefaultValue(Schema p) {
if (p.getDefault() != null) {
return p.getDefault().toString();
} else {
return null;
}
}
}

View File

@ -21,7 +21,7 @@ Method | HTTP request | Description
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------{{#authMethods}}
**ctx** | **context.Context** | context containing the authentication | nil if no authentication{{/authMethods}}{{/-last}}{{/allParams}}{{#allParams}}{{#required}}
**{{paramName}}** | {{#isFile}}**{{dataType}}**{{/isFile}}{{#isPrimitiveType}}**{{dataType}}**{{/isPrimitiveType}}{{^isPrimitiveType}}{{^isFile}}[**{{dataType}}**]({{baseType}}.md){{/isFile}}{{/isPrimitiveType}}| {{description}} | {{#defaultValue}}[default to {{defaultValue}}]{{/defaultValue}}{{/required}}{{/allParams}}{{#hasOptionalParams}}
**{{paramName}}** | {{#isPrimitiveType}}**{{dataType}}**{{/isPrimitiveType}}{{^isPrimitiveType}}[**{{dataType}}**]({{baseType}}.md){{/isPrimitiveType}}| {{description}} | {{#defaultValue}}[default to {{defaultValue}}]{{/defaultValue}}{{/required}}{{/allParams}}{{#hasOptionalParams}}
**optional** | **map[string]interface{}** | optional parameters | nil if no parameters
### Optional Parameters
@ -29,7 +29,7 @@ Optional parameters are passed through a map[string]interface{}.
{{#allParams}}{{#-last}}
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------{{/-last}}{{/allParams}}{{#allParams}}
**{{paramName}}** | {{#isFile}}**{{dataType}}**{{/isFile}}{{#isPrimitiveType}}**{{dataType}}**{{/isPrimitiveType}}{{^isPrimitiveType}}{{^isFile}}[**{{dataType}}**]({{baseType}}.md){{/isFile}}{{/isPrimitiveType}}| {{description}} | {{#defaultValue}}[default to {{defaultValue}}]{{/defaultValue}}{{/allParams}}{{/hasOptionalParams}}
**{{paramName}}** | {{#isPrimitiveType}}**{{dataType}}**{{/isPrimitiveType}}{{^isPrimitiveType}}[**{{dataType}}**]({{baseType}}.md){{/isPrimitiveType}}| {{description}} | {{#defaultValue}}[default to {{defaultValue}}]{{/defaultValue}}{{/allParams}}{{/hasOptionalParams}}
### Return type

View File

@ -1 +1 @@
2.4.0-SNAPSHOT
3.0.0-SNAPSHOT

View File

@ -1 +1 @@
2.4.0-SNAPSHOT
3.0.0-SNAPSHOT

View File

@ -7,7 +7,7 @@ This API client was generated by the [swagger-codegen](https://github.com/swagge
- API version: 1.0.0
- Package version: 1.0.0
- Build package: io.swagger.codegen.languages.RustClientCodegen
- Build package: org.openapitools.codegen.languages.RustClientCodegen
## Installation
Put the package under your project folder and add the following in import:

View File

@ -3,9 +3,9 @@
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**code** | **i32** | | [optional] [default to null]
**_type** | **String** | | [optional] [default to null]
**message** | **String** | | [optional] [default to null]
**code** | **i32** | | [optional]
**_type** | **String** | | [optional]
**message** | **String** | | [optional]
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View File

@ -3,8 +3,8 @@
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**id** | **i64** | | [optional] [default to null]
**name** | **String** | | [optional] [default to null]
**id** | **i64** | | [optional]
**name** | **String** | | [optional]
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View File

@ -3,12 +3,12 @@
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**id** | **i64** | | [optional] [default to null]
**pet_id** | **i64** | | [optional] [default to null]
**quantity** | **i32** | | [optional] [default to null]
**ship_date** | **String** | | [optional] [default to null]
**status** | **String** | Order Status | [optional] [default to null]
**complete** | **bool** | | [optional] [default to null]
**id** | **i64** | | [optional]
**pet_id** | **i64** | | [optional]
**quantity** | **i32** | | [optional]
**ship_date** | **String** | | [optional]
**status** | **String** | Order Status | [optional]
**complete** | **bool** | | [optional] [default to false]
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View File

@ -3,12 +3,12 @@
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**id** | **i64** | | [optional] [default to null]
**category** | [***::models::Category**](Category.md) | | [optional] [default to null]
**name** | **String** | | [default to null]
**photo_urls** | **Vec<String>** | | [default to null]
**tags** | [**Vec<::models::Tag>**](Tag.md) | | [optional] [default to null]
**status** | **String** | pet status in the store | [optional] [default to null]
**id** | **i64** | | [optional]
**category** | [***::models::Category**](Category.md) | | [optional]
**name** | **String** | |
**photo_urls** | **Vec<String>** | |
**tags** | [**Vec<::models::Tag>**](Tag.md) | | [optional]
**status** | **String** | pet status in the store | [optional]
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View File

@ -15,17 +15,15 @@ Method | HTTP request | Description
# **add_pet**
> add_pet(ctx, body)
> add_pet(ctx, pet)
Add a new pet to the store
### Required Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**ctx** | **context.Context** | context containing the authentication | nil if no authentication
**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
@ -38,7 +36,7 @@ Name | Type | Description | Notes
### HTTP request headers
- **Content-Type**: application/json, application/xml
- **Accept**: application/xml, application/json
- **Accept**: Not defined
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
@ -46,8 +44,6 @@ Name | Type | Description | Notes
> delete_pet(ctx, pet_id, optional)
Deletes a pet
### Required Parameters
Name | Type | Description | Notes
@ -75,7 +71,7 @@ Name | Type | Description | Notes
### HTTP request headers
- **Content-Type**: Not defined
- **Accept**: application/xml, application/json
- **Accept**: Not defined
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
@ -164,17 +160,15 @@ Name | Type | Description | Notes
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
# **update_pet**
> update_pet(ctx, body)
> update_pet(ctx, pet)
Update an existing pet
### Required Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**ctx** | **context.Context** | context containing the authentication | nil if no authentication
**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
@ -187,7 +181,7 @@ Name | Type | Description | Notes
### HTTP request headers
- **Content-Type**: application/json, application/xml
- **Accept**: application/xml, application/json
- **Accept**: Not defined
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
@ -195,8 +189,6 @@ Name | Type | Description | Notes
> update_pet_with_form(ctx, pet_id, optional)
Updates a pet in the store with form data
### Required Parameters
Name | Type | Description | Notes
@ -225,7 +217,7 @@ Name | Type | Description | Notes
### HTTP request headers
- **Content-Type**: application/x-www-form-urlencoded
- **Accept**: application/xml, application/json
- **Accept**: Not defined
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
@ -233,8 +225,6 @@ Name | Type | Description | Notes
> ::models::ApiResponse upload_file(ctx, pet_id, optional)
uploads an image
### Required Parameters
Name | Type | Description | Notes
@ -250,7 +240,7 @@ Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**pet_id** | **i64**| ID of pet to update |
**additional_metadata** | **String**| Additional data to pass to server |
**file** | **File**| file to upload |
**file** | **::models::File**| file to upload |
### Return type

View File

@ -33,7 +33,7 @@ No authorization required
### HTTP request headers
- **Content-Type**: Not defined
- **Accept**: application/xml, application/json
- **Accept**: Not defined
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
@ -89,16 +89,14 @@ No authorization required
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
# **place_order**
> ::models::Order place_order(body)
> ::models::Order place_order(order)
Place an order for a pet
### Required Parameters
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
@ -110,7 +108,7 @@ No authorization required
### HTTP request headers
- **Content-Type**: Not defined
- **Content-Type**: application/json
- **Accept**: application/xml, application/json
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)

View File

@ -3,8 +3,8 @@
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**id** | **i64** | | [optional] [default to null]
**name** | **String** | | [optional] [default to null]
**id** | **i64** | | [optional]
**name** | **String** | | [optional]
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View File

@ -3,14 +3,14 @@
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**id** | **i64** | | [optional] [default to null]
**username** | **String** | | [optional] [default to null]
**first_name** | **String** | | [optional] [default to null]
**last_name** | **String** | | [optional] [default to null]
**email** | **String** | | [optional] [default to null]
**password** | **String** | | [optional] [default to null]
**phone** | **String** | | [optional] [default to null]
**user_status** | **i32** | User Status | [optional] [default to null]
**id** | **i64** | | [optional]
**username** | **String** | | [optional]
**first_name** | **String** | | [optional]
**last_name** | **String** | | [optional]
**email** | **String** | | [optional]
**password** | **String** | | [optional]
**phone** | **String** | | [optional]
**user_status** | **i32** | User Status | [optional]
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View File

@ -15,7 +15,7 @@ Method | HTTP request | Description
# **create_user**
> create_user(body)
> create_user(user)
Create user
This can only be done by the logged in user.
@ -24,7 +24,7 @@ This can only be done by the logged in user.
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**body** | [**User**](User.md)| Created user object |
**user** | [**User**](User.md)| Created user object |
### Return type
@ -36,22 +36,20 @@ No authorization required
### HTTP request headers
- **Content-Type**: Not defined
- **Accept**: application/xml, application/json
- **Content-Type**: application/json
- **Accept**: Not defined
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
# **create_users_with_array_input**
> create_users_with_array_input(body)
> create_users_with_array_input(user)
Creates list of users with given input array
### Required Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**body** | [**Vec&lt;::models::User&gt;**](User.md)| List of user object |
**user** | [**Vec&lt;::models::User&gt;**](array.md)| List of user object |
### Return type
@ -63,22 +61,20 @@ No authorization required
### HTTP request headers
- **Content-Type**: Not defined
- **Accept**: application/xml, application/json
- **Content-Type**: application/json
- **Accept**: Not defined
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
# **create_users_with_list_input**
> create_users_with_list_input(body)
> create_users_with_list_input(user)
Creates list of users with given input array
### Required Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**body** | [**Vec&lt;::models::User&gt;**](User.md)| List of user object |
**user** | [**Vec&lt;::models::User&gt;**](array.md)| List of user object |
### Return type
@ -90,8 +86,8 @@ No authorization required
### HTTP request headers
- **Content-Type**: Not defined
- **Accept**: application/xml, application/json
- **Content-Type**: application/json
- **Accept**: Not defined
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
@ -118,7 +114,7 @@ No authorization required
### HTTP request headers
- **Content-Type**: Not defined
- **Accept**: application/xml, application/json
- **Accept**: Not defined
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
@ -126,8 +122,6 @@ No authorization required
> ::models::User get_user_by_name(username)
Get user by user name
### Required Parameters
Name | Type | Description | Notes
@ -153,8 +147,6 @@ No authorization required
> String login_user(username, password)
Logs user into the system
### Required Parameters
Name | Type | Description | Notes
@ -181,8 +173,6 @@ No authorization required
> logout_user()
Logs out current logged in user session
### Required Parameters
This endpoint does not need any parameter.
@ -197,12 +187,12 @@ No authorization required
### HTTP request headers
- **Content-Type**: Not defined
- **Accept**: application/xml, application/json
- **Accept**: Not defined
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
# **update_user**
> update_user(username, body)
> update_user(username, user)
Updated user
This can only be done by the logged in user.
@ -212,7 +202,7 @@ This can only be done by the logged in user.
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
@ -224,8 +214,8 @@ No authorization required
### HTTP request headers
- **Content-Type**: Not defined
- **Accept**: application/xml, application/json
- **Content-Type**: application/json
- **Accept**: Not defined
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)

View File

@ -35,19 +35,19 @@ impl<C: hyper::client::Connect> PetApiClient<C> {
}
pub trait PetApi {
fn add_pet(&self, body: ::models::Pet) -> Box<Future<Item = (), Error = Error<serde_json::Value>>>;
fn add_pet(&self, pet: ::models::Pet) -> Box<Future<Item = (), Error = Error<serde_json::Value>>>;
fn delete_pet(&self, pet_id: i64, api_key: &str) -> Box<Future<Item = (), Error = Error<serde_json::Value>>>;
fn find_pets_by_status(&self, status: Vec<String>) -> Box<Future<Item = Vec<::models::Pet>, Error = Error<serde_json::Value>>>;
fn find_pets_by_tags(&self, tags: Vec<String>) -> Box<Future<Item = Vec<::models::Pet>, Error = Error<serde_json::Value>>>;
fn get_pet_by_id(&self, pet_id: i64) -> Box<Future<Item = ::models::Pet, Error = Error<serde_json::Value>>>;
fn update_pet(&self, body: ::models::Pet) -> Box<Future<Item = (), Error = Error<serde_json::Value>>>;
fn update_pet(&self, pet: ::models::Pet) -> Box<Future<Item = (), Error = Error<serde_json::Value>>>;
fn update_pet_with_form(&self, pet_id: i64, name: &str, status: &str) -> Box<Future<Item = (), Error = Error<serde_json::Value>>>;
fn upload_file(&self, pet_id: i64, additional_metadata: &str, file: ::models::File) -> Box<Future<Item = ::models::ApiResponse, Error = Error<serde_json::Value>>>;
}
impl<C: hyper::client::Connect>PetApi for PetApiClient<C> {
fn add_pet(&self, body: ::models::Pet) -> Box<Future<Item = (), Error = Error<serde_json::Value>>> {
fn add_pet(&self, pet: ::models::Pet) -> Box<Future<Item = (), Error = Error<serde_json::Value>>> {
let configuration: &configuration::Configuration<C> = self.configuration.borrow();
let mut auth_headers = HashMap::<String, String>::new();
@ -88,7 +88,7 @@ impl<C: hyper::client::Connect>PetApi for PetApiClient<C> {
req.headers_mut().set_raw(key, val);
}
let serialized = serde_json::to_string(&body).unwrap();
let serialized = serde_json::to_string(&pet).unwrap();
req.headers_mut().set(hyper::header::ContentType::json());
req.headers_mut().set(hyper::header::ContentLength(serialized.len() as u64));
req.set_body(serialized);
@ -381,7 +381,7 @@ impl<C: hyper::client::Connect>PetApi for PetApiClient<C> {
)
}
fn update_pet(&self, body: ::models::Pet) -> Box<Future<Item = (), Error = Error<serde_json::Value>>> {
fn update_pet(&self, pet: ::models::Pet) -> Box<Future<Item = (), Error = Error<serde_json::Value>>> {
let configuration: &configuration::Configuration<C> = self.configuration.borrow();
let mut auth_headers = HashMap::<String, String>::new();
@ -422,7 +422,7 @@ impl<C: hyper::client::Connect>PetApi for PetApiClient<C> {
req.headers_mut().set_raw(key, val);
}
let serialized = serde_json::to_string(&body).unwrap();
let serialized = serde_json::to_string(&pet).unwrap();
req.headers_mut().set(hyper::header::ContentType::json());
req.headers_mut().set(hyper::header::ContentLength(serialized.len() as u64));
req.set_body(serialized);

View File

@ -38,7 +38,7 @@ pub trait StoreApi {
fn delete_order(&self, order_id: &str) -> Box<Future<Item = (), Error = Error<serde_json::Value>>>;
fn get_inventory(&self, ) -> Box<Future<Item = ::std::collections::HashMap<String, i32>, Error = Error<serde_json::Value>>>;
fn get_order_by_id(&self, order_id: i64) -> Box<Future<Item = ::models::Order, Error = Error<serde_json::Value>>>;
fn place_order(&self, body: ::models::Order) -> Box<Future<Item = ::models::Order, Error = Error<serde_json::Value>>>;
fn place_order(&self, order: ::models::Order) -> Box<Future<Item = ::models::Order, Error = Error<serde_json::Value>>>;
}
@ -206,7 +206,7 @@ impl<C: hyper::client::Connect>StoreApi for StoreApiClient<C> {
)
}
fn place_order(&self, body: ::models::Order) -> Box<Future<Item = ::models::Order, Error = Error<serde_json::Value>>> {
fn place_order(&self, order: ::models::Order) -> Box<Future<Item = ::models::Order, Error = Error<serde_json::Value>>> {
let configuration: &configuration::Configuration<C> = self.configuration.borrow();
let method = hyper::Method::Post;
@ -231,7 +231,7 @@ impl<C: hyper::client::Connect>StoreApi for StoreApiClient<C> {
let serialized = serde_json::to_string(&body).unwrap();
let serialized = serde_json::to_string(&order).unwrap();
req.headers_mut().set(hyper::header::ContentType::json());
req.headers_mut().set(hyper::header::ContentLength(serialized.len() as u64));
req.set_body(serialized);

View File

@ -35,19 +35,19 @@ impl<C: hyper::client::Connect> UserApiClient<C> {
}
pub trait UserApi {
fn create_user(&self, body: ::models::User) -> Box<Future<Item = (), Error = Error<serde_json::Value>>>;
fn create_users_with_array_input(&self, body: Vec<::models::User>) -> Box<Future<Item = (), Error = Error<serde_json::Value>>>;
fn create_users_with_list_input(&self, body: Vec<::models::User>) -> Box<Future<Item = (), Error = Error<serde_json::Value>>>;
fn create_user(&self, user: ::models::User) -> Box<Future<Item = (), Error = Error<serde_json::Value>>>;
fn create_users_with_array_input(&self, user: Vec<::models::User>) -> Box<Future<Item = (), Error = Error<serde_json::Value>>>;
fn create_users_with_list_input(&self, user: Vec<::models::User>) -> Box<Future<Item = (), Error = Error<serde_json::Value>>>;
fn delete_user(&self, username: &str) -> Box<Future<Item = (), Error = Error<serde_json::Value>>>;
fn get_user_by_name(&self, username: &str) -> Box<Future<Item = ::models::User, Error = Error<serde_json::Value>>>;
fn login_user(&self, username: &str, password: &str) -> Box<Future<Item = String, Error = Error<serde_json::Value>>>;
fn logout_user(&self, ) -> Box<Future<Item = (), Error = Error<serde_json::Value>>>;
fn update_user(&self, username: &str, body: ::models::User) -> Box<Future<Item = (), Error = Error<serde_json::Value>>>;
fn update_user(&self, username: &str, user: ::models::User) -> Box<Future<Item = (), Error = Error<serde_json::Value>>>;
}
impl<C: hyper::client::Connect>UserApi for UserApiClient<C> {
fn create_user(&self, body: ::models::User) -> Box<Future<Item = (), Error = Error<serde_json::Value>>> {
fn create_user(&self, user: ::models::User) -> Box<Future<Item = (), Error = Error<serde_json::Value>>> {
let configuration: &configuration::Configuration<C> = self.configuration.borrow();
let method = hyper::Method::Post;
@ -72,7 +72,7 @@ impl<C: hyper::client::Connect>UserApi for UserApiClient<C> {
let serialized = serde_json::to_string(&body).unwrap();
let serialized = serde_json::to_string(&user).unwrap();
req.headers_mut().set(hyper::header::ContentType::json());
req.headers_mut().set(hyper::header::ContentLength(serialized.len() as u64));
req.set_body(serialized);
@ -98,7 +98,7 @@ impl<C: hyper::client::Connect>UserApi for UserApiClient<C> {
)
}
fn create_users_with_array_input(&self, body: Vec<::models::User>) -> Box<Future<Item = (), Error = Error<serde_json::Value>>> {
fn create_users_with_array_input(&self, user: Vec<::models::User>) -> Box<Future<Item = (), Error = Error<serde_json::Value>>> {
let configuration: &configuration::Configuration<C> = self.configuration.borrow();
let method = hyper::Method::Post;
@ -123,7 +123,7 @@ impl<C: hyper::client::Connect>UserApi for UserApiClient<C> {
let serialized = serde_json::to_string(&body).unwrap();
let serialized = serde_json::to_string(&user).unwrap();
req.headers_mut().set(hyper::header::ContentType::json());
req.headers_mut().set(hyper::header::ContentLength(serialized.len() as u64));
req.set_body(serialized);
@ -149,7 +149,7 @@ impl<C: hyper::client::Connect>UserApi for UserApiClient<C> {
)
}
fn create_users_with_list_input(&self, body: Vec<::models::User>) -> Box<Future<Item = (), Error = Error<serde_json::Value>>> {
fn create_users_with_list_input(&self, user: Vec<::models::User>) -> Box<Future<Item = (), Error = Error<serde_json::Value>>> {
let configuration: &configuration::Configuration<C> = self.configuration.borrow();
let method = hyper::Method::Post;
@ -174,7 +174,7 @@ impl<C: hyper::client::Connect>UserApi for UserApiClient<C> {
let serialized = serde_json::to_string(&body).unwrap();
let serialized = serde_json::to_string(&user).unwrap();
req.headers_mut().set(hyper::header::ContentType::json());
req.headers_mut().set(hyper::header::ContentLength(serialized.len() as u64));
req.set_body(serialized);
@ -396,7 +396,7 @@ impl<C: hyper::client::Connect>UserApi for UserApiClient<C> {
)
}
fn update_user(&self, username: &str, body: ::models::User) -> Box<Future<Item = (), Error = Error<serde_json::Value>>> {
fn update_user(&self, username: &str, user: ::models::User) -> Box<Future<Item = (), Error = Error<serde_json::Value>>> {
let configuration: &configuration::Configuration<C> = self.configuration.borrow();
let method = hyper::Method::Put;
@ -421,7 +421,7 @@ impl<C: hyper::client::Connect>UserApi for UserApiClient<C> {
let serialized = serde_json::to_string(&body).unwrap();
let serialized = serde_json::to_string(&user).unwrap();
req.headers_mut().set(hyper::header::ContentType::json());
req.headers_mut().set(hyper::header::ContentLength(serialized.len() as u64));
req.set_body(serialized);