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

Schema parser requires message attribute blockLength which should be optional #10

Open
harenbrs opened this issue Oct 3, 2022 · 3 comments

Comments

@harenbrs
Copy link

harenbrs commented Oct 3, 2022

When parsing a schema with message tags that don't specify the blockLength attribute, I get this error:

...
...\lib\site-packages\sbe\__init__.py", line 1088, in _parse_schema      
    blockLength=int(attrs['blockLength']),
KeyError: 'blockLength'

It looks like the parser depends on this attribute being there, however SBE specifies that blockLength is optional:

<xs:attribute name="blockLength" type="xs:nonNegativeInteger" use="optional">
@baryluk
Copy link
Contributor

baryluk commented Jun 2, 2023

This is a regression compared to 0.2.8. Bug was introduced in 4569d5b via #3 The commit did fix one type of bugs, but introduced another. The issue is _walk_fields_encode should probably return size of the root level message (right now it only returns size of the whole message implicitly via cursor.val), and if blockLength was explicitly set on message type, assert they are equal.

@uentity
Copy link

uentity commented Jul 8, 2024

I also came across this issue.
@baryluk do you think it would be correct to set blockLength to zero if it's omitted in schema?

@kizzx2
Copy link
Owner

kizzx2 commented Jul 8, 2024

@baryluk @uentity

Thanks very much for the detailed analysis. I am recently not working on FIX on a day-to-day basis so if an example dump can be provided (this library itself can be used to decode + anonymize + encode, hopefully) then it'd be easier for me to try to add some test cases and fix this.

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

4 participants