Skip to content

Allow for easier calls to included data #109

@reshadf

Description

@reshadf

Hi Matt,

We are using this library intensively. However, one thing that is very cumbersome somehow, is working with relationships and included object.

We are looking for way to expose the relationships included data easier. Something like this

let objectDocument = Document(..)
print(objectDocument.name) // attribute
print(objectDocument.relationships.employee.id) // which already works
print(objectDocument.includedRelation(id: objectDocument.relationships.employee.id).name // which doesn't exist but would be nice to have

And maybe something like this for the entire array?

print(objectDocument.includedRelation(relation: objectDocument.relationships.employee) // would return [Employee]

I have seen the examples of all the caches etc but it results in a lot of boilerplate code and messy code imo. Is something like above possible or is this some limitations we have in Swift currently? I would also love to help with a PR myself if you could give some advice on how to approach this :)

Love to hear your thoughts!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions