Skip to content

[cpp rest-sdk] Improve method signatures to use const when the value won't change#1295

Merged
etherealjoy merged 4 commits intoOpenAPITools:masterfrom
whoan:constness
Oct 28, 2018
Merged

[cpp rest-sdk] Improve method signatures to use const when the value won't change#1295
etherealjoy merged 4 commits intoOpenAPITools:masterfrom
whoan:constness

Conversation

@whoan
Copy link
Copy Markdown
Contributor

@whoan whoan commented Oct 23, 2018

PR checklist

  • Read the contribution guidelines.
  • Ran the shell script under ./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\.
  • Filed the PR against the correct branch: master, 3.4.x, 4.0.x. Default: master.
  • Copied the technical committee to review the pull request if your PR is targeting a particular programming language.

Description of the PR

Improve method signatures to use const when the value won't change.

Ping @ravinikam @stkrwork @fvarose @etherealjoy @MartinDelille

Copy link
Copy Markdown
Contributor

@etherealjoy etherealjoy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What about the const reference for setter arguments?

https://github.com/OpenAPITools/openapi-generator/pull/1295/files#diff-dcd1e3f1c138323826806ca0c2cb3465R56

Looks much better with this change, but you could perhaps consider this point too.

@etherealjoy etherealjoy changed the title Constness [cpp rest-sdk] Constness Oct 23, 2018
@etherealjoy
Copy link
Copy Markdown
Contributor

I think it is a little complicated with Models, being passed a a shared_ptr.
You could fix it later if you wish.
Some work has been done for other clients and servers but I think it is going to be a breaking change.
So you could do it in the next step.

@etherealjoy etherealjoy added this to the 3.3.2 milestone Oct 28, 2018
@etherealjoy etherealjoy merged commit d80f3a6 into OpenAPITools:master Oct 28, 2018
@whoan whoan deleted the constness branch October 29, 2018 19:03
@wing328 wing328 changed the title [cpp rest-sdk] Constness [cpp rest-sdk] Improve method signatures to use const when the value won't change Oct 31, 2018
@wing328
Copy link
Copy Markdown
Member

wing328 commented Oct 31, 2018

@whoan thanks for the PR, which is included in the v3.3.2 release: https://twitter.com/oas_generator/status/1057649626101112832

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants