Skip to content

Conversation

@iaggocapitanio1
Copy link

What does this PR do?

This PR resolves Issue #173 by implementing a fix in the serialization process of the User class. The labels field, which previously could lead to a type cast error when null, has been adjusted to handle null values gracefully. This change ensures that when labels is null, it defaults to an empty list, thereby avoiding the "type 'Null' is not a subtype of type 'List'" error.

Test Plan

To verify these changes:

  1. Added unit tests to ensure that the User.fromMap method correctly handles cases where labels is null.
  2. Conducted manual testing to ensure that serialization and deserialization of User objects work as expected, even when labels is null.
  3. Reviewed all other usages of the User class to ensure compatibility with this change.

Related PRs and Issues

This PR directly resolves Issue #173. No other related PRs at this time.

Additional Information

This change is a crucial step towards robust and error-resistant handling of optional fields in data models, enhancing the stability of the Appwrite codebase.

Have you read the Contributing Guidelines on issues?

Yes, I have read the contributing guidelines and ensured that my PR aligns with them.


@Schrolli91
Copy link

I think this can be closed because the Bug from #173 is fixed in the SDK generator now: appwrite/sdk-generator#751

@stnguyen90
Copy link
Contributor

Unfortunately, this is a read-only repo as the code is generated by our SDK Generator, and changes made only here would be wiped in the next release.

@stnguyen90 stnguyen90 closed this Apr 17, 2024
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

Successfully merging this pull request may close these issues.

3 participants