Closed jobcespedes closed 2 months ago
Hi @jobcespedes, Thank you for raising this bug report.
The notification classes and their API counterparts are different by design.
When we introduce a non-nullable field to the API, all the events that occurred before this change will be missing the field. To prevent any runtime errors, all new non-nullable fields in the API entity will be marked as optional in the Notification entity.
In this instance, you can optionally include prices
in a Product. However, it will never be available in Product related events. So the missing prices
property in ProductNotification
is valid.
I would strongly recommend updating your function to accept both types. Worst case, you could try typecasting the ProductNotification
to the Product
class, but I would be very wary as typecasting removes some type safety and could lead to runtime issues.
Please let us know if you need further help.
Thank you.
What happened?
Getting casting error from ProductNotification to Product
Steps to reproduce
What did you expect to happen?
ProductNotification becomes a Product entity for storage purposes
Logs