zserio icon indicating copy to clipboard operation
zserio copied to clipboard

Improve warning message for optional fields

Open mikir opened this issue 1 year ago • 0 comments

Consider the following schema:

package sample;

struct Compound(Param param)
{
    uint32 field : field > param.min;
};

struct Other
{
    Param(10) param1;
    optional Param(11) param2;
};

struct Param(uint32 param)
{
    uint32 min;
    uint32 max;
};

struct Main
{
    Other other1;
    Other other2;
    optional Compound(other2.param2) compound;
};

Then, the Zserio compiler fires the following warning:

[WARNING] sample.zs:24:38: Field 'compound' is not optional and contains reference to optional field 'param2' in type arguments. [optional-field-reference]

It would be better to improve misleading warning message to something like "Field 'compound' is optional and contains reference to another optional field 'param2' in type arguments which does not have to be present. [optional-field-reference]".

You can try it in streamlit.

mikir avatar Feb 16 '24 11:02 mikir