-
-
Notifications
You must be signed in to change notification settings - Fork 6.7k
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
Implemented missing definitions of declared methods inside modelbase-header.mustache, added two missing body of methods definitions #19569
Conversation
… methods inside openapi-generator/modules/openapi-generator/src/main/resources/cpp-rest-sdk-client/modelbase-header.mustache, have also be added two missing body of methods definitions
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, but it'd be good to fix shared_ptr creation
modules/openapi-generator/src/main/resources/cpp-rest-sdk-client/modelbase-header.mustache
Outdated
Show resolved
Hide resolved
modules/openapi-generator/src/main/resources/cpp-rest-sdk-client/modelbase-header.mustache
Outdated
Show resolved
Hide resolved
Looks good now! |
if( val != nullptr ) | ||
{ | ||
val->toJson().serialize(ss); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@SaverioCode thanks for the PR
quick question if you don't mind. why remove the null check here and below (line 208)?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@SaverioCode thanks for the PR
quick question if you don't mind. why remove the null check here and below (line 208)?
Hi!
I removed them in several places because they are reference and in c++ they can't be nullptr
for definition. There is a compile error if a reference is nullptr
. A reference is an alias to an already-existing object or function. So in this scenario the shared_ptr
can't be nullptr
, what could actually be invalid is the pointer inside the shared_ptr
, the content of the referred object, but not the object itself
As it's done for any object that contains pointers, I suppose it would make sense to check the content of the shared_ptr
(it's not what was happening), but being a shared_ptr
I would assume that the pointer inside it's valid or I would think more of a program logic error. But this last consideration can be different from team to team
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks for the explanation
cc @etherealjoy who added the nullptr check to see if he's further comment/question on this
thanks again for the PR seems like I couldn't repeat the issue. I got the following (tests ok) when running
does it work for you locally? how can we repeat the issue? |
The first time I got the error I was on Windows, and I created a visual studio solution to test it and I got the Linking problem. On Linux is compiling perfectly, with both gnu and clang. From those test is not possible to caught the error. On Windows running
|
@muttleyxd @wing328 I changed only the missing methods implementation and the shared_ptr creation. I found out that the |
local tests passed
|
Fix #19566 implemented missing definitions of declared methods inside modelbase-header.mustache for the cpp-rest-sdk-client
I have also added two missing body of methods definitions
PR checklist
Commit all changed files.
This is important, as CI jobs will verify all generator outputs of your HEAD commit as it would merge with master.
These must match the expectations made by your contribution.
You may regenerate an individual generator by passing the relevant config(s) as an argument to the script, for example
./bin/generate-samples.sh bin/configs/java*
.IMPORTANT: Do NOT purge/delete any folders/files (e.g. tests) when regenerating the samples as manually written tests may be removed.
master
(upcoming 7.6.0 minor release - breaking changes with fallbacks),8.0.x
(breaking changes without fallbacks)@ravinikam @stkrwork @etherealjoy @MartinDelille @muttleyxd