-
-
Notifications
You must be signed in to change notification settings - Fork 214
fix: Invalid JSON in whereMatchesQuery due to extra quotes around limiters
#1100
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
Important Review skippedBot user detected. To trigger a single review, invoke the You can disable this status message by setting the Comment |
…ters Co-authored-by: mtrezza <5673677+mtrezza@users.noreply.github.com>
Co-authored-by: mtrezza <5673677+mtrezza@users.noreply.github.com>
whereMatchesQuery due to extra quotes around limiters
|
🚀 Thanks for opening this pull request! |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #1100 +/- ##
==========================================
+ Coverage 44.01% 44.26% +0.24%
==========================================
Files 61 61
Lines 3637 3637
==========================================
+ Hits 1601 1610 +9
+ Misses 2036 2027 -9 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
@copilot Fix this error in the "Dart beta" CI job: 2025-12-05T02:27:08.3183362Z ##[group]Run dart analyze packages/dart --fatal-infos |
Co-authored-by: mtrezza <5673677+mtrezza@users.noreply.github.com>
Fixed in e3dbcb6. Removed the unused |
|
@mtrezza This looks good but I'd recommend an additional test that checks for limiters with extra quotes to catch accidental code regression. |
|
@copilot add an additional test that checks for limiters with extra quotes to catch accidental code regression. |
Co-authored-by: mtrezza <5673677+mtrezza@users.noreply.github.com>
Added in 60a7ff0. The new test |
|
@kirkmorrow how about the added test? and you mind me adding you to the Parse Flutter SDK team? So you can be tagged for a review for example. |
You may add me |
|
@mtrezza I'm ready to approve this. Do you want to make me a member first? |
# [dart-v9.4.8](dart-9.4.7...dart-9.4.8) (2025-12-05) ### Bug Fixes * Invalid JSON in `whereMatchesQuery` due to extra quotes around limiters ([#1100](#1100)) ([a8cf4f3](a8cf4f3))
|
🎉 This change has been released in version dart-v9.4.8 |
Pull Request
Issue
Closes: #932
Approach
The
_buildQueryRelationalmethod generated invalid JSON when building relational queries. The string interpolation',"$lim"'incorrectly added literal double-quote characters around the already-formatted JSON in$lim, producing output like,""include":avatar"instead of,"include":avatar.Fix:
',"$lim"'to',$lim'to remove extraneous quoteslimiters.isNotEmptytolim.isNotEmptyto check the computed string directlyBefore (invalid JSON):
{"where":{...},"className":"DeliveryArea",}After (valid JSON):
{"where":{...},"className":"DeliveryArea"}Additional fixes:
includeObjectparameter from_initmethod inparse_live_list.dartto fix Dart beta analyzer warning""include"pattern)Tasks
Original prompt
This section details on the original issue you should resolve
<issue_title>Querying Relationships Generates Invalid JSON</issue_title>
<issue_description>### New Issue Checklist
^ note I'm using the latest parse server version available on back4app and the latest SDK available for flutter
Issue Description
Steps to reproduce
This is the code from my app:
Note that the other constraints don't do anything to the reproduction. The whereMatchesQuery made the issue appear.
Actual Outcome
Internal Server Error
Upon further investigation, I found that this request URL was generated by the library:
https://parseapi.back4app.com/classes/Farmer?where=%7B%22deliveryAreas%22:%7B%22$inQuery%22:%7B%22where%22:%7B%22postalCodes%22:%7B%20%22$all%22:%5B21075%5D%7D%7D,%22className%22:%22DeliveryArea%22,%7D%7D,%22isActive%22:%20true,%22pickupCoordinates%22:%7B%22$nearSphere%22:%7B%22__type%22:%22GeoPoint%22,%22latitude%22:53.45994049999999,%22longitude%22:9.9288308%7D%7D%7D&include=pickupAddress,invoiceAddress
The decoded JSON part of the query is:
{ "deliveryAreas": { "$inQuery": { "where": { "postalCodes": { "$all": [ 21075 ] } }, "className": "DeliveryArea", } }, "isActive": true, "pickupCoordinates": { "$nearSphere": { "__type": "GeoPoint", "latitude": 53.45994049999999, "longitude": 9.9288308 } } }NOTE THE TRAILING COMMA AFTER THE className! This is not valid json!
Expected Outcome
Send valid JSON, get the data :)
That's what the previous version did before the upgrade.
Environment
Parse Flutter SDK
parse_server_sdk_flutter: ^5.1.03.10.23.0.2linux/ubuntuServer
5.2.3,4.10.4, and4.5.0Logs