Add nonNullableVars to CodegenModel (#12815)

* added nonNullableVars

* build samples
This commit is contained in:
devhl-labs 2022-07-13 04:48:23 -04:00 committed by GitHub
parent 57496ff0b0
commit 636820b541
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
18 changed files with 139 additions and 119 deletions

View File

@ -75,6 +75,7 @@ public class CodegenModel implements IJsonSchemaValidationProperties {
public List<CodegenProperty> readOnlyVars = new ArrayList<>(); // a list of read-only properties
public List<CodegenProperty> readWriteVars = new ArrayList<>(); // a list of properties for read, write
public List<CodegenProperty> parentVars = new ArrayList<>();
public List<CodegenProperty> nonNullableVars = new ArrayList<>(); // a list of non-nullable properties
public Map<String, Object> allowableValues;
// Sorted sets of required parameters.
@ -196,6 +197,14 @@ public class CodegenModel implements IJsonSchemaValidationProperties {
this.allVars = allVars;
}
public List<CodegenProperty> getNonNullableVars() {
return nonNullableVars;
}
public void setNonNullableVars(List<CodegenProperty> nonNullableVars) {
this.nonNullableVars = nonNullableVars;
}
public Map<String, Object> getAllowableValues() {
return allowableValues;
}
@ -947,6 +956,7 @@ public class CodegenModel implements IJsonSchemaValidationProperties {
Objects.equals(arrayModelType, that.arrayModelType) &&
Objects.equals(vars, that.vars) &&
Objects.equals(allVars, that.allVars) &&
Objects.equals(nonNullableVars, that.nonNullableVars) &&
Objects.equals(requiredVars, that.requiredVars) &&
Objects.equals(optionalVars, that.optionalVars) &&
Objects.equals(readOnlyVars, that.readOnlyVars) &&
@ -982,7 +992,7 @@ public class CodegenModel implements IJsonSchemaValidationProperties {
getXmlName(), getClassFilename(), getUnescapedDescription(), getDiscriminator(), getDefaultValue(),
getArrayModelType(), isAlias, isString, isInteger, isLong, isNumber, isNumeric, isFloat, isDouble,
isDate, isDateTime, isNull, hasValidation, isShort, isUnboundedInteger, isBoolean,
getVars(), getAllVars(), getRequiredVars(), getOptionalVars(), getReadOnlyVars(), getReadWriteVars(),
getVars(), getAllVars(), getNonNullableVars(), getRequiredVars(), getOptionalVars(), getReadOnlyVars(), getReadWriteVars(),
getParentVars(), getAllowableValues(), getMandatory(), getAllMandatory(), getImports(), hasVars,
isEmptyVars(), hasMoreModels, hasEnums, isEnum, isNullable, hasRequired, hasOptional, isArray,
hasChildren, isMap, isDeprecated, hasOnlyReadOnly, getExternalDocumentation(), getVendorExtensions(),
@ -1036,6 +1046,7 @@ public class CodegenModel implements IJsonSchemaValidationProperties {
sb.append(", isDateTime=").append(isDateTime);
sb.append(", vars=").append(vars);
sb.append(", allVars=").append(allVars);
sb.append(", nonNullableVars=").append(nonNullableVars);
sb.append(", requiredVars=").append(requiredVars);
sb.append(", optionalVars=").append(optionalVars);
sb.append(", readOnlyVars=").append(readOnlyVars);
@ -1123,6 +1134,7 @@ public class CodegenModel implements IJsonSchemaValidationProperties {
requiredVars = removeDuplicatedProperty(requiredVars);
parentVars = removeDuplicatedProperty(parentVars);
allVars = removeDuplicatedProperty(allVars);
nonNullableVars = removeDuplicatedProperty(nonNullableVars);
readOnlyVars = removeDuplicatedProperty(readOnlyVars);
readWriteVars = removeDuplicatedProperty(readWriteVars);
}

View File

@ -698,6 +698,10 @@ public class DefaultCodegen implements CodegenConfig {
updateCodegenPropertyEnum(var);
}
for (CodegenProperty var : cm.nonNullableVars) {
updateCodegenPropertyEnum(var);
}
for (CodegenProperty var : cm.requiredVars) {
updateCodegenPropertyEnum(var);
}
@ -5453,6 +5457,10 @@ public class DefaultCodegen implements CodegenConfig {
// duplicated properties will be removed by removeAllDuplicatedProperty later
cm.readWriteVars.add(cp);
}
if (Boolean.FALSE.equals(cp.isNullable)){
cm.nonNullableVars.add(cp);
}
}
}
return;

View File

@ -47,7 +47,7 @@ Name | Type | Description | Required | Notes
## delete_pet
> delete_pet(pet_id, api_key)
> delete_pet(petid, api_key)
Deletes a pet
@ -57,7 +57,7 @@ Deletes a pet
Name | Type | Description | Required | Notes
------------- | ------------- | ------------- | ------------- | -------------
**pet_id** | **i64** | Pet id to delete | [required] |
**petid** | **i64** | Pet id to delete | [required] |
**api_key** | Option<**String**> | | |
### Return type
@ -138,7 +138,7 @@ Name | Type | Description | Required | Notes
## get_pet_by_id
> crate::models::Pet get_pet_by_id(pet_id)
> crate::models::Pet get_pet_by_id(petid)
Find pet by ID
Returns a single pet
@ -148,7 +148,7 @@ Returns a single pet
Name | Type | Description | Required | Notes
------------- | ------------- | ------------- | ------------- | -------------
**pet_id** | **i64** | ID of pet to return | [required] |
**petid** | **i64** | ID of pet to return | [required] |
### Return type
@ -198,7 +198,7 @@ Name | Type | Description | Required | Notes
## update_pet_with_form
> update_pet_with_form(pet_id, name, status)
> update_pet_with_form(petid, name, status)
Updates a pet in the store with form data
@ -208,7 +208,7 @@ Updates a pet in the store with form data
Name | Type | Description | Required | Notes
------------- | ------------- | ------------- | ------------- | -------------
**pet_id** | **i64** | ID of pet that needs to be updated | [required] |
**petid** | **i64** | ID of pet that needs to be updated | [required] |
**name** | Option<**String**> | Updated name of the pet | |
**status** | Option<**String**> | Updated status of the pet | |
@ -230,7 +230,7 @@ Name | Type | Description | Required | Notes
## upload_file
> crate::models::ApiResponse upload_file(pet_id, additional_metadata, file)
> crate::models::ApiResponse upload_file(petid, additionalmetadata, file)
uploads an image
@ -240,8 +240,8 @@ uploads an image
Name | Type | Description | Required | Notes
------------- | ------------- | ------------- | ------------- | -------------
**pet_id** | **i64** | ID of pet to update | [required] |
**additional_metadata** | Option<**String**> | Additional data to pass to server | |
**petid** | **i64** | ID of pet to update | [required] |
**additionalmetadata** | Option<**String**> | Additional data to pass to server | |
**file** | Option<**std::path::PathBuf**> | file to upload | |
### Return type

View File

@ -13,7 +13,7 @@ Method | HTTP request | Description
## delete_order
> delete_order(order_id)
> delete_order(orderid)
Delete purchase order by ID
For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors
@ -23,7 +23,7 @@ For valid response try integer IDs with value < 1000. Anything above 1000 or non
Name | Type | Description | Required | Notes
------------- | ------------- | ------------- | ------------- | -------------
**order_id** | **String** | ID of the order that needs to be deleted | [required] |
**orderid** | **String** | ID of the order that needs to be deleted | [required] |
### Return type
@ -70,7 +70,7 @@ This endpoint does not need any parameter.
## get_order_by_id
> crate::models::Order get_order_by_id(order_id)
> crate::models::Order get_order_by_id(orderid)
Find purchase order by ID
For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions
@ -80,7 +80,7 @@ For valid response try integer IDs with value <= 5 or > 10. Other values will ge
Name | Type | Description | Required | Notes
------------- | ------------- | ------------- | ------------- | -------------
**order_id** | **i64** | ID of pet that needs to be fetched | [required] |
**orderid** | **i64** | ID of pet that needs to be fetched | [required] |
### Return type

View File

@ -36,13 +36,13 @@ impl<C: hyper::client::connect::Connect> PetApiClient<C>
pub trait PetApi {
fn add_pet(&self, pet: crate::models::Pet) -> Pin<Box<dyn Future<Output = Result<crate::models::Pet, Error>>>>;
fn delete_pet(&self, pet_id: i64, api_key: Option<&str>) -> Pin<Box<dyn Future<Output = Result<(), Error>>>>;
fn delete_pet(&self, petid: i64, api_key: Option<&str>) -> Pin<Box<dyn Future<Output = Result<(), Error>>>>;
fn find_pets_by_status(&self, status: Vec<String>) -> Pin<Box<dyn Future<Output = Result<Vec<crate::models::Pet>, Error>>>>;
fn find_pets_by_tags(&self, tags: Vec<String>) -> Pin<Box<dyn Future<Output = Result<Vec<crate::models::Pet>, Error>>>>;
fn get_pet_by_id(&self, pet_id: i64) -> Pin<Box<dyn Future<Output = Result<crate::models::Pet, Error>>>>;
fn get_pet_by_id(&self, petid: i64) -> Pin<Box<dyn Future<Output = Result<crate::models::Pet, Error>>>>;
fn update_pet(&self, pet: crate::models::Pet) -> Pin<Box<dyn Future<Output = Result<crate::models::Pet, Error>>>>;
fn update_pet_with_form(&self, pet_id: i64, name: Option<&str>, status: Option<&str>) -> Pin<Box<dyn Future<Output = Result<(), Error>>>>;
fn upload_file(&self, pet_id: i64, additional_metadata: Option<&str>, file: Option<std::path::PathBuf>) -> Pin<Box<dyn Future<Output = Result<crate::models::ApiResponse, Error>>>>;
fn update_pet_with_form(&self, petid: i64, name: Option<&str>, status: Option<&str>) -> Pin<Box<dyn Future<Output = Result<(), Error>>>>;
fn upload_file(&self, petid: i64, additionalmetadata: Option<&str>, file: Option<std::path::PathBuf>) -> Pin<Box<dyn Future<Output = Result<crate::models::ApiResponse, Error>>>>;
}
impl<C: hyper::client::connect::Connect>PetApi for PetApiClient<C>
@ -58,11 +58,11 @@ impl<C: hyper::client::connect::Connect>PetApi for PetApiClient<C>
}
#[allow(unused_mut)]
fn delete_pet(&self, pet_id: i64, api_key: Option<&str>) -> Pin<Box<dyn Future<Output = Result<(), Error>>>> {
fn delete_pet(&self, petid: i64, api_key: Option<&str>) -> Pin<Box<dyn Future<Output = Result<(), Error>>>> {
let mut req = __internal_request::Request::new(hyper::Method::DELETE, "/pet/{petId}".to_string())
.with_auth(__internal_request::Auth::Oauth)
;
req = req.with_path_param("petId".to_string(), pet_id.to_string());
req = req.with_path_param("petId".to_string(), petid.to_string());
if let Some(param_value) = api_key {
req = req.with_header_param("api_key".to_string(), param_value.to_string());
}
@ -92,7 +92,7 @@ impl<C: hyper::client::connect::Connect>PetApi for PetApiClient<C>
}
#[allow(unused_mut)]
fn get_pet_by_id(&self, pet_id: i64) -> Pin<Box<dyn Future<Output = Result<crate::models::Pet, Error>>>> {
fn get_pet_by_id(&self, petid: i64) -> Pin<Box<dyn Future<Output = Result<crate::models::Pet, Error>>>> {
let mut req = __internal_request::Request::new(hyper::Method::GET, "/pet/{petId}".to_string())
.with_auth(__internal_request::Auth::ApiKey(__internal_request::ApiKey{
in_header: true,
@ -100,7 +100,7 @@ impl<C: hyper::client::connect::Connect>PetApi for PetApiClient<C>
param_name: "api_key".to_owned(),
}))
;
req = req.with_path_param("petId".to_string(), pet_id.to_string());
req = req.with_path_param("petId".to_string(), petid.to_string());
req.execute(self.configuration.borrow())
}
@ -116,11 +116,11 @@ impl<C: hyper::client::connect::Connect>PetApi for PetApiClient<C>
}
#[allow(unused_mut)]
fn update_pet_with_form(&self, pet_id: i64, name: Option<&str>, status: Option<&str>) -> Pin<Box<dyn Future<Output = Result<(), Error>>>> {
fn update_pet_with_form(&self, petid: i64, name: Option<&str>, status: Option<&str>) -> Pin<Box<dyn Future<Output = Result<(), Error>>>> {
let mut req = __internal_request::Request::new(hyper::Method::POST, "/pet/{petId}".to_string())
.with_auth(__internal_request::Auth::Oauth)
;
req = req.with_path_param("petId".to_string(), pet_id.to_string());
req = req.with_path_param("petId".to_string(), petid.to_string());
if let Some(param_value) = name {
req = req.with_form_param("name".to_string(), param_value.to_string());
}
@ -133,12 +133,12 @@ impl<C: hyper::client::connect::Connect>PetApi for PetApiClient<C>
}
#[allow(unused_mut)]
fn upload_file(&self, pet_id: i64, additional_metadata: Option<&str>, file: Option<std::path::PathBuf>) -> Pin<Box<dyn Future<Output = Result<crate::models::ApiResponse, Error>>>> {
fn upload_file(&self, petid: i64, additionalmetadata: Option<&str>, file: Option<std::path::PathBuf>) -> Pin<Box<dyn Future<Output = Result<crate::models::ApiResponse, Error>>>> {
let mut req = __internal_request::Request::new(hyper::Method::POST, "/pet/{petId}/uploadImage".to_string())
.with_auth(__internal_request::Auth::Oauth)
;
req = req.with_path_param("petId".to_string(), pet_id.to_string());
if let Some(param_value) = additional_metadata {
req = req.with_path_param("petId".to_string(), petid.to_string());
if let Some(param_value) = additionalmetadata {
req = req.with_form_param("additionalMetadata".to_string(), param_value.to_string());
}
if let Some(param_value) = file {

View File

@ -35,19 +35,19 @@ impl<C: hyper::client::connect::Connect> StoreApiClient<C>
}
pub trait StoreApi {
fn delete_order(&self, order_id: &str) -> Pin<Box<dyn Future<Output = Result<(), Error>>>>;
fn delete_order(&self, orderid: &str) -> Pin<Box<dyn Future<Output = Result<(), Error>>>>;
fn get_inventory(&self, ) -> Pin<Box<dyn Future<Output = Result<::std::collections::HashMap<String, i32>, Error>>>>;
fn get_order_by_id(&self, order_id: i64) -> Pin<Box<dyn Future<Output = Result<crate::models::Order, Error>>>>;
fn get_order_by_id(&self, orderid: i64) -> Pin<Box<dyn Future<Output = Result<crate::models::Order, Error>>>>;
fn place_order(&self, order: crate::models::Order) -> Pin<Box<dyn Future<Output = Result<crate::models::Order, Error>>>>;
}
impl<C: hyper::client::connect::Connect>StoreApi for StoreApiClient<C>
where C: Clone + std::marker::Send + Sync {
#[allow(unused_mut)]
fn delete_order(&self, order_id: &str) -> Pin<Box<dyn Future<Output = Result<(), Error>>>> {
fn delete_order(&self, orderid: &str) -> Pin<Box<dyn Future<Output = Result<(), Error>>>> {
let mut req = __internal_request::Request::new(hyper::Method::DELETE, "/store/order/{orderId}".to_string())
;
req = req.with_path_param("orderId".to_string(), order_id.to_string());
req = req.with_path_param("orderId".to_string(), orderid.to_string());
req = req.returns_nothing();
req.execute(self.configuration.borrow())
@ -67,10 +67,10 @@ impl<C: hyper::client::connect::Connect>StoreApi for StoreApiClient<C>
}
#[allow(unused_mut)]
fn get_order_by_id(&self, order_id: i64) -> Pin<Box<dyn Future<Output = Result<crate::models::Order, Error>>>> {
fn get_order_by_id(&self, orderid: i64) -> Pin<Box<dyn Future<Output = Result<crate::models::Order, Error>>>> {
let mut req = __internal_request::Request::new(hyper::Method::GET, "/store/order/{orderId}".to_string())
;
req = req.with_path_param("orderId".to_string(), order_id.to_string());
req = req.with_path_param("orderId".to_string(), orderid.to_string());
req.execute(self.configuration.borrow())
}

View File

@ -47,7 +47,7 @@ Name | Type | Description | Required | Notes
## delete_pet
> delete_pet(pet_id, api_key)
> delete_pet(petid, api_key)
Deletes a pet
@ -57,7 +57,7 @@ Deletes a pet
Name | Type | Description | Required | Notes
------------- | ------------- | ------------- | ------------- | -------------
**pet_id** | **i64** | Pet id to delete | [required] |
**petid** | **i64** | Pet id to delete | [required] |
**api_key** | Option<**String**> | | |
### Return type
@ -138,7 +138,7 @@ Name | Type | Description | Required | Notes
## get_pet_by_id
> crate::models::Pet get_pet_by_id(pet_id)
> crate::models::Pet get_pet_by_id(petid)
Find pet by ID
Returns a single pet
@ -148,7 +148,7 @@ Returns a single pet
Name | Type | Description | Required | Notes
------------- | ------------- | ------------- | ------------- | -------------
**pet_id** | **i64** | ID of pet to return | [required] |
**petid** | **i64** | ID of pet to return | [required] |
### Return type
@ -198,7 +198,7 @@ Name | Type | Description | Required | Notes
## update_pet_with_form
> update_pet_with_form(pet_id, name, status)
> update_pet_with_form(petid, name, status)
Updates a pet in the store with form data
@ -208,7 +208,7 @@ Updates a pet in the store with form data
Name | Type | Description | Required | Notes
------------- | ------------- | ------------- | ------------- | -------------
**pet_id** | **i64** | ID of pet that needs to be updated | [required] |
**petid** | **i64** | ID of pet that needs to be updated | [required] |
**name** | Option<**String**> | Updated name of the pet | |
**status** | Option<**String**> | Updated status of the pet | |
@ -230,7 +230,7 @@ Name | Type | Description | Required | Notes
## upload_file
> crate::models::ApiResponse upload_file(pet_id, additional_metadata, file)
> crate::models::ApiResponse upload_file(petid, additionalmetadata, file)
uploads an image
@ -240,8 +240,8 @@ uploads an image
Name | Type | Description | Required | Notes
------------- | ------------- | ------------- | ------------- | -------------
**pet_id** | **i64** | ID of pet to update | [required] |
**additional_metadata** | Option<**String**> | Additional data to pass to server | |
**petid** | **i64** | ID of pet to update | [required] |
**additionalmetadata** | Option<**String**> | Additional data to pass to server | |
**file** | Option<**std::path::PathBuf**> | file to upload | |
### Return type

View File

@ -13,7 +13,7 @@ Method | HTTP request | Description
## delete_order
> delete_order(order_id)
> delete_order(orderid)
Delete purchase order by ID
For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors
@ -23,7 +23,7 @@ For valid response try integer IDs with value < 1000. Anything above 1000 or non
Name | Type | Description | Required | Notes
------------- | ------------- | ------------- | ------------- | -------------
**order_id** | **String** | ID of the order that needs to be deleted | [required] |
**orderid** | **String** | ID of the order that needs to be deleted | [required] |
### Return type
@ -70,7 +70,7 @@ This endpoint does not need any parameter.
## get_order_by_id
> crate::models::Order get_order_by_id(order_id)
> crate::models::Order get_order_by_id(orderid)
Find purchase order by ID
For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions
@ -80,7 +80,7 @@ For valid response try integer IDs with value <= 5 or > 10. Other values will ge
Name | Type | Description | Required | Notes
------------- | ------------- | ------------- | ------------- | -------------
**order_id** | **i64** | ID of pet that needs to be fetched | [required] |
**orderid** | **i64** | ID of pet that needs to be fetched | [required] |
### Return type

View File

@ -25,7 +25,7 @@ pub struct AddPetParams {
#[derive(Clone, Debug, Default)]
pub struct DeletePetParams {
/// Pet id to delete
pub pet_id: i64,
pub petid: i64,
pub api_key: Option<String>
}
@ -47,7 +47,7 @@ pub struct FindPetsByTagsParams {
#[derive(Clone, Debug, Default)]
pub struct GetPetByIdParams {
/// ID of pet to return
pub pet_id: i64
pub petid: i64
}
/// struct for passing parameters to the method [`update_pet`]
@ -61,7 +61,7 @@ pub struct UpdatePetParams {
#[derive(Clone, Debug, Default)]
pub struct UpdatePetWithFormParams {
/// ID of pet that needs to be updated
pub pet_id: i64,
pub petid: i64,
/// Updated name of the pet
pub name: Option<String>,
/// Updated status of the pet
@ -72,9 +72,9 @@ pub struct UpdatePetWithFormParams {
#[derive(Clone, Debug, Default)]
pub struct UploadFileParams {
/// ID of pet to update
pub pet_id: i64,
pub petid: i64,
/// Additional data to pass to server
pub additional_metadata: Option<String>,
pub additionalmetadata: Option<String>,
/// file to upload
pub file: Option<std::path::PathBuf>
}
@ -252,13 +252,13 @@ pub async fn delete_pet(configuration: &configuration::Configuration, params: De
let local_var_configuration = configuration;
// unbox the parameters
let pet_id = params.pet_id;
let petid = params.petid;
let api_key = params.api_key;
let local_var_client = &local_var_configuration.client;
let local_var_uri_str = format!("{}/pet/{petId}", local_var_configuration.base_path, petId=pet_id);
let local_var_uri_str = format!("{}/pet/{petId}", local_var_configuration.base_path, petId=petid);
let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str());
if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
@ -375,12 +375,12 @@ pub async fn get_pet_by_id(configuration: &configuration::Configuration, params:
let local_var_configuration = configuration;
// unbox the parameters
let pet_id = params.pet_id;
let petid = params.petid;
let local_var_client = &local_var_configuration.client;
let local_var_uri_str = format!("{}/pet/{petId}", local_var_configuration.base_path, petId=pet_id);
let local_var_uri_str = format!("{}/pet/{petId}", local_var_configuration.base_path, petId=petid);
let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
@ -455,14 +455,14 @@ pub async fn update_pet_with_form(configuration: &configuration::Configuration,
let local_var_configuration = configuration;
// unbox the parameters
let pet_id = params.pet_id;
let petid = params.petid;
let name = params.name;
let status = params.status;
let local_var_client = &local_var_configuration.client;
let local_var_uri_str = format!("{}/pet/{petId}", local_var_configuration.base_path, petId=pet_id);
let local_var_uri_str = format!("{}/pet/{petId}", local_var_configuration.base_path, petId=petid);
let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
@ -502,14 +502,14 @@ pub async fn upload_file(configuration: &configuration::Configuration, params: U
let local_var_configuration = configuration;
// unbox the parameters
let pet_id = params.pet_id;
let additional_metadata = params.additional_metadata;
let petid = params.petid;
let additionalmetadata = params.additionalmetadata;
let file = params.file;
let local_var_client = &local_var_configuration.client;
let local_var_uri_str = format!("{}/pet/{petId}/uploadImage", local_var_configuration.base_path, petId=pet_id);
let local_var_uri_str = format!("{}/pet/{petId}/uploadImage", local_var_configuration.base_path, petId=petid);
let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
@ -519,7 +519,7 @@ pub async fn upload_file(configuration: &configuration::Configuration, params: U
local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
};
let mut local_var_form = reqwest::multipart::Form::new();
if let Some(local_var_param_value) = additional_metadata {
if let Some(local_var_param_value) = additionalmetadata {
local_var_form = local_var_form.text("additionalMetadata", local_var_param_value.to_string());
}
// TODO: support file upload for 'file' parameter

View File

@ -18,14 +18,14 @@ use super::{Error, configuration};
#[derive(Clone, Debug, Default)]
pub struct DeleteOrderParams {
/// ID of the order that needs to be deleted
pub order_id: String
pub orderid: String
}
/// struct for passing parameters to the method [`get_order_by_id`]
#[derive(Clone, Debug, Default)]
pub struct GetOrderByIdParams {
/// ID of pet that needs to be fetched
pub order_id: i64
pub orderid: i64
}
/// struct for passing parameters to the method [`place_order`]
@ -106,12 +106,12 @@ pub async fn delete_order(configuration: &configuration::Configuration, params:
let local_var_configuration = configuration;
// unbox the parameters
let order_id = params.order_id;
let orderid = params.orderid;
let local_var_client = &local_var_configuration.client;
let local_var_uri_str = format!("{}/store/order/{orderId}", local_var_configuration.base_path, orderId=crate::apis::urlencode(order_id));
let local_var_uri_str = format!("{}/store/order/{orderId}", local_var_configuration.base_path, orderId=crate::apis::urlencode(orderid));
let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str());
if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
@ -181,12 +181,12 @@ pub async fn get_order_by_id(configuration: &configuration::Configuration, param
let local_var_configuration = configuration;
// unbox the parameters
let order_id = params.order_id;
let orderid = params.orderid;
let local_var_client = &local_var_configuration.client;
let local_var_uri_str = format!("{}/store/order/{orderId}", local_var_configuration.base_path, orderId=order_id);
let local_var_uri_str = format!("{}/store/order/{orderId}", local_var_configuration.base_path, orderId=orderid);
let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {

View File

@ -47,7 +47,7 @@ Name | Type | Description | Required | Notes
## delete_pet
> delete_pet(pet_id, api_key)
> delete_pet(petid, api_key)
Deletes a pet
@ -57,7 +57,7 @@ Deletes a pet
Name | Type | Description | Required | Notes
------------- | ------------- | ------------- | ------------- | -------------
**pet_id** | **i64** | Pet id to delete | [required] |
**petid** | **i64** | Pet id to delete | [required] |
**api_key** | Option<**String**> | | |
### Return type
@ -138,7 +138,7 @@ Name | Type | Description | Required | Notes
## get_pet_by_id
> crate::models::Pet get_pet_by_id(pet_id)
> crate::models::Pet get_pet_by_id(petid)
Find pet by ID
Returns a single pet
@ -148,7 +148,7 @@ Returns a single pet
Name | Type | Description | Required | Notes
------------- | ------------- | ------------- | ------------- | -------------
**pet_id** | **i64** | ID of pet to return | [required] |
**petid** | **i64** | ID of pet to return | [required] |
### Return type
@ -198,7 +198,7 @@ Name | Type | Description | Required | Notes
## update_pet_with_form
> update_pet_with_form(pet_id, name, status)
> update_pet_with_form(petid, name, status)
Updates a pet in the store with form data
@ -208,7 +208,7 @@ Updates a pet in the store with form data
Name | Type | Description | Required | Notes
------------- | ------------- | ------------- | ------------- | -------------
**pet_id** | **i64** | ID of pet that needs to be updated | [required] |
**petid** | **i64** | ID of pet that needs to be updated | [required] |
**name** | Option<**String**> | Updated name of the pet | |
**status** | Option<**String**> | Updated status of the pet | |
@ -230,7 +230,7 @@ Name | Type | Description | Required | Notes
## upload_file
> crate::models::ApiResponse upload_file(pet_id, additional_metadata, file)
> crate::models::ApiResponse upload_file(petid, additionalmetadata, file)
uploads an image
@ -240,8 +240,8 @@ uploads an image
Name | Type | Description | Required | Notes
------------- | ------------- | ------------- | ------------- | -------------
**pet_id** | **i64** | ID of pet to update | [required] |
**additional_metadata** | Option<**String**> | Additional data to pass to server | |
**petid** | **i64** | ID of pet to update | [required] |
**additionalmetadata** | Option<**String**> | Additional data to pass to server | |
**file** | Option<**std::path::PathBuf**> | file to upload | |
### Return type

View File

@ -13,7 +13,7 @@ Method | HTTP request | Description
## delete_order
> delete_order(order_id)
> delete_order(orderid)
Delete purchase order by ID
For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors
@ -23,7 +23,7 @@ For valid response try integer IDs with value < 1000. Anything above 1000 or non
Name | Type | Description | Required | Notes
------------- | ------------- | ------------- | ------------- | -------------
**order_id** | **String** | ID of the order that needs to be deleted | [required] |
**orderid** | **String** | ID of the order that needs to be deleted | [required] |
### Return type
@ -70,7 +70,7 @@ This endpoint does not need any parameter.
## get_order_by_id
> crate::models::Order get_order_by_id(order_id)
> crate::models::Order get_order_by_id(orderid)
Find purchase order by ID
For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions
@ -80,7 +80,7 @@ For valid response try integer IDs with value <= 5 or > 10. Other values will ge
Name | Type | Description | Required | Notes
------------- | ------------- | ------------- | ------------- | -------------
**order_id** | **i64** | ID of pet that needs to be fetched | [required] |
**orderid** | **i64** | ID of pet that needs to be fetched | [required] |
### Return type

View File

@ -128,12 +128,12 @@ pub fn add_pet(configuration: &configuration::Configuration, pet: crate::models:
}
///
pub fn delete_pet(configuration: &configuration::Configuration, pet_id: i64, api_key: Option<&str>) -> Result<(), Error<DeletePetError>> {
pub fn delete_pet(configuration: &configuration::Configuration, petid: i64, api_key: Option<&str>) -> Result<(), Error<DeletePetError>> {
let local_var_configuration = configuration;
let local_var_client = &local_var_configuration.client;
let local_var_uri_str = format!("{}/pet/{petId}", local_var_configuration.base_path, petId=pet_id);
let local_var_uri_str = format!("{}/pet/{petId}", local_var_configuration.base_path, petId=petid);
let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str());
if let Some(ref local_var_aws_v4_key) = local_var_configuration.aws_v4_key {
@ -271,12 +271,12 @@ pub fn find_pets_by_tags(configuration: &configuration::Configuration, tags: Vec
}
/// Returns a single pet
pub fn get_pet_by_id(configuration: &configuration::Configuration, pet_id: i64) -> Result<crate::models::Pet, Error<GetPetByIdError>> {
pub fn get_pet_by_id(configuration: &configuration::Configuration, petid: i64) -> Result<crate::models::Pet, Error<GetPetByIdError>> {
let local_var_configuration = configuration;
let local_var_client = &local_var_configuration.client;
let local_var_uri_str = format!("{}/pet/{petId}", local_var_configuration.base_path, petId=pet_id);
let local_var_uri_str = format!("{}/pet/{petId}", local_var_configuration.base_path, petId=petid);
let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
if let Some(ref local_var_aws_v4_key) = local_var_configuration.aws_v4_key {
@ -365,12 +365,12 @@ pub fn update_pet(configuration: &configuration::Configuration, pet: crate::mode
}
///
pub fn update_pet_with_form(configuration: &configuration::Configuration, pet_id: i64, name: Option<&str>, status: Option<&str>) -> Result<(), Error<UpdatePetWithFormError>> {
pub fn update_pet_with_form(configuration: &configuration::Configuration, petid: i64, name: Option<&str>, status: Option<&str>) -> Result<(), Error<UpdatePetWithFormError>> {
let local_var_configuration = configuration;
let local_var_client = &local_var_configuration.client;
let local_var_uri_str = format!("{}/pet/{petId}", local_var_configuration.base_path, petId=pet_id);
let local_var_uri_str = format!("{}/pet/{petId}", local_var_configuration.base_path, petId=petid);
let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
if let Some(ref local_var_aws_v4_key) = local_var_configuration.aws_v4_key {
@ -417,12 +417,12 @@ pub fn update_pet_with_form(configuration: &configuration::Configuration, pet_id
}
///
pub fn upload_file(configuration: &configuration::Configuration, pet_id: i64, additional_metadata: Option<&str>, file: Option<std::path::PathBuf>) -> Result<crate::models::ApiResponse, Error<UploadFileError>> {
pub fn upload_file(configuration: &configuration::Configuration, petid: i64, additionalmetadata: Option<&str>, file: Option<std::path::PathBuf>) -> Result<crate::models::ApiResponse, Error<UploadFileError>> {
let local_var_configuration = configuration;
let local_var_client = &local_var_configuration.client;
let local_var_uri_str = format!("{}/pet/{petId}/uploadImage", local_var_configuration.base_path, petId=pet_id);
let local_var_uri_str = format!("{}/pet/{petId}/uploadImage", local_var_configuration.base_path, petId=petid);
let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
if let Some(ref local_var_aws_v4_key) = local_var_configuration.aws_v4_key {
@ -445,7 +445,7 @@ pub fn upload_file(configuration: &configuration::Configuration, pet_id: i64, ad
local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
};
let mut local_var_form = reqwest::multipart::Form::new();
if let Some(local_var_param_value) = additional_metadata {
if let Some(local_var_param_value) = additionalmetadata {
local_var_form = local_var_form.text("additionalMetadata", local_var_param_value.to_string());
}
if let Some(local_var_param_value) = file {

View File

@ -50,12 +50,12 @@ pub enum PlaceOrderError {
/// For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors
pub fn delete_order(configuration: &configuration::Configuration, order_id: &str) -> Result<(), Error<DeleteOrderError>> {
pub fn delete_order(configuration: &configuration::Configuration, orderid: &str) -> Result<(), Error<DeleteOrderError>> {
let local_var_configuration = configuration;
let local_var_client = &local_var_configuration.client;
let local_var_uri_str = format!("{}/store/order/{orderId}", local_var_configuration.base_path, orderId=crate::apis::urlencode(order_id));
let local_var_uri_str = format!("{}/store/order/{orderId}", local_var_configuration.base_path, orderId=crate::apis::urlencode(orderid));
let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str());
if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
@ -127,12 +127,12 @@ pub fn get_inventory(configuration: &configuration::Configuration, ) -> Result<:
}
/// For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions
pub fn get_order_by_id(configuration: &configuration::Configuration, order_id: i64) -> Result<crate::models::Order, Error<GetOrderByIdError>> {
pub fn get_order_by_id(configuration: &configuration::Configuration, orderid: i64) -> Result<crate::models::Order, Error<GetOrderByIdError>> {
let local_var_configuration = configuration;
let local_var_client = &local_var_configuration.client;
let local_var_uri_str = format!("{}/store/order/{orderId}", local_var_configuration.base_path, orderId=order_id);
let local_var_uri_str = format!("{}/store/order/{orderId}", local_var_configuration.base_path, orderId=orderid);
let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {

View File

@ -47,7 +47,7 @@ Name | Type | Description | Required | Notes
## delete_pet
> delete_pet(pet_id, api_key)
> delete_pet(petid, api_key)
Deletes a pet
@ -57,7 +57,7 @@ Deletes a pet
Name | Type | Description | Required | Notes
------------- | ------------- | ------------- | ------------- | -------------
**pet_id** | **i64** | Pet id to delete | [required] |
**petid** | **i64** | Pet id to delete | [required] |
**api_key** | Option<**String**> | | |
### Return type
@ -138,7 +138,7 @@ Name | Type | Description | Required | Notes
## get_pet_by_id
> crate::models::Pet get_pet_by_id(pet_id)
> crate::models::Pet get_pet_by_id(petid)
Find pet by ID
Returns a single pet
@ -148,7 +148,7 @@ Returns a single pet
Name | Type | Description | Required | Notes
------------- | ------------- | ------------- | ------------- | -------------
**pet_id** | **i64** | ID of pet to return | [required] |
**petid** | **i64** | ID of pet to return | [required] |
### Return type
@ -198,7 +198,7 @@ Name | Type | Description | Required | Notes
## update_pet_with_form
> update_pet_with_form(pet_id, name, status)
> update_pet_with_form(petid, name, status)
Updates a pet in the store with form data
@ -208,7 +208,7 @@ Updates a pet in the store with form data
Name | Type | Description | Required | Notes
------------- | ------------- | ------------- | ------------- | -------------
**pet_id** | **i64** | ID of pet that needs to be updated | [required] |
**petid** | **i64** | ID of pet that needs to be updated | [required] |
**name** | Option<**String**> | Updated name of the pet | |
**status** | Option<**String**> | Updated status of the pet | |
@ -230,7 +230,7 @@ Name | Type | Description | Required | Notes
## upload_file
> crate::models::ApiResponse upload_file(pet_id, additional_metadata, file)
> crate::models::ApiResponse upload_file(petid, additionalmetadata, file)
uploads an image
@ -240,8 +240,8 @@ uploads an image
Name | Type | Description | Required | Notes
------------- | ------------- | ------------- | ------------- | -------------
**pet_id** | **i64** | ID of pet to update | [required] |
**additional_metadata** | Option<**String**> | Additional data to pass to server | |
**petid** | **i64** | ID of pet to update | [required] |
**additionalmetadata** | Option<**String**> | Additional data to pass to server | |
**file** | Option<**std::path::PathBuf**> | file to upload | |
### Return type

View File

@ -13,7 +13,7 @@ Method | HTTP request | Description
## delete_order
> delete_order(order_id)
> delete_order(orderid)
Delete purchase order by ID
For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors
@ -23,7 +23,7 @@ For valid response try integer IDs with value < 1000. Anything above 1000 or non
Name | Type | Description | Required | Notes
------------- | ------------- | ------------- | ------------- | -------------
**order_id** | **String** | ID of the order that needs to be deleted | [required] |
**orderid** | **String** | ID of the order that needs to be deleted | [required] |
### Return type
@ -70,7 +70,7 @@ This endpoint does not need any parameter.
## get_order_by_id
> crate::models::Order get_order_by_id(order_id)
> crate::models::Order get_order_by_id(orderid)
Find purchase order by ID
For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions
@ -80,7 +80,7 @@ For valid response try integer IDs with value <= 5 or > 10. Other values will ge
Name | Type | Description | Required | Notes
------------- | ------------- | ------------- | ------------- | -------------
**order_id** | **i64** | ID of pet that needs to be fetched | [required] |
**orderid** | **i64** | ID of pet that needs to be fetched | [required] |
### Return type

View File

@ -115,12 +115,12 @@ pub fn add_pet(configuration: &configuration::Configuration, pet: crate::models:
}
///
pub fn delete_pet(configuration: &configuration::Configuration, pet_id: i64, api_key: Option<&str>) -> Result<(), Error<DeletePetError>> {
pub fn delete_pet(configuration: &configuration::Configuration, petid: i64, api_key: Option<&str>) -> Result<(), Error<DeletePetError>> {
let local_var_configuration = configuration;
let local_var_client = &local_var_configuration.client;
let local_var_uri_str = format!("{}/pet/{petId}", local_var_configuration.base_path, petId=pet_id);
let local_var_uri_str = format!("{}/pet/{petId}", local_var_configuration.base_path, petId=petid);
let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str());
if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
@ -219,12 +219,12 @@ pub fn find_pets_by_tags(configuration: &configuration::Configuration, tags: Vec
}
/// Returns a single pet
pub fn get_pet_by_id(configuration: &configuration::Configuration, pet_id: i64) -> Result<crate::models::Pet, Error<GetPetByIdError>> {
pub fn get_pet_by_id(configuration: &configuration::Configuration, petid: i64) -> Result<crate::models::Pet, Error<GetPetByIdError>> {
let local_var_configuration = configuration;
let local_var_client = &local_var_configuration.client;
let local_var_uri_str = format!("{}/pet/{petId}", local_var_configuration.base_path, petId=pet_id);
let local_var_uri_str = format!("{}/pet/{petId}", local_var_configuration.base_path, petId=petid);
let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
@ -287,12 +287,12 @@ pub fn update_pet(configuration: &configuration::Configuration, pet: crate::mode
}
///
pub fn update_pet_with_form(configuration: &configuration::Configuration, pet_id: i64, name: Option<&str>, status: Option<&str>) -> Result<(), Error<UpdatePetWithFormError>> {
pub fn update_pet_with_form(configuration: &configuration::Configuration, petid: i64, name: Option<&str>, status: Option<&str>) -> Result<(), Error<UpdatePetWithFormError>> {
let local_var_configuration = configuration;
let local_var_client = &local_var_configuration.client;
let local_var_uri_str = format!("{}/pet/{petId}", local_var_configuration.base_path, petId=pet_id);
let local_var_uri_str = format!("{}/pet/{petId}", local_var_configuration.base_path, petId=petid);
let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
@ -326,12 +326,12 @@ pub fn update_pet_with_form(configuration: &configuration::Configuration, pet_id
}
///
pub fn upload_file(configuration: &configuration::Configuration, pet_id: i64, additional_metadata: Option<&str>, file: Option<std::path::PathBuf>) -> Result<crate::models::ApiResponse, Error<UploadFileError>> {
pub fn upload_file(configuration: &configuration::Configuration, petid: i64, additionalmetadata: Option<&str>, file: Option<std::path::PathBuf>) -> Result<crate::models::ApiResponse, Error<UploadFileError>> {
let local_var_configuration = configuration;
let local_var_client = &local_var_configuration.client;
let local_var_uri_str = format!("{}/pet/{petId}/uploadImage", local_var_configuration.base_path, petId=pet_id);
let local_var_uri_str = format!("{}/pet/{petId}/uploadImage", local_var_configuration.base_path, petId=petid);
let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
@ -341,7 +341,7 @@ pub fn upload_file(configuration: &configuration::Configuration, pet_id: i64, ad
local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
};
let mut local_var_form = reqwest::multipart::Form::new();
if let Some(local_var_param_value) = additional_metadata {
if let Some(local_var_param_value) = additionalmetadata {
local_var_form = local_var_form.text("additionalMetadata", local_var_param_value.to_string());
}
if let Some(local_var_param_value) = file {

View File

@ -50,12 +50,12 @@ pub enum PlaceOrderError {
/// For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors
pub fn delete_order(configuration: &configuration::Configuration, order_id: &str) -> Result<(), Error<DeleteOrderError>> {
pub fn delete_order(configuration: &configuration::Configuration, orderid: &str) -> Result<(), Error<DeleteOrderError>> {
let local_var_configuration = configuration;
let local_var_client = &local_var_configuration.client;
let local_var_uri_str = format!("{}/store/order/{orderId}", local_var_configuration.base_path, orderId=crate::apis::urlencode(order_id));
let local_var_uri_str = format!("{}/store/order/{orderId}", local_var_configuration.base_path, orderId=crate::apis::urlencode(orderid));
let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str());
if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
@ -114,12 +114,12 @@ pub fn get_inventory(configuration: &configuration::Configuration, ) -> Result<:
}
/// For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions
pub fn get_order_by_id(configuration: &configuration::Configuration, order_id: i64) -> Result<crate::models::Order, Error<GetOrderByIdError>> {
pub fn get_order_by_id(configuration: &configuration::Configuration, orderid: i64) -> Result<crate::models::Order, Error<GetOrderByIdError>> {
let local_var_configuration = configuration;
let local_var_client = &local_var_configuration.client;
let local_var_uri_str = format!("{}/store/order/{orderId}", local_var_configuration.base_path, orderId=order_id);
let local_var_uri_str = format!("{}/store/order/{orderId}", local_var_configuration.base_path, orderId=orderid);
let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {