You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[Optional] Sponsorship to speed up the bug fix or feature request (example)
Description
I defined a schema object type enum in yaml file as per the reusable enum samples docs/data-models/enums and generated the cpprestsdk API client library. Getting a compilation error while upon compiling the API client library.
cd test
cmake -DCPPREST_ROOT=/usr -DCMAKE_CXX_FLAGS="-I/usr/local/opt/openssl/include" -DCMAKE_MODULE_LINKER_FLAGS="-L/usr/local/opt/openssl/lib"
make
Error Log
The generated client code cannot match the template parameterToString() conversion for enums.
In file included from /test/api/DefaultApi.cpp:13:
In file included from /test/api/DefaultApi.h:22:
/test/api/../ApiClient.h:104:12: error: use of undeclared identifier 'parameterToString'
return parameterToString(*value.get());
^
/test/api/DefaultApi.cpp:86:86: note: in instantiation of function template specialization
'org::openapitools::client::api::ApiClient::parameterToString<org::openapitools::client::model::Color>' requested here
localVarQueryParams[utility::conversions::to_string_t("color")] = ApiClient::parameterToString(color);
^
/test/api/../ApiClient.h:59:30: note: must qualify identifier to find this declaration in dependent base class
static utility::string_t parameterToString(utility::string_t value);
^
/test/api/../ApiClient.h:60:30: note: must qualify identifier to find this declaration in dependent base class
static utility::string_t parameterToString(int32_t value);
^
/test/api/../ApiClient.h:61:30: note: must qualify identifier to find this declaration in dependent base class
static utility::string_t parameterToString(int64_t value);
^
/test/api/../ApiClient.h:62:30: note: must qualify identifier to find this declaration in dependent base class
static utility::string_t parameterToString(float value);
^
/test/api/../ApiClient.h:63:30: note: must qualify identifier to find this declaration in dependent base class
static utility::string_t parameterToString(double value);
^
/test/api/../ApiClient.h:64:30: note: must qualify identifier to find this declaration in dependent base class
static utility::string_t parameterToString(const utility::datetime &value);
^
/test/api/../ApiClient.h:88:30: note: must qualify identifier to find this declaration in dependent base class
utility::string_t ApiClient::parameterToString(const std::vector<T>& value)
^
/test/api/../ApiClient.h:102:30: note: must qualify identifier to find this declaration in dependent base class
utility::string_t ApiClient::parameterToString(const std::shared_ptr<T>& value)
^
/test/api/../ApiClient.h:104:12: error: no matching function for call to 'parameterToString'
return parameterToString(*value.get());
^~~~~~~~~~~~~~~~~
/test/api/../ApiClient.h:59:30: note: candidate function not viable: no known conversion from
'std::__1::shared_ptr<org::openapitools::client::model::Color>::element_type' (aka 'org::openapitools::client::model::Color') to 'utility::string_t' (aka
'basic_string<char, char_traits<char>, allocator<char> >') for 1st argument
static utility::string_t parameterToString(utility::string_t value);
^
/test/api/../ApiClient.h:60:30: note: candidate function not viable: no known conversion from
'std::__1::shared_ptr<org::openapitools::client::model::Color>::element_type' (aka 'org::openapitools::client::model::Color') to 'int32_t' (aka 'int') for 1st argument
static utility::string_t parameterToString(int32_t value);
^
/test/api/../ApiClient.h:61:30: note: candidate function not viable: no known conversion from
'std::__1::shared_ptr<org::openapitools::client::model::Color>::element_type' (aka 'org::openapitools::client::model::Color') to 'int64_t' (aka 'long long') for 1st argument
static utility::string_t parameterToString(int64_t value);
^
/test/api/../ApiClient.h:62:30: note: candidate function not viable: no known conversion from
'std::__1::shared_ptr<org::openapitools::client::model::Color>::element_type' (aka 'org::openapitools::client::model::Color') to 'float' for 1st argument
static utility::string_t parameterToString(float value);
^
/test/api/../ApiClient.h:63:30: note: candidate function not viable: no known conversion from
'std::__1::shared_ptr<org::openapitools::client::model::Color>::element_type' (aka 'org::openapitools::client::model::Color') to 'double' for 1st argument
static utility::string_t parameterToString(double value);
^
/test/api/../ApiClient.h:64:30: note: candidate function not viable: no known conversion from
'std::__1::shared_ptr<org::openapitools::client::model::Color>::element_type' (aka 'org::openapitools::client::model::Color') to 'const utility::datetime' for 1st argument
static utility::string_t parameterToString(const utility::datetime &value);
^
/test/api/../ApiClient.h:88:30: note: candidate template ignored: could not match 'vector<type-parameter-0-0, allocator<type-parameter-0-0> >'
against 'org::openapitools::client::model::Color'
utility::string_t ApiClient::parameterToString(const std::vector<T>& value)
^
/test/api/../ApiClient.h:102:30: note: candidate template ignored: could not match 'shared_ptr<type-parameter-0-0>' against
'org::openapitools::client::model::Color'
utility::string_t ApiClient::parameterToString(const std::shared_ptr<T>& value)
^
/test/api/../ApiClient.h:104:12: error: no matching function for call to 'parameterToString'
return parameterToString(*value.get());
^~~~~~~~~~~~~~~~~
/test/api/../ApiClient.h:59:30: note: candidate function not viable: no known conversion from
'std::__1::shared_ptr<org::openapitools::client::model::Color>::element_type' (aka 'org::openapitools::client::model::Color') to 'utility::string_t' (aka
'basic_string<char, char_traits<char>, allocator<char> >') for 1st argument
static utility::string_t parameterToString(utility::string_t value);
^
/test/api/../ApiClient.h:60:30: note: candidate function not viable: no known conversion from
'std::__1::shared_ptr<org::openapitools::client::model::Color>::element_type' (aka 'org::openapitools::client::model::Color') to 'int32_t' (aka 'int') for 1st argument
static utility::string_t parameterToString(int32_t value);
^
/test/api/../ApiClient.h:61:30: note: candidate function not viable: no known conversion from
'std::__1::shared_ptr<org::openapitools::client::model::Color>::element_type' (aka 'org::openapitools::client::model::Color') to 'int64_t' (aka 'long long') for 1st argument
static utility::string_t parameterToString(int64_t value);
^
/test/api/../ApiClient.h:62:30: note: candidate function not viable: no known conversion from
'std::__1::shared_ptr<org::openapitools::client::model::Color>::element_type' (aka 'org::openapitools::client::model::Color') to 'float' for 1st argument
static utility::string_t parameterToString(float value);
^
/test/api/../ApiClient.h:63:30: note: candidate function not viable: no known conversion from
'std::__1::shared_ptr<org::openapitools::client::model::Color>::element_type' (aka 'org::openapitools::client::model::Color') to 'double' for 1st argument
static utility::string_t parameterToString(double value);
^
/test/api/../ApiClient.h:64:30: note: candidate function not viable: no known conversion from
'std::__1::shared_ptr<org::openapitools::client::model::Color>::element_type' (aka 'org::openapitools::client::model::Color') to 'const utility::datetime' for 1st argument
static utility::string_t parameterToString(const utility::datetime &value);
^
/test/api/../ApiClient.h:88:30: note: candidate template ignored: could not match 'vector<type-parameter-0-0, allocator<type-parameter-0-0> >'
against 'org::openapitools::client::model::Color'
utility::string_t ApiClient::parameterToString(const std::vector<T>& value)
^
/test/api/../ApiClient.h:102:30: note: candidate template ignored: could not match 'shared_ptr<type-parameter-0-0>' against
'org::openapitools::client::model::Color'
utility::string_t ApiClient::parameterToString(const std::shared_ptr<T>& value)
^
1 warning and 3 errors generated.
make[2]: *** [CMakeFiles/CppRestOpenAPIClient.dir/api/DefaultApi.cpp.o] Error 1
make[1]: *** [CMakeFiles/CppRestOpenAPIClient.dir/all] Error 2
make: *** [all] Error 2
Related issues/PRs
Suggest a fix
The text was updated successfully, but these errors were encountered:
animesh-bhadouria
changed the title
[BUG][C++][cpp-restsdk] Error compiling c++ client library with [reusable enums](https://swagger.io/docs/specification/data-models/enums/)
[BUG][C++][cpp-restsdk] Error compiling c++ client library with enums
Sep 1, 2021
Bug Report Checklist
Description
I defined a schema object type enum in yaml file as per the reusable enum samples docs/data-models/enums and generated the cpprestsdk API client library. Getting a compilation error while upon compiling the API client library.
openapi-generator version
OpenAPI declaration file content or url
Generation Details
Steps to reproduce
test.yaml
file with the provided (above) sample configuration. (validated)Error Log
The generated client code cannot match the template
parameterToString()
conversion for enums.Related issues/PRs
Suggest a fix
The text was updated successfully, but these errors were encountered: