GodotNuts / GodotFirebase

Implementations of Firebase for Godot using GDScript
MIT License
530 stars 76 forks source link

[BUG] FirestoreQuery.select with array as parameter results in 400. #349

Closed tzrot-jed closed 3 months ago

tzrot-jed commented 1 year ago

Describe the bug Passing an array to FirestoreQuery.select doesn't format the query request to Firestore properly and results in a 400

To Reproduce Assuming a Firestore collection stage with fields name and rating: Running:

var query: FirestoreQuery = FirestoreQuery.new().select(["name", "rating"]).from("stage", false)
var task: FirestoreTask = Firebase.Firestore.query(query)
var result: Array = yield(task, "result_query")

Results in a 400 response by Firestore

Expected behavior

var query: FirestoreQuery = FirestoreQuery.new().select(["name", "rating"]).from("stage", false)
var task: FirestoreTask = Firebase.Firestore.query(query)
var result: Array = yield(task, "result_query")

should request Firestore with {fields:[{fieldPath:name}, {fieldPath:rating}]} instead of {fields:[name, rating]}

Screenshots Not applicable

Environment:

Additional context I will be submitting a PR with a fix

WolfgangSenff commented 1 year ago

That is super weird. I will have to look into this closer. Very interesting. Thanks for submitting it! Will probably merge it soon, just haven't had time lately to validate it or anything.

WolfgangSenff commented 3 months ago

Closing this per my comment on #350 - 4.x should be fixed permanently now, and I'm going to attempt the same refactor for 3.x, which should fix this as well I think.