Fix nested model serialization state tracking


Nested model fields now correctly track their state by querying the
nested model's own isSet() and isValid() methods, rather than
treating them like primitive types.

The previous implementation used the same logic for both primitive
types and nested model objects:
    m_fieldIsValid = fromJsonValue(m_field, json["fieldName"]);
    m_fieldIsSet = !json["fieldName"].isNull() && m_fieldIsValid;

This works for primitive types but fails for nested models. A model
can be valid but not set when all its fields are optional. The model
must be queried directly to determine its actual state.

The new implementation for nested models:
    m_fieldIsValid = m_field.isValid();
    m_fieldIsSet = m_field.isSet() || (m_fieldIsValid && object.isEmpty());

This fix enables proper handling of:
- Empty nested objects ({}) - now recognized as "set but empty"
- Missing fields - correctly distinguished from empty fields
- Nested models where all fields are optional

Adds comprehensive test coverage via new Ente schema, which tests
nested model references (Ente.family references Duck, which contains
Duck_family). Tests cover empty objects, missing fields, type
validation, and edge cases.

Removes QEXPECT_FAIL annotations for QTBUG-145568. All previously
failing test cases now pass with the corrected state tracking logic.

Updates petstore tests to handle empty Category objects ({}), which
are now properly distinguished from absent Category fields. Changes
default status from "freaky" to "sold" to match server behavior.

Fixes: QTBUG-145568
Pick-to: 6.11
Change-Id: I7f491cd127d4bc11a1ee5e639bb49afb905e445a
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
commitb330bc97aeeaa690dc760345911d1d2caaefc822
parent1977ab5024eadf03811218e909e42800c95a416c
authorTatiana Borisova <tatiana.borisova@qt.io>
committerTatiana Borisova <tatiana.borisova@qt.io>
commit timeSat, 25 Apr 2026 19:35:35 +0000