Open ravensorb opened 5 years ago
@ravensorb hei buddy, try this one
http://localhost:1234/albums/1?_expand=song
please keep me updated about the result, if this work, then good :)
@typicode what should we return if we try to do an expand with a plural prop misstype?
look at this scenario:
db.json
{
"tasks": [
{ "id": 1, "title": "Do groceries", "description": "Buy 3 apples and 6 oranges" }
],
"reminders": [
{ "id": 1, "taskId": 1, "dueDate": "2018-09-30" }
]
}
if we try to perform /reminders?_expand=tasks
, the expand()
function accepts tasks
prop because after pluralize the prop still is tasks
, a resource that does exist in our DB. But when the function concats the prop with opts.foreignKeySuffix
, it will search for tasksId
property on reminders
, that does not exist.
In actual state, I get a toString() error, because the property tasksId
does not exist.
What should we return in this scenario?
tasksId
property on reminders
?tasks
object?tasksId
property?I'd like to make this contribution, if possible.
If you looking for a Quick solution just add an empty string in the "Primary Key".
db.json
{
"parents": [],
"childs": [
{
"id": 1,
"parentId": ""
}
]
}
If I have a json file like this
should I be able to make a request like this and get a valid response?
Right now I get an empty result.
Note: if I try this
I get the toString error that has already been submitted in issue #825