Skip to content
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

🐛 Bug Report: Python 3.9 function res.json() empty dict serialized as an array #6056

Closed
2 tasks done
tripolskypetr opened this issue Aug 29, 2023 · 1 comment
Closed
2 tasks done
Labels
bug Something isn't working product / cloud Issues found only on Appwrite Cloud product / functions Fixes and upgrades for the Appwrite Functions.

Comments

@tripolskypetr
Copy link

tripolskypetr commented Aug 29, 2023

👟 Reproduction steps

The following python code

def main(req, res):
  return res.json({
    "rows": [],
    "total": 0,
    "filterData": {},
    "pagination": {
      "limit": 10,
      "offset": 0,
    },
    "sortModel": [],
    "chips": {},
    "search": "",
    "payload": {},
  })

should return these JSON structure

{
  "rows": [],
  "total": 0,
  "filterData": {},
  "pagination": {
    "limit": 10,
    "offset": 0
  },
  "sortModel": [],
  "chips": {},
  "search": "",
  "payload": {}
}

👍 Expected behavior

It returns

{
  "rows": [],
  "total": 0,
  "filterData": {},
  "pagination": {
    "limit": 10,
    "offset": 0
  },
  "sortModel": [],
  "chips": {},
  "search": "",
  "payload": {}
}

👎 Actual Behavior

But every dict without any properties was serialized as a list

{
  "chips": [],
  "filterData": [],
  "pagination": { "limit": 10, "offset": 0 },
  "payload": [],
  "rows": [],
  "search": "",
  "sortModel": [],
  "total": 0
}

Proof

image

🎲 Appwrite version

Appwrite Cloud

💻 Operating system

Linux

🧱 Your Environment

Appwrite Cloud 1.1.2

👀 Have you spent some time to check if this issue has been raised before?

  • I checked and didn't find similar issue

🏢 Have you read the Code of Conduct?

@tripolskypetr tripolskypetr added the bug Something isn't working label Aug 29, 2023
@tripolskypetr tripolskypetr changed the title 🐛 Bug Report: Python 3.9 function res.json() empty dict serialization bug 🐛 Bug Report: Python 3.9 function res.json() empty dict serialized as an array Aug 29, 2023
@joeyouss
Copy link

joeyouss commented Aug 31, 2023

Hi @tripolskypetr This is fixed in 1.4. Cloud is on 1.1.2 so it will be reflected when Cloud gets updated. Closing this as of now!

@joeyouss joeyouss added product / cloud Issues found only on Appwrite Cloud product / functions Fixes and upgrades for the Appwrite Functions. labels Aug 31, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working product / cloud Issues found only on Appwrite Cloud product / functions Fixes and upgrades for the Appwrite Functions.
Projects
None yet
Development

No branches or pull requests

2 participants