OpenAPITools / OpenAPITools/openapi-generator
[BUG] [pistache] models don't compile due to calling `validate()` with no parameters not returning bool
Open
Nobody has claimed this yet.
Issue: Bug
- Dominant language
- Java
- Stars
- 26.8k
- Forks
- 7.7k
- PR merge metrics
- PR metrics pending
Description
This PR introduced a change to call if (!m_{{name}}.validate()) { but the no-argument validate function throws on errors and returns void, this causes a compiler error:
error: could not convert '((const org::openapitools::Model1*)this)->org::openapitools::Model1::m_Parameters.org::openapitools::Model2::validate()' from 'void' to 'bool'
47 | if (!m_Parameters.validate()) {
| ~~~~~~~~~~~~~~~~~~~~~^~
| |
| void
openapi/model/Model1.cpp:47:32: error: in argument to unary !
47 | if (!m_Parameters.validate()) {
| ^
Found in OpenAPI 7.0.1 with the following command:
npx @openapitools/openapi-generator-cli generate -i api.yml -g cpp-pistache-server -o out
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
Reproduce the issue with the shown npx @openapitools/openapi-generator-cli command, using the cpp-pistache-server generator and api.yml. Inspect the generator templates responsible for model validation and verify that generated Model1 and Model2 sources compile successfully without the reported void-to-bool error.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100