forked from bblanchon/ArduinoJson
Filter: exact match takes precedence over wildcard (fixes #1628)
This commit is contained in:
@ -6,6 +6,7 @@ HEAD
|
||||
|
||||
* Fixed error `'dummy' may be used uninitialized` on GCC 11
|
||||
* Fixed error `expected unqualified-id before 'const'` on GCC 11 (issue #1622)
|
||||
* Filter: exact match takes precedence over wildcard (issue #1628)
|
||||
|
||||
v6.18.3 (2021-07-27)
|
||||
-------
|
||||
|
@ -232,6 +232,15 @@ TEST_CASE("Filtering") {
|
||||
"{\"example\":{\"outcome\":42}}",
|
||||
2 * JSON_OBJECT_SIZE(1) + 16
|
||||
},
|
||||
{
|
||||
// exclusion filter (issue #1628)
|
||||
"{\"example\":1,\"ignored\":2}",
|
||||
"{\"*\":true,\"ignored\":false}",
|
||||
10,
|
||||
DeserializationError::Ok,
|
||||
"{\"example\":1}",
|
||||
JSON_OBJECT_SIZE(1) + 8
|
||||
},
|
||||
{
|
||||
// only the first element of array counts
|
||||
"[1,2,3]",
|
||||
|
@ -32,8 +32,8 @@ class Filter {
|
||||
Filter operator[](const TKey& key) const {
|
||||
if (_variant == true) // "true" means "allow recursively"
|
||||
return *this;
|
||||
else
|
||||
return Filter(_variant[key] | _variant["*"]);
|
||||
VariantConstRef member = _variant[key];
|
||||
return Filter(member.isNull() ? _variant["*"] : member);
|
||||
}
|
||||
|
||||
private:
|
||||
|
Reference in New Issue
Block a user