diff options
Diffstat (limited to 'src/qtjsonschema/checkpoints_p.h')
-rw-r--r-- | src/qtjsonschema/checkpoints_p.h | 14 |
1 files changed, 3 insertions, 11 deletions
diff --git a/src/qtjsonschema/checkpoints_p.h b/src/qtjsonschema/checkpoints_p.h index 64e21b8..081f895 100644 --- a/src/qtjsonschema/checkpoints_p.h +++ b/src/qtjsonschema/checkpoints_p.h @@ -313,21 +313,13 @@ public: return false; if (Check::m_data->m_flags.testFlag(CheckSharedData::NoAdditionalProperties)) { - QList<Key> strsSchemaProperties(m_checks.keys()); QList<Key> strsObjectProperties(object.propertyNames()); - if (strsSchemaProperties.size() == strsObjectProperties.size()) { - // number of properties are the same but lists still may differ - qSort(strsSchemaProperties); - qSort(strsObjectProperties); - if (!qEqual(strsSchemaProperties.constBegin(), strsSchemaProperties.constEnd(), strsObjectProperties.constBegin())) { - // lists of properties differ - return an additionalProperties error + foreach (const Key &key, strsObjectProperties) { + if (!m_checks.contains(key)) { + // no additional properties allowed return false; } } - else { - // number of properties differ - return an additionalProperties error - return false; - } } //qDebug() << Q_FUNC_INFO; |