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.
Support for Ignoring
meta
Insideincluded
BlockSummary
In the current version of the JsonApix library, the presence of a
meta
field inside theincluded
block causes a crash during the deserialization process. This PR addresses this issue by ensuring that anymeta
fields within theincluded
block are ignored during deserialization, thus preventing the crash.What’s Changed
included
Block:meta
field inside theincluded
block would result in a crash because there was no default deserializer for theMeta
class. This PR introduces logic to ignoremeta
fields within theincluded
block, preventing the crash from occurring.UnknownMeta
class, which serves as a default deserializer for any unrecognizedMeta
types, ensuring that the deserialization process does not fail.This problem also extends to
links
anderrors
fields within theincluded
block. However, crashes were not occurring in those cases because we had already definedDefaultLinks
andDefaultError
classes, which provided a fallback during deserialization.For
meta
, no such default existed until now. To solve this, we introduced theUnknownMeta
class, which is an empty class designed solely to avoid serialization issues when unexpectedmeta
fields are encountered.Furthermore, we've updated our polymorphic serialization configuration as follows:
Do’s and Don’ts
Do:
You can safely add
meta
fields in the following locations:Meta in Root Block:
Meta in Resource Object:
**Meta Relationships **:
Don’t:
Adding a
meta
field inside theincluded
block will still be ignored, but previously would cause a crash:included
Block (Causes Crash):