-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
alwaysIdentifier annotation option implementation #373
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
alwaysIdentifier annotation option implementation #373
Conversation
Can you rebase against master @adelplace? |
Btw, in trees an object will be always serialized only 1 time. The second time, the IRI will always be used because of the circular reference handler. It may worth mentioning this behavior. |
@dunglas note added |
@dunglas The branch is now on master and up to date |
Thank @adelplace. I made a few changes, but there is something I don't understand in this example, without this option the result will be the same right? I think it should be an explicit example. |
Thanks for your feedback. |
I've just been pointed here from api-platform/api-platform#560 as I was asking for how to do this, but I'm a little confused by this new feature/documentation. If you use |
@toby-griffiths I think I directed you by error to this issue. All it does is to force the serialization to IRI's.
It can be a string if the relation is a toOne IIRC |
@soyuka I understand. But I'm now interested in this conversation… am I right in thinking that this new functionality allows you to include a link to a collection of related resources, if there's an ApiSubResource defined for them. Example If I have routes {
"@id": "/questions/123",
"@type": "Question",
"id": "123",
"answers": "/questions/123/answers"
} … or perhaps… {
"@id": "/questions/123",
"@type": "Question",
"id": "123",
"answers": {
"@id": "/questions/123/answers"
}
} … ??? |
Nope, I'm not found of this new option because it's kinda misleading. Take a look at the behat tests on the original PR https://github.com/api-platform/core/pull/1528/files all it does is returning the relation IRI's:
It's mainly useful when you have recursive entities which is not your case. I'm sorry for misleading you on this. About your request we have still work to do on subresource and I'm waiting for https://github.com/api-platform/core/pull/#1478 before I can continue improving stuff. |
@soyuka perhaps it's misleading in this example. It would work if you added more context thought, wouldn't it?… {
"@id": "/questions/123",
"@type": "Question",
"id": "123",
"answers": {
"@id": "/questions/123/answers",
"@type": "hydra:Link"
}
} … or am I mis-understanding the hydra vocab here? |
nope this "feature" is only giving strings |
This feature will be soon available with the maxDepth annotation, see api-platform/core#1696 |
Documentation for the feature api-platform/core#1528