[C++][Pistache] Rename value holder to lower chance of collision with parameter name (#4948)

* [C++][Pistache] Rename value holder to lower chance of collision with parameter name

* [C++][Pistache] Update Petstore sample
This commit is contained in:
Mateusz Szychowski (Muttley)
2020-01-21 00:47:26 +01:00
committed by sunn
parent 2bc3c196e8
commit 6af27d52ca
4 changed files with 16 additions and 16 deletions

View File

@@ -54,9 +54,9 @@ void {{classname}}::{{operationIdSnakeCase}}_handler(const Pistache::Rest::Reque
auto {{paramName}}Query = request.query().get("{{baseName}}");
Pistache::Optional<{{^isContainer}}{{dataType}}{{/isContainer}}{{#isListContainer}}std::vector<{{items.baseType}}>{{/isListContainer}}> {{paramName}};
if(!{{paramName}}Query.isEmpty()){
{{^isContainer}}{{dataType}}{{/isContainer}}{{#isListContainer}}std::vector<{{items.baseType}}>{{/isListContainer}} value;
if(fromStringValue({{paramName}}Query.get(), value)){
{{paramName}} = Pistache::Some(value);
{{^isContainer}}{{dataType}}{{/isContainer}}{{#isListContainer}}std::vector<{{items.baseType}}>{{/isListContainer}} valueQuery_instance;
if(fromStringValue({{paramName}}Query.get(), valueQuery_instance)){
{{paramName}} = Pistache::Some(valueQuery_instance);
}
}
{{/queryParams}}

View File

@@ -1 +1 @@
4.2.2-SNAPSHOT
4.2.3-SNAPSHOT

View File

@@ -91,9 +91,9 @@ void PetApi::find_pets_by_status_handler(const Pistache::Rest::Request &request,
auto statusQuery = request.query().get("status");
Pistache::Optional<std::vector<std::string>> status;
if(!statusQuery.isEmpty()){
std::vector<std::string> value;
if(fromStringValue(statusQuery.get(), value)){
status = Pistache::Some(value);
std::vector<std::string> valueQuery_instance;
if(fromStringValue(statusQuery.get(), valueQuery_instance)){
status = Pistache::Some(valueQuery_instance);
}
}
@@ -116,9 +116,9 @@ void PetApi::find_pets_by_tags_handler(const Pistache::Rest::Request &request, P
auto tagsQuery = request.query().get("tags");
Pistache::Optional<std::vector<std::string>> tags;
if(!tagsQuery.isEmpty()){
std::vector<std::string> value;
if(fromStringValue(tagsQuery.get(), value)){
tags = Pistache::Some(value);
std::vector<std::string> valueQuery_instance;
if(fromStringValue(tagsQuery.get(), valueQuery_instance)){
tags = Pistache::Some(valueQuery_instance);
}
}

View File

@@ -143,17 +143,17 @@ void UserApi::login_user_handler(const Pistache::Rest::Request &request, Pistach
auto usernameQuery = request.query().get("username");
Pistache::Optional<std::string> username;
if(!usernameQuery.isEmpty()){
std::string value;
if(fromStringValue(usernameQuery.get(), value)){
username = Pistache::Some(value);
std::string valueQuery_instance;
if(fromStringValue(usernameQuery.get(), valueQuery_instance)){
username = Pistache::Some(valueQuery_instance);
}
}
auto passwordQuery = request.query().get("password");
Pistache::Optional<std::string> password;
if(!passwordQuery.isEmpty()){
std::string value;
if(fromStringValue(passwordQuery.get(), value)){
password = Pistache::Some(value);
std::string valueQuery_instance;
if(fromStringValue(passwordQuery.get(), valueQuery_instance)){
password = Pistache::Some(valueQuery_instance);
}
}