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

[Enhancement] Return zero/empty arrays instead of null #45

Open
asimons04 opened this issue Oct 6, 2023 · 1 comment
Open

[Enhancement] Return zero/empty arrays instead of null #45

asimons04 opened this issue Oct 6, 2023 · 1 comment

Comments

@asimons04
Copy link

Instead of returning null for certain keys in the API responses, consider returning 0 for numeric values or an empty array [] for values that, if populated, would normally return an array.

This would make interfacing with the API much easier for Javascript/Typescript (possibly other languages as well).

Example Candidates:

  • approvals (0)
  • endorsements (0)
  • sysadmins (0)
  • moderators (0)
  • tags ([])
  • censure_reasons ([])
  • censure_evidence ([])
  • censure_count (0)
  • endorsement_reasons ([])
  • hesitation_reasons ([])
  • hesitation_evidence ([])
  • hesitation_count (0)
@RikudouSage
Copy link

Isn't null generally easy to handle? Like, in TS/JS:

if (instance?.moderators) {
    // do something
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants