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

Models that conform to Resource and have a member variable named id, breaks resolveLinksArray method #374

Open
2 of 6 tasks
neptalire94 opened this issue Aug 2, 2022 · 0 comments

Comments

@neptalire94
Copy link

neptalire94 commented Aug 2, 2022

  • contentful.swift version number: 5.5.5
  • Xcode version number: 13.4.1
  • Target operating system(s) and version number(s)
    • iOS: 15.5
    • tvOS:
    • watchOS:
    • macOS:
  • Package manager:
    • Carthage
    • Cocoapods

Hi, I'm reporting this just in case, am not sure if in the docs there's a mention about this, if it is then sorry you can just close this issue.

Models that do conform to EntryDecodable, FieldsKeyQueryable and Resource, if they have id as a member variable it makes an overload of the FlatResource conformance as the id member variable will be overridden, meaning that for instance if you have an array of this class as a member variable of another class, resolveLinksArray will give you an array of NSNull, this is due to the id overload as previously mentioned since:

image

In the for cycle in churnLinks method this linkKey references the sys.id one while:

image

In data cache these entry.id are referencing the id of the model, which in this case if it's overloaded it will not work properly cause the churnLinks method is expecting that the id matches with the sys.id one and will give you an array of NSNulls instead.

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

1 participant