Skip to content

[Bug]: android_channel_id is coming back as None when the model expects a string #62

@odestorm1

Description

@odestorm1

What happened?

Version: onesignal-python-api 2.0.2

When calling the OneSignalAppClient.get_notification method the android_channel_id field sometimes comes back as None. This causes the following validation error as the BasicNotification method expects a String rather than NoneType.

Invalid inputs given to generate an instance of 'BasicNotification'. The input data was invalid for the allOf schema 'BasicNotification' in the composed schema 'NotificationWithMeta'. Error=Invalid inputs given to generate an instance of 'BasicNotificationAllOf'. The input data was invalid for the allOf schema 'BasicNotificationAllOf' in the composed schema 'BasicNotification'. Error=Invalid type for variable 'android_channel_id'. Required value type is str and passed type was NoneType at ['received_data']['android_channel_id']

Is there a way that the Python SDK can be modified to accept None for the android_channel_id?

Steps to reproduce?

1. Install onesignal-python-api 2.0.2. 
2. Call `client.get_notification(receipt.notification_id)` with a valid notification ID.
3. If `android_channel_id` is None the above error message is thrown as `BasicNotification` expects a String not `NoneType`.

What did you expect to happen?

We expected the library to handle None Types in the get_notification method.

Relevant log output

Invalid inputs given to generate an instance of 'BasicNotification'. The input data was invalid for the allOf schema 'BasicNotification' in the composed schema 'NotificationWithMeta'. Error=Invalid inputs given to generate an instance of 'BasicNotificationAllOf'. The input data was invalid for the allOf schema 'BasicNotificationAllOf' in the composed schema 'BasicNotification'. Error=Invalid type for variable 'android_channel_id'. Required value type is str and passed type was NoneType at ['received_data']['android_channel_id']

Code of Conduct

  • I agree to follow this project's Code of Conduct

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions