Page MenuHomePhabricator

Treat 'null' as 'undefined' when verifying the event schemas
Closed, DeclinedPublic

Description

Currently if the property is marked optional, but the event contains the property with a 'null' value, the EventBus proxy service rejectes the event saying None is not of type 'string'. Should we allow null values for the optional fields as a valid value?

Feel free to decline, bike shedding task.

Event Timeline

Restricted Application added a subscriber: Aklapper. · View Herald Transcript

I think we can allow nulls, but not unless we explicitly want to. I think it should be done in the schema explicitly if we do, right?

@Ottomata I was more wondering if we can just treat null as undefined generically and whether that's a good idea. So that if the field is optional, then null is allowed by default

Hm, my first thought is that's a bad idea, right? Since null can be used with a meaning, rather than just undefined, it seems like it might be better to not mix the two meanings.

We don't really have any place where we use 'null' meaningfully yet, but I do agree it might be the case in the future. I'll decline my own task :)