-
Notifications
You must be signed in to change notification settings - Fork 118
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
Remove items key from embedded array in paginated list #307
Comments
Can you please post the expected JSON? |
{
"page": 1,
"limit": 10,
"pages": 461,
"total": 4610,
"_links": {
"self": {
"href": "\/service_contracts?page=1&limit=10"
},
"first": {
"href": "\/service_contracts?page=1&limit=10"
},
"last": {
"href": "\/service_contracts?page=461&limit=10"
},
"next": {
"href": "\/service_contracts?page=2&limit=10"
}
},
"_embedded": [
{
"contractId": "1f432848-0303-490c-a86f-4a2b1a2a1aba",
"createdAt": "2015-08-13T00:00:00+02:00"
},
{
"contractId": "097acd77-14bf-4409-855c-677e570f555a",
"createdAt": "2015-08-13T00:00:00+02:00"
}
]
} |
Maybe it is possible with a custom |
See my comments in #284 (comment), in particular:
What you are asking is not part of JSON-HAL as in that spec, each embedded must have a name and be a resource. |
Thank you for your feedback @goetas . |
https://tools.ietf.org/html/draft-kelly-json-hal-08#section-4.1.2
The part: object whose property names are link relation types, in your case is an array, and this is already wrong by the spec. |
We have a pagerfanta collection representation which uses the
items
default key on the_embedded
array:We need to remove the
_items
key.However I was able to manage it by using a custom representation based on the original
Hateoas\Representation\CollectionRepresentation
:But this looks like an ugly hack. Is there a better way?
Came from @willdurand @schmittjoh :
The text was updated successfully, but these errors were encountered: