Skip to content

Allow relationships to have an alternative key if relationship key not exist #12

Closed
@danivek

Description

@danivek

Some ORM (like js-data) have two keys in object for defining a relation :

  • a key with id or ids (unpopulated relation)
  • a key with a populated relation

example for an article with a relation with a user :

{
  "id": "1",
  "title": "Nice article",
  "user_id": "2", // unpopulated user
  "user": { // populated user
    "id": "2",
    "name": "John Doe"
  }
}

If we not explicitly populate relation in the ORM, we only have the user_id key in object.

So, relationships configuration could have an alternative key to watch for unpopulated relationships if the populate relationship key does not exist.

Metadata

Metadata

Assignees

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions