Open alotia opened 6 years ago
cc @ravinikam (2017/07) @stkrwork (2017/07) @fvarose (2017/11) @etherealjoy (2018/02) @martindelille (2018/03)
@alotia We should definitely have const qualifiers on getters.
cpp-qt5-qhttpengine-server has const getter and const ref setters args
QDateTime getShipDate() const;
void setShipDate(const QDateTime &ship_date);
Sadly I fear breaking too much when applied to others.
Description
We are using openapi-generator to generate C++ classes from Java. For primitive types, the C++ getter method has 'const' qualifier, but when aggregates are specified, the method does not have have the const qualifier. Can a 'const' be added for getter methods even when the return type is an aggregate? (I am not very familiar with C++, and maybe there is a reason this is not being done. And I am filing this on behalf of someone who mentioned that not having a const on these getters causes them some grief.)
Please Note: I had originally filed this issue against swagger-codegen (v2.2.3), and William Cheng had asked to try out the latest version of OpenAPI Generator, but it does not address the issue I had. He had then recommended that I file an issue in OpenAPI as well. For your reference, the swagger-codegen issue is: https://github.com/swagger-api/swagger-codegen/issues/8770
openapi-generator version
We are using openapi-generator-maven-plugin v3.3.0 and openapi-generator v3.3.0
OpenAPI declaration file content or url
Command line used for generation
Using the openapi-generator-maven-plugin to generate the code. Please let me know if you need any additional info
Steps to reproduce
Please use the included sample Java code to generate a C++ class. If you need any additional info, please let me know.
Related issues/PRs
https://github.com/swagger-api/swagger-codegen/issues/8770
Suggest a fix/enhancement