OpenAPITools / OpenAPITools/openapi-generator
[REQ] [C++][Pistache] Make getXXX() return reference.
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 26.8k
- Forks
- 7.7k
- PR merge metrics
- PR metrics pending
Description
The getXXX() functions in the generated models for the pistache server always return data by value. This is rather wasteful, especially when large subobjects are being passed around.
I.e. currently generated code looks like:
class Animal {
public:
std::string getName () const;
}
It would be much better to return a const reference instead. This would avoid making any copies. It also shouldn't break any existing code.
I.e. improved code would be:
class Animal {
public:
std::string const & getName () const;
}
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by locating the generator templates for Pistache server models and the tests covering generated C++ getters. Confirm how the current getXXX() declarations and definitions are produced, then verify that generated getters return const references without breaking existing generated-code tests.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp, openapi
- Domain
- api, backend-api-design
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100