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

Fix Must Occur serix validation #614

Merged
merged 7 commits into from
Nov 22, 2023
Merged

Fix Must Occur serix validation #614

merged 7 commits into from
Nov 22, 2023

Conversation

PhilippGackstatter
Copy link
Contributor

Description of change

Fixes/Implements Must Occur serix validation for arrays.

This functionality is implemented in ReadSliceOfObjects, which is never called except in tests.

The way it's implemented trades readability and deduplication over performance. It would have been possible to implement the check on the bytes directly, which would have been more efficient than iterating separately over the slice and over the reflection types. However, obtaining the correct type denotation for the already-serialized objects is not trivial, but needed in order to read the correct number of bytes (uint8 vs uint32 for the two possible type denotations).
It would have likely also resulted in an implementation that would be integrated in the existing code, which makes it less readable and reusable.

The way it is implemented now is self-contained in a function and simply called four times from encoding/decoding and map encoding/decoding.

Type of change

Choose a type of change, and delete any options that are not relevant.

  • Bug fix (a non-breaking change which fixes an issue)

How the change has been tested

Tests were added.

Existing test frameworks like serializeTest and deSerializeTest were not suitable for reuse, so new ones were added.

@PhilippGackstatter PhilippGackstatter linked an issue Nov 21, 2023 that may be closed by this pull request
@PhilippGackstatter PhilippGackstatter marked this pull request as ready for review November 21, 2023 12:46
@PhilippGackstatter PhilippGackstatter merged commit bdf1cc3 into develop Nov 22, 2023
52 checks passed
@PhilippGackstatter PhilippGackstatter deleted the fix/must-occur branch November 22, 2023 11:26
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

Successfully merging this pull request may close these issues.

Fix Must Occur in serix
2 participants