# Collection key names in Zend-Expressive-Hal

**URL:** <https://discourse.laminas.dev/t/collection-key-names-in-zend-expressive-hal/325>\
**Category:** Mezzio\
**Tags:** zend-expressive-hal\
**Created:** [October 17, 2017, 6:17pm UTC](https://discourse.laminas.dev/t/collection-key-names-in-zend-expressive-hal/325 "2017-10-17T18:17:15Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![akrabat](https://yyz2.discourse-cdn.com/flex032/user_avatar/discourse.laminas.dev/akrabat/32/13_2.png) [@akrabat](https://discourse.laminas.dev/u/akrabat)\
**Post date:** [October 17, 2017, 6:17pm UTC](https://discourse.laminas.dev/t/collection-key-names-in-zend-expressive-hal/325/1 "2017-10-17T18:17:15Z")

</div>

Hi,

I’m currently implementing [zend-expressive-hal](https://github.com/zendframework/zend-expressive-hal) and am wondering why the collection’s pagination properties start with a leading underscore?

Specifically, I have a payload for collection that looks like this:

```
{
  "_embedded": {
     // stuff
  },
  "_links": {
     // stuff
  },
  "_page": 1,
  "_page_count": 53,
  "_total_items": 993
}

```

I think that `_page`, `_page_count` and `_total_items` should not have the leading underscore as they are properties of the collection in the same way that a `name` property exists on a `person`.

Thoughts?

---

<div class="post-metadata">

**Author:** ![matthew](https://yyz2.discourse-cdn.com/flex032/user_avatar/discourse.laminas.dev/matthew/32/14_2.png) [@matthew](https://discourse.laminas.dev/u/matthew)\
**Post date:** [October 18, 2017, 1:59pm UTC](https://discourse.laminas.dev/t/collection-key-names-in-zend-expressive-hal/325/2 "2017-10-18T13:59:24Z")

</div>

I had a couple reasons for why I went with the leading underscore:

- It’s _metadata_ for the collection.
- The collection resource can have data other than just the embedded collection items. I didn’t want to have conflicts with those (the likelihood of those having a leading underscore is pretty slim).

I’d be okay with removing the leading underscore, but those were my reasons for having them in the first place.

---

<div class="post-metadata">

**Author:** ![akrabat](https://yyz2.discourse-cdn.com/flex032/user_avatar/discourse.laminas.dev/akrabat/32/13_2.png) [@akrabat](https://discourse.laminas.dev/u/akrabat)\
**Post date:** [October 19, 2017, 8:00am UTC](https://discourse.laminas.dev/t/collection-key-names-in-zend-expressive-hal/325/3 "2017-10-19T08:00:05Z")

</div>

It’s interesting.

While I agree that it’s metadata for the collection, I would say that it’s primary data for the collection resource.

The conflict issue is something I hadn’t thought of, though I think a collection resource with an `page` and `_page` property would be very confusing in and of itself.

I wonder if there’s consensus in the wide API community on this?
