Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
How the change has been tested
Tests were added.
Existing test frameworks like
serializeTest
anddeSerializeTest
were not suitable for reuse, so new ones were added.