-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
todoList example not working as expected: ?missing route GET /todo-list/{id}/todos #2050
Comments
I can implement
|
I have closed #2048 because it was a bit muddled but the points are still relevant:
What SHOULDN'T be possible (unless I am choosing to view todos as an array property of todoList and not its own object), is
look for this todo..
i.e. the constrained one-to-many repository is NOT READ ONLY as would be suggested by:
I have also tried setting the todos 'property' as 'protected' on the todoList model with no apparent affect (todos is of course actually a method / not decorated as a property so perhaps that's why) :
|
Perhaps this is missing an implementation of belongsTo Relation? Anyway, todo: #2049 |
@nabdelgadir, you were reviewing the todo-list example earlier. Could you please take a look? Thanks! |
Yes, you're right. Thanks for catching that!
This is similar to this. You can specify the filter to be what you have:
The correct way to do it is through using an include filter to retrieve the related model instances, but LoopBack 4 doesn't support it yet. However, we have an issue open for it. |
Hi @nabdelgadir - thanks for the tips! It's a fast-moving project at the mo but getting to grips with what is/isn't/will be implemented as core functionality and where to extend myself. Aiming to get myself setup to chip in some small PRs like missing example bits to help things along when I have some time! Interested in how the |
To prevent people from accessing There is very little auto-magic in LB4 so far, almost everything is expressed in the code generated by |
@bajtos no worries, that was my logical conclusion, but from a DX point of view, even trying hard to track the roadmap & 'what to expect' issues, one wonders if one is missing some 'Magic' :) |
I am proposing to capture how to customize generated API in our docs. For example, add a new section called "Customizing generated REST API" to Controller generator. Thoughts? |
@bajtos I like the idea! I was just going to log this issue. The tutorial mentions It should be updated to include this discussion summary. |
@nabdelgadir, not sure if your PR #4412 would fix it. Could you please take a look? Thanks! |
For the snippet: {
"id": "9628859414b170c6d69005124b45c564",
"title": "a list with todos added from /post/todo-lists",
"todos": [
{
"title": "a todo added via /post/todo-lists",
"desc": "a description"
}
]
}
When we land #4412, we can close this issue, but if you have any further questions, please let us know. |
Description / Steps to reproduce / Feature proposal
Current Behavior
curl -X POST "https://lb4.eu-gb.mybluemix.net/todo-lists" -H "accept: application/json" -H "Content-Type: application/json" -d "{\"title\":\"grocery list\"}"
curl -X POST "https://lb4.eu-gb.mybluemix.net/todo-lists/f802a73624452ae109f5f67921f029b1/todos" -H "accept: */*" -H "Content-Type: application/json" -d "{\"title\":\"my Todo\",\"desc\":\"todo added via todo-lists/f802a73624452ae109f5f67921f029b1/todos\"}"
Expected Behavior
As expected until this point.
GET /todos/{id}/todos
is not a route!Should there be a route
GET /**todo-list**/{id}/todos
??GET /todos/{id}
returns the todo:curl -X GET "https://lb4.eu-gb.mybluemix.net/todos/89457642c79b2bd07c0d09c5e347d1d3" -H "accept: application/json"
GET todo-lists/{id}
curl -X GET "https://lb4.eu-gb.mybluemix.net/todo-lists/f802a73624452ae109f5f67921f029b1" -H "accept: application/json"
Expected: (minimum of)
@dhmlau FYI
The text was updated successfully, but these errors were encountered: