Skip to content

[BUG][C++][cpp-pistache-server] An api receiving a std::optional parameter generates a org::openapitools::server::model::std::optional<...> that doesn't compile #18792

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
1 task done
mlebihan opened this issue May 30, 2024 · 1 comment · Fixed by #18793

Comments

@mlebihan
Copy link
Contributor

Bug Report Checklist

Description

This issue has for goal to reduce the amount of work required to resolve the #6726
apart that the problem described here affects cpp-pistache-server generator and not cpp-resksdk one.

the generator generate this, if an std::optional parameter is passed to an api call:

const org::openapitools::server::model::std::optional<org::openapitools::server::model::GetAccountVideos_categoryOneOf_parameter> &categoryOneOf

this doesn't compile.

Suggest a fix

This should be replaced by:

const std::optional<org::openapitools::server::model::GetAccountVideos_categoryOneOf_parameter> &categoryOneOf
openapi-generator version

7.6.0

Related issues/PRs

[C++] Error making the cpprestsdk generated files

@mlebihan
Copy link
Contributor Author

mlebihan commented May 30, 2024

The correction provided with the PR accompanying this issue doesn't correct all the #6726 troubles.

It reduces its compilation error list from:

error: 'AbuseStateSet' was not declared in this scope; did you mean 'org::openapitools::server::model::AbuseStateSet'?
error: cannot convert 'std::optional<org::openapitools::server::model::AbuseStateSet>' to 'const int&'
error: cannot convert 'std::optional<org::openapitools::server::model::VideoPlaylistTypeSet>' to 'const int&'
error: expected ';' at end of member declaration
error: expected ')' before '<' token
error: expected unqualified-id before '<' token
error: no match for 'operator>>' (operand types are 'std::istringstream' {aka 'std::__cxx11::basic_istringstream<char>'} and 'org::openapitools::server::model::_api_v1_videos_ownership__id__accept_post_id_parameter')
error: no matching function for call to 'fromStringValue(std::__cxx11::basic_string<char>&, org::openapitools::server::model::AbuseStateSet&)'
error: no matching function for call to 'fromStringValue(std::__cxx11::basic_string<char>&, org::openapitools::server::model::GetAccountVideos_categoryOneOf_parameter&)'
error: no matching function for call to 'fromStringValue(std::__cxx11::basic_string<char>&, org::openapitools::server::model::GetAccountVideos_languageOneOf_parameter&)'
error: no matching function for call to 'fromStringValue(std::__cxx11::basic_string<char>&, org::openapitools::server::model::GetAccountVideos_licenceOneOf_parameter&)'
error: no matching function for call to 'fromStringValue(std::__cxx11::basic_string<char>&, org::openapitools::server::model::GetAccountVideos_tagsAllOf_parameter&)'
error: no matching function for call to 'fromStringValue(std::__cxx11::basic_string<char>&, org::openapitools::server::model::GetAccountVideos_tagsOneOf_parameter&)'
error: no matching function for call to 'fromStringValue(std::__cxx11::basic_string<char>&, org::openapitools::server::model::VideoPlaylistTypeSet&)'
error: no matching function for call to 'fromStringValue(std::__cxx11::basic_string<char>&, org::openapitools::server::model::VideoPrivacySet&)'
error: no type named 'type' in 'struct std::enable_if<false, void>'
error: 'Pistache::Http::ResponseWriter::ResponseWriter(const Pistache::Http::ResponseWriter&)' is private within this context
error: 'std' in namespace 'org::openapitools::server::model' does not name a type
error: template argument 1 is invalid
error: 'VideoPlaylistTypeSet' was not declared in this scope; did you mean 'org::openapitools::server::model::VideoPlaylistTypeSet'?

to

error: no match for 'operator>>' (operand types are 'std::istringstream' {aka 'std::__cxx11::basic_istringstream<char>'} and 'org::openapitools::server::model::_api_v1_videos_ownership__id__accept_post_id_parameter')
error: no matching function for call to 'fromStringValue(std::__cxx11::basic_string<char>&, org::openapitools::server::model::AbuseStateSet&)'
error: no matching function for call to 'fromStringValue(std::__cxx11::basic_string<char>&, org::openapitools::server::model::GetAccountVideos_categoryOneOf_parameter&)'
error: no matching function for call to 'fromStringValue(std::__cxx11::basic_string<char>&, org::openapitools::server::model::GetAccountVideos_languageOneOf_parameter&)'
error: no matching function for call to 'fromStringValue(std::__cxx11::basic_string<char>&, org::openapitools::server::model::GetAccountVideos_licenceOneOf_parameter&)'
error: no matching function for call to 'fromStringValue(std::__cxx11::basic_string<char>&, org::openapitools::server::model::GetAccountVideos_tagsAllOf_parameter&)'
error: no matching function for call to 'fromStringValue(std::__cxx11::basic_string<char>&, org::openapitools::server::model::GetAccountVideos_tagsOneOf_parameter&)'
error: no matching function for call to 'fromStringValue(std::__cxx11::basic_string<char>&, org::openapitools::server::model::VideoPlaylistTypeSet&)'
error: no matching function for call to 'fromStringValue(std::__cxx11::basic_string<char>&, org::openapitools::server::model::VideoPrivacySet&)'
error: no type named 'type' in 'struct std::enable_if<false, void>'

That puts cpp-pistache-server generator at the same "level of compilation problems" than cpp-restsdk face to #6726.

mlebihan added a commit to mlebihan/openapi-generator that referenced this issue May 30, 2024
…meter generates a org::openapitools::server::model::std::optional<...> that doesn't compile OpenAPITools#18792

   Solving this issue has for goal to reduce the amount of work required to resolve the [[C++] Error making the cpprestsdk generated files](OpenAPITools#6726)
   and to put the `cpp-pistache-server` generator a the "same compilation problems" level than the `cpp-restsdk` generator in font of the OpenAPITools#6726.
wing328 pushed a commit that referenced this issue Jun 1, 2024
…meter generates a org::openapitools::server::model::std::optional<...> that doesn't compile #18792 (#18793)

Solving this issue has for goal to reduce the amount of work required to resolve the [[C++] Error making the cpprestsdk generated files](#6726)
   and to put the `cpp-pistache-server` generator a the "same compilation problems" level than the `cpp-restsdk` generator in font of the #6726.
welshm pushed a commit to welshm/openapi-generator that referenced this issue Jun 5, 2024
…meter generates a org::openapitools::server::model::std::optional<...> that doesn't compile OpenAPITools#18792 (OpenAPITools#18793)

Solving this issue has for goal to reduce the amount of work required to resolve the [[C++] Error making the cpprestsdk generated files](OpenAPITools#6726)
   and to put the `cpp-pistache-server` generator a the "same compilation problems" level than the `cpp-restsdk` generator in font of the OpenAPITools#6726.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant