Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Parsing enum fields with name not a number - FAST v1.2 #86

Open
benjaminfaul2 opened this issue Sep 10, 2019 · 3 comments
Open

Parsing enum fields with name not a number - FAST v1.2 #86

benjaminfaul2 opened this issue Sep 10, 2019 · 3 comments

Comments

@benjaminfaul2
Copy link

Hello, I am trying to use mFAST with FAST v1.2 templates and it seems to throw a static error when an enum type has element names that are not numbers.
E.g.

<define name="Answer">
    <enum>
      <element name="N" id="No"/>
      <element name="Y" id="Yes"/>
    </enum>
  </define>

Is there a way I can fix this? I'm trying to understand the code but it just seems to assume the element names must be a number.

Error:

Throw in function virtual void mfast::xml_parser::field_builder::visit(const mfast::enum_field_instruction*, void*)
Dynamic exception type: boost::exception_detail::clone_impl<mfast::fast_static_error>
std::exception::what: std::exception
[mfast::xml_parser::tag_value*] = 0
[mfast::tag_error_code*] = Unrecognized enum initial value :

Note: I am using the latest master as of 9-Sept-2019.
Thanks

@benjaminfaul2
Copy link
Author

After further digging it appears that later in the template file, a message is defined using this value but with a default that doesn't correspond to any of the named values.
E.g

<template id="123" name="ReplyMessage">
    <field name="ReplyAnswer" id="1234" presence="optional">
        <type name="Answer">
            <default value="0"/>
        </type>
    </field>
</template>

Is this invalid syntax?

Thanks

@benjaminfaul2
Copy link
Author

It seems the mFAST implementation of handling the default enum value is incorrect. See this link:

https://forum.fixtrading.org/t/default-value-for-enumeration-fast-1-2-extension/1236/2

The default value is the "on the wire" value not a enum field name.

@SBAM
Copy link

SBAM commented Nov 24, 2021

Hi, if you're interested, I addressed this in this fork SBAM@4a427bd
If an id attribute is provided and matches, it will be selected, otherwise it falls back to the name attribute.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants