Test enum support
The openapi generator has a known bug [0] which results into the
enums being properly handled only when they are represented as
separate schemas.
This patch modifies the petstore.yaml file accordingly and tries
to make sure that the enum model is actually generated and used.
So far, the following fixes are done:
* Fix the model-header template to include the Enum header when needed.
Previously, the Object header was included unconditionally.
* Fix the model to pass the enum into setValue() by value instead of
passing by const-ref.
* Fix a bug that m_valueIsValid was not set to true in setValue().
* Fix a bug that the enum value and flags were not reset if a
non-existing value was passed to fromJson().
* Fix generator tag positions in order to get better formatting of
the generated code.
Regenerate the go server with the updated yaml file and adjust the
code to the changes.
Adapt the PetApiTest test to the changes in the model.
[0]: https://github.com/OpenAPITools/openapi-generator/issues/2645
Task-number: QTBUG-139919
Change-Id: I7dfb90776f10ee59ef489b9d552bb27d850ebe19
Reviewed-by: Tatiana Borisova <tatiana.borisova@qt.io>
| commit | 76dca9db29198ffbe2555ffc82780c2a39849702 |
| parent | 357b4fc2f8d86a3a58434c15d04706ee7dc45e73 |
| author | Ivan Solovev <ivan.solovev@qt.io> |
| committer | Ivan Solovev <ivan.solovev@qt.io> |
| commit time | Tue, 11 Nov 2025 15:57:40 +0100 |
- M src/tools/qtopenapi-generator/src/main/resources/cpp-qt6-client/model-body.mustache
- M src/tools/qtopenapi-generator/src/main/resources/cpp-qt6-client/model-header.mustache
- M tests/auto/petstore/client/PetApiTest/PetApiTests.cpp
- M tests/auto/petstore/client/client/CMakeLists.txt
- M tests/auto/petstore/client/client/QtOAIPet.cpp
- M tests/auto/petstore/client/client/QtOAIPet.h
- A tests/auto/petstore/client/client/QtOAIPetStatus.cpp
- A tests/auto/petstore/client/client/QtOAIPetStatus.h
- M tests/auto/petstore/client/client/README.md
- M tests/auto/petstore/qmlclient/client/CMakeLists.txt
- M tests/auto/petstore/qmlclient/client/OAIPet.cpp
- M tests/auto/petstore/qmlclient/client/OAIPet.h
- A tests/auto/petstore/qmlclient/client/OAIPetStatus.cpp
- A tests/auto/petstore/qmlclient/client/OAIPetStatus.h
- M tests/auto/petstore/qmlclient/client/README.md
- M tests/auto/petstore/server/go/api_pet.go
- M tests/auto/petstore/server/go/model_pet.go
- A tests/auto/petstore/server/go/model_pet_status.go
- M tests/auto/yaml_files/petstore.yaml