Hi Lukasz,

It would be pretty simple to extend the code generation to make the virtual 
fields available in the parser ... 
I just didn't do it as I then didn't see the need. Should be extremely simple 
to implement. (Sort of just a copy+paste of the pojo template)

You can use type-arguments in typeSwitches ... just have a look at the modbus 
mspec.

What do you mean with "undeclared discriminators"?

Chris



Am 26.08.20, 01:22 schrieb "Łukasz Dywicki" <[email protected]>:

    I been trying to write new mspecs and I found that discriminator
    handling is quite limiting in current form.

    For example it is possible to declare a type argument, but it is not
    possible to use it as a divider.
    It is also not possible to use a virtual or manual field as a
    discriminator which could very well be source for type information. I am
    aware that virtual field is computed at runtime with given expression.
    I am not entirely sure of all implications for changing the handling.
    Currently discriminator is a simple field which gets registered in
    discriminator set.

    What do you think about making a `discriminator` rather an modifier
    which could be placed for type arguments and also in other places? At
    the moment any use of [typeSwitch] with undeclared discriminator causes
    null pointers in freemarker templates and failure.

    Cheers,
    Łukasz

Reply via email to