• Iustin Pop's avatar
    Add support for optional fields with null serialised · 9b156883
    Iustin Pop authored
    
    
    This follows a conversation we had for how to deal with
    optional-but-required fields in JSON serialisations: fields which are
    optional (can be either a given type or 'null'), but where the 'null'
    value is required. There are just a few of these in the Python code,
    but we should support them nevertheless.
    
    The patch changes the 'isOptional' attribute from boolean to a custom
    ADT, three-typed. This allows us to keep the same path on load (which
    deals with both cases), but use a custom save path where we explicitly
    save the 'null' value.
    Signed-off-by: default avatarIustin Pop <iustin@google.com>
    Reviewed-by: default avatarGuido Trotter <ultrotter@google.com>
    9b156883
THH.hs 37.8 KB