coinapi-sdk icon indicating copy to clipboard operation
coinapi-sdk copied to clipboard

Compilation fix for cpp-restsdk

Open fedeitc opened this issue 3 years ago • 4 comments

A specialization for the shared_ptr<datetime> data type was added to ModelBase member functions fromString, fromJson, toJson and toHttpContent.

As ModelBase was auto generated, the real fix should be addressed by OpenAPI-Generator.

fedeitc avatar Apr 26 '22 15:04 fedeitc

This should fix these errors:

In file included from coinapi-sdk/oeml-sdk/cpp-restsdk/model/Fills.h:23,
                 from coinapi-sdk/oeml-sdk/cpp-restsdk/model/Fills.cpp:15:
coinapi-sdk/oeml-sdk/cpp-restsdk/ModelBase.h: In instantiation of 'static web::json::value org::openapitools::client::model::ModelBase::toJson(const std::shared_ptr<_Tp>&) [with T = utility::datetime]':
coinapi-sdk/oeml-sdk/cpp-restsdk/model/Fills.cpp:50:85    required from here
coinapi-sdk/oeml-sdk/cpp-restsdk/ModelBase.h:185:23: error: 'using element_type = class utility::datetime' {aka 'class utility::datetime'} has no member named 'toJson'
         retVal = val->toJson();
                  ~~~~~^~~~~~
coinapi-sdk/oeml-sdk/cpp-restsdk/ModelBase.h: In instantiation of 'static bool org::openapitools::client::model::ModelBase::fromJson(const web::json::value&, std::shared_ptr<_Tp>&) [with T = utility::datetime]':
coinapi-sdk/oeml-sdk/cpp-restsdk/model/Fills.cpp:74:62    required from here
coinapi-sdk/oeml-sdk/cpp-restsdk/ModelBase.h:233:22: error: 'using element_type = class utility::datetime' {aka 'class utility::datetime'} has no member named 'fromJson'; did you mean 'from_string'?
         ok = outVal->fromJson(val);
              ~~~~~~~~^~~~~~~~
              from_string
coinapi-sdk/oeml-sdk/cpp-restsdk/ModelBase.h: In instantiation of 'static std::shared_ptr<org::openapitools::client::model::HttpContent> org::openapitools::client::model::ModelBase::toHttpContent(const string_t&, const std::shared_ptr<_Tp>&, const string_t&) [with T = utility::datetime; utility::string_t = std::__cxx11::basic_string<char>]':
coinapi-sdk/oeml-sdk/cpp-restsdk/model/Fills.cpp:110:114:   required from here
coinapi-sdk/oeml-sdk/cpp-restsdk/ModelBase.h:285:125: error: 'using element_type = class utility::datetime' {aka 'class utility::datetime'} has no member named 'toJson'
  new std::stringstream( utility::conversions::to_utf8string( value->toJson().serialize() ) ) ) );
                                                              ~~~~~~~^~~~~~

coinapi-sdk/oeml-sdk/cpp-restsdk/ModelBase.h: In instantiation of 'static bool org::openapitools::client::model::ModelBase::fromString(const string_t&, std::shared_ptr<_Tp>&) [with T = utility::datetime; utility::string_t = std::__cxx11::basic_string<char>]':
coinapi-sdk/oeml-sdk/cpp-restsdk/ModelBase.h:321:22:   required from 'static bool org::openapitools::client::model::ModelBase::fromHttpContent(std::shared_ptr<org::openapitools::client::model::HttpContent>, std::shared_ptr<_Tp>&) [with T = utility::datetime]'
coinapi-sdk/oeml-sdk/cpp-restsdk/model/Fills.cpp:134:123:   required from here
coinapi-sdk/oeml-sdk/cpp-restsdk/ModelBase.h:219:22: error: 'using element_type = class utility::datetime' {aka 'class utility::datetime'} has no member named 'fromJson'; did you mean 'from_string'?
         ok = outVal->fromJson(web::json::value::parse(val));
              ~~~~~~~~^~~~~~~~
              from_string

fedeitc avatar Apr 26 '22 18:04 fedeitc

A patch was submitted to https://github.com/OpenAPITools/openapi-generator/pull/12247

fedeitc avatar Apr 26 '22 19:04 fedeitc

This do not make sense to merge it as it will be replaced again with the openapi generator on the next change. Good to see that the fix was merged in the generator repository; lets keep this open to not lose information that this is a known issue.

Svisstack avatar May 06 '22 00:05 Svisstack

Yes, once it will be regenerated with the latest openapi generator, it will be fixed.

fedeitc avatar May 06 '22 16:05 fedeitc