-
-
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
[C++][Pistache] Fix optional error and wrong function signatures #264
[C++][Pistache] Fix optional error and wrong function signatures #264
Conversation
7258341
to
d77fc9d
Compare
@@ -327,29 +327,16 @@ public String toDefaultValue(Schema p) { | |||
ArraySchema ap = (ArraySchema) p; | |||
String inner = getSchemaType(ap.getItems()); | |||
if (!languageSpecificPrimitives.contains(inner)) { | |||
inner = "std::shared_ptr<" + inner + ">"; | |||
inner = inner; |
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.
Why this assignment?
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.
oh, seems i forgot to remove it, when removing shared ptr
{ | ||
return m_Category; | ||
} | ||
void Pet::setCategory(std::shared_ptr<Category> value) | ||
void Pet::setCategory(Category value) |
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.
Here not a reference?
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.
i'll add it
std::shared_ptr<Category> getCategory() const; | ||
void setCategory(std::shared_ptr<Category> value); | ||
Category getCategory() const; | ||
void setCategory(Category value); |
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.
Here not a reference?
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.
i'll add it
@stkrwork |
I don’t know especially what Pistache is but passing the value by const reference, even for complex type, should be generalized to all cpp generators. What do you think? |
i was considering const&, but in my initial thought i was thinking of doing it for every signature, but this approach is better. |
Each time I consider using const attributes for my methods, it leads to big and healthy refactoring! 😄 |
the const and reference refactoring will most likely also be required for the restbed generator |
And for Qt generator too! I create the issue. |
@stkrwork |
7b90d3a
to
9f76d1a
Compare
It just states that the complex type wont be modified. they dont have to be const outside of the function, they are just dealt as constants in the function |
@CyrilleBenard does that fix your issues #257 and #258 |
@stkrwork I'm sorry, I still do not try your PR 'cause I evaluate the openapi-generator during my time job. I will do it during the next week. Thx for your reactivity |
One regression seems to occurred, see issue #257 - part 2 of my last comment relative to the use of static + const |
41d8319
to
e0b1917
Compare
i added your request |
If no further question/feedback on this PR, I'll merge it into master in a few hours. |
Optional error has been fixed but I as far as I know, the function signature is still buggy. May be I misunderstand what's behind "wrong function signatures" (?). EDIT: More over, the Optional error fix implies a new issue (see type conversion). I saw in the chat (gitter) that @stkrwork was working on it |
well, it might take some time, because i don't have much time at the moment to implement the ideas i posted in chat |
otherwise you can also pick up where i left off. |
I'll put this on hold and will only merge this after I get the sign-off from you guys. Please take your time. |
cf3db65
to
d018fe0
Compare
@stkrwork I forked your branch with the changes you have already done. I changed some things, but I stucked compiling the UserApi.cpp when the users should be initialized using an array or an list. |
@Schrigga what about using the following?
|
d018fe0
to
c6c1da4
Compare
…s in setters that are not primitives
c6c1da4
to
38d86e5
Compare
PR checklist
./bin/
to update Petstore sample so that CIs can verify the change. (For instance, only need to run./bin/{LANG}-petstore.sh
and./bin/security/{LANG}-petstore.sh
if updating the {LANG} (e.g. php, ruby, python, etc) code generator or {LANG} client's mustache templates). Windows batch files can be found in.\bin\windows\
.master
.Description of the PR
(details of the change, additional tests that have been done, reference to the issue for tracking, etc)
#257 #258