You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I just noticed that when using DTO output to create a different representation of the resource, the IRI returned by API-Platform is a generated one (as of API-Platform 3.x), instead of the original one (as of API-Platform 2.x).
{
"@id": "\/api\/books\/1",
"@type": "Book",
"id": 1,
"name": "The book of Foos",
"isbn": "some-hardcoded-isbn"
}
But I get:
{
"@type": "BookOutput",
"@id": "\/api\/.well-known\/genid\/b10ecd57cce7b0b65b14",
"id": 1,
"name": "The book of Foos",
"isbn": "some-hardcoded-isbn"
}
As you can see the returned IRI in @id is not valid, since it is supposed to be /api/books/1 (same as @type which is supposed to be Book, not BookOutput).
Is there something I can do to enforce this? In API-Platform 2.x DTOs, I can confirm that the expected IRIs were properly returned.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Hello there,
I just noticed that when using DTO output to create a different representation of the resource, the IRI returned by API-Platform is a generated one (as of API-Platform 3.x), instead of the original one (as of API-Platform 2.x).
TL; DR:
When requesting
GET /api/books/1
, I getinstead of
Reproduction
Consider that resource:
with the following representation:
And its provider:
When running
I expect:
But I get:
As you can see the returned IRI in
@id
is not valid, since it is supposed to be/api/books/1
(same as@type
which is supposed to beBook
, notBookOutput
).Is there something I can do to enforce this? In API-Platform 2.x DTOs, I can confirm that the expected IRIs were properly returned.
Beta Was this translation helpful? Give feedback.
All reactions