Skip to content
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

Meta Attributes #18

Closed
ericelliott opened this issue Oct 27, 2013 · 1 comment
Closed

Meta Attributes #18

ericelliott opened this issue Oct 27, 2013 · 1 comment

Comments

@ericelliott
Copy link
Contributor

"Title" is a useful meta attribute for Siren messages, but there may be other useful meta attributes, as well. Specifically, I propose "entityCount" and "description" attributes.

I like the idea of keeping metadata separate from the resource properties. For example, following my understanding of the current spec, siren-resource will produce the following output for a resource:

{
  "title": "Albums",
  "properties": {
    "description": "Some great albums you should listen to.",
    "entityCount": 1
  },
  "entities": [
    {
      "id": "chmzq50np0002gfixtr1qp64o",
      "name": "Settle",
      "artist": "Disclosure",
      "artistId": "chmzq4l480001gfixe8a3nzhm",
      "coverImage": "/covers/medium/zrms5gxr.jpg",
      "year": "2013",
      "genres": [
        "electronic",
        "house",
        "garage",
        "UK garage",
        "future garage"
      ]
    }
  ],
  "entityAttributes": {
    "rel": [
      "item"
    ],
    "class": [
      "album"
    ]
  },
  "links": [
    {
      "rel": [
        "self"
      ],
      "href": "/albums"
    }
  ]
}

However, I think this would be better expressed like this:

{
  "title": "Albums",
  "description": "Some great albums you should listen to.",
  "entityCount": 1,
  "entities": [
    {
      "id": "chmzq50np0002gfixtr1qp64o",
      "name": "Settle",
      "artist": "Disclosure",
      "artistId": "chmzq4l480001gfixe8a3nzhm",
      "coverImage": "/covers/medium/zrms5gxr.jpg",
      "year": "2013",
      "genres": [
        "electronic",
        "house",
        "garage",
        "UK garage",
        "future garage"
      ]
    }
  ],
  "entityAttributes": {
    "rel": [
      "item"
    ],
    "class": [
      "album"
    ]
  },
  "links": [
    {
      "rel": [
        "self"
      ],
      "href": "/albums"
    }
  ]
}

Note that this is also using the proposed "entityAttributes" extension, which I proposed in [#17].

@ericelliott
Copy link
Contributor Author

On second thought, these things could all possibly be useful to the user of the client app. Let's leave them on properties.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant