GodotNuts / GodotFirebase

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

[BUG] Dictionaries inside Arrays from Firestore not parsed correctly #131

Closed timjrobinson closed 3 years ago

timjrobinson commented 3 years ago

Describe the bug When retrieving data from a Firestore document that contains an array with dictionaries inside it, the dictionaries are not being parsed.

To Reproduce Create a Firestore Collection Inside the collection create a document that contains an array Add an item to the array with key 0 and data of {"name": "someone"} with GodotFirebase Retrieve the document using GodotFirebase collection.get(). The document will have the contents:

{"players":[{"fields":{"name":{"stringValue":"someone"}}}]}

Expected behavior I expect nested arrays/dictionaries to parse correctly to remove the fields property and stringValue and Firestore properties. The data returned from collection.get should look like:

{"players": [{"name": "someone"}]}

Screenshots

Debugging in Godot, this is the value of the document returned via collection.get():

2021-02-16 17_40_12-Godot Engine - CodeBreaker - ClientGame tscn

How it looks in Firebase console:

2021-02-16 18_21_33-Puzzop Games – Cloud Firestore – Firebase console

Environment:

Additional Information

It would be good to include unit tests for this too, as this regression has come up before. I fixed it in #80 and it's now reappeared since the refactor.

WolfgangSenff commented 3 years ago

@fenix-hub - sounds like the refactor slightly broke parsing. Any chance you'll be able to look at this this week?

fenix-hub commented 3 years ago

Yep, I'll give it a look for sure.