breadboard icon indicating copy to clipboard operation
breadboard copied to clipboard

add undefined to build package types

Open Mearman opened this issue 1 year ago • 6 comments

Mearman avatar Mar 25 '24 22:03 Mearman

one for the wishlist @aomarks

Mearman avatar Mar 25 '24 22:03 Mearman

undefined doesn't exist in JSON. We could do null, and there's also the concept of optional properties for an object type. We probably want both of those, but do you have a specific use case to pick one or the other?

aomarks avatar Mar 25 '24 22:03 aomarks

the specific case this time is in the pop node again. Where the return can be an item of undefined.

Mearman avatar Mar 26 '24 04:03 Mearman

This has just made me think of another case, const in JSON Schema.

Mearman avatar Mar 26 '24 04:03 Mearman

I think we want all input/output values to be JSON serializable, probably. So, since undefined isn't, we may want to use null instead for the pop node. (So I think we should add null to the type system).

aomarks avatar Mar 26 '24 17:03 aomarks

I just landed https://github.com/breadboard-ai/breadboard/pull/1231 which will ensure that we only return JSON serializable types from our nodes.

BTW, the main reason I think we want every value to be JSON serializable is so that we can easily support save/restore of runs.

aomarks avatar Mar 26 '24 18:03 aomarks