mirror of
				https://github.com/eledio-devices/thirdparty-ArduinoJson.git
				synced 2025-10-31 16:14:11 +01:00 
			
		
		
		
	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 `'dummy' may be used uninitialized` on GCC 11 | ||||||
| * Fixed error `expected unqualified-id before 'const'` on GCC 11 (issue #1622) | * 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) | v6.18.3 (2021-07-27) | ||||||
| ------- | ------- | ||||||
|   | |||||||
| @@ -232,6 +232,15 @@ TEST_CASE("Filtering") { | |||||||
|       "{\"example\":{\"outcome\":42}}", |       "{\"example\":{\"outcome\":42}}", | ||||||
|       2 * JSON_OBJECT_SIZE(1) + 16 |       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 |       // only the first element of array counts | ||||||
|       "[1,2,3]", |       "[1,2,3]", | ||||||
|   | |||||||
| @@ -32,8 +32,8 @@ class Filter { | |||||||
|   Filter operator[](const TKey& key) const { |   Filter operator[](const TKey& key) const { | ||||||
|     if (_variant == true)  // "true" means "allow recursively" |     if (_variant == true)  // "true" means "allow recursively" | ||||||
|       return *this; |       return *this; | ||||||
|     else |     VariantConstRef member = _variant[key]; | ||||||
|       return Filter(_variant[key] | _variant["*"]); |     return Filter(member.isNull() ? _variant["*"] : member); | ||||||
|   } |   } | ||||||
|  |  | ||||||
|  private: |  private: | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user