Replace fromJsonObject/asJsonObject API with fromJsonValue/asJsonValue
Rename the serialization interface on generated model classes and the
Object base type to use QJsonValue instead of QJsonObject. This aligns
with the broader Qt JSON API, avoids unnecessary conversions between
QJsonObject and QJsonValue, and enables correct handling of non-object
JSON values (null, arrays) in fromJson/fromJsonValue paths.
- Replace `asJsonObject()` -> `asJsonValue()` and
`fromJsonObject(QJsonObject)` -> `fromJsonValue(QJsonValue)` in
object/model Mustache templates and helpers
- Switch `fromJson(QString)` to use `QJsonValue::fromJson()` instead of
going through QJsonDocument
- Update examples, tests, and api-body template call sites accordingly
[ChangeLog][qtopenapi-generator] The fromJsonObject/asJsonObject
API methods of the generated objects and models are replaced with
fromJsonValue/asJsonValue.
Change-Id: I34c08a6c03d56bdffae5d5737072f1d9ded198cd
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
| commit | 03484d1fb4c40f8c7820931dbe90a1034a48d336 |
| parent | e85e3780127ee9d3e41d281dff2063d21ce96ccd |
| author | Tatiana Borisova <tatiana.borisova@qt.io> |
| committer | Tatiana Borisova <tatiana.borisova@qt.io> |
| commit time | Sat, 25 Apr 2026 19:36:06 +0000 |
- M examples/openapi/colorpalette/ApiBridges.h
- M src/tools/qtopenapi-generator/src/main/resources/cpp-qt6-client/api-body.mustache
- M src/tools/qtopenapi-generator/src/main/resources/cpp-qt6-client/common/helpers-body.mustache
- M src/tools/qtopenapi-generator/src/main/resources/cpp-qt6-client/common/object-body.mustache
- M src/tools/qtopenapi-generator/src/main/resources/cpp-qt6-client/common/object-header.mustache
- 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/mediatype/client/mediatype/tst_mediatype.cpp
- M tests/auto/models/client/standard/tst_standardmodels.cpp
- M tests/auto/operation-parameters/client/operationparameters/tst_operationparameters.cpp
- M tests/auto/petstore/client/userapitest/tst_userapitests.cpp