-
Notifications
You must be signed in to change notification settings - Fork 71
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
Add name to embedded entities #31
Changes from all commits
71f65d7
de9f368
75284ef
a6ed10c
355b223
feb7d30
4a6d2ed
6590fde
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,27 +16,30 @@ The media type for JSON Siren is `application/vnd.siren+json`. | |
```json | ||
{ | ||
"class": [ "order" ], | ||
"properties": { | ||
"orderNumber": 42, | ||
"properties": { | ||
"orderNumber": 42, | ||
"itemCount": 3, | ||
"status": "pending" | ||
}, | ||
"entities": [ | ||
{ | ||
"class": [ "items", "collection" ], | ||
"rel": [ "http://x.io/rels/order-items" ], | ||
{ | ||
"id": "items", | ||
"rel": [ "http://x.io/rels/order-items" ], | ||
"href": "http://api.x.io/orders/42/items" | ||
}, | ||
{ | ||
"class": [ "info", "customer" ], | ||
"rel": [ "http://x.io/rels/customer" ], | ||
"properties": { | ||
"customerId": "pj123", | ||
"name": "Peter Joseph" | ||
}, | ||
"links": [ | ||
{ "rel": [ "self" ], "href": "http://api.x.io/customers/pj123" } | ||
] | ||
"id": "customer", | ||
"rel": [ "http://x.io/rels/customer" ], | ||
"entity": { | ||
"class": [ "info", "customer" ], | ||
"properties": { | ||
"customerId": "pj123", | ||
"name": "Peter Joseph" | ||
}, | ||
"links": [ | ||
{ "rel": [ "self" ], "href": "http://api.x.io/customers/pj123" } | ||
] | ||
} | ||
} | ||
], | ||
"actions": [ | ||
|
@@ -63,7 +66,7 @@ The media type for JSON Siren is `application/vnd.siren+json`. | |
|
||
##Introduction | ||
|
||
Siren is a hypermedia specification for representing entities. As HTML is used for visually representing documents on a Web site, Siren is a specification for presenting entities via a Web API. Siren offers structures to communicate information about entities, actions for executing state transitions, and links for client navigation. | ||
Siren is a hypermedia specification for representing entities. As HTML is used for visually representing documents on a Web site, Siren is a specification for presenting entities via a Web API. Siren offers structures to communicate information about entities, actions for executing state transitions, and links for client navigation. | ||
|
||
Siren is intended to be a general specification of a generic media type that can be applied to other types that are not inherently hypermedia-powered. The initial implementation is JSON Siren. Other implementations, such as XML Siren, may also be implemented using the Siren specification. | ||
|
||
|
@@ -104,7 +107,7 @@ A collection of action objects, represented in JSON Siren as an array such as `{ | |
####`title` | ||
Descriptive text about the entity. Optional. | ||
|
||
|
||
###Sub-Entities | ||
|
||
Sub-entities can be expressed as either an embedded link or an embedded representation. In JSON Siren, sub-entities are represented by an `entities` array, such as `{ "entities": [{ ... }] }`. | ||
|
@@ -113,9 +116,9 @@ Sub-entities can be expressed as either an embedded link or an embedded represen | |
|
||
A sub-entity that's an embedded link may contain the following: | ||
|
||
#####`class` | ||
#####`id` | ||
|
||
Describes the nature of an entity's content based on the current representation. Possible values are implementation-dependent and should be documented. MUST be an array of strings. Optional. | ||
The id of the sub-entity. Optional. | ||
|
||
#####`rel` | ||
|
||
|
@@ -127,7 +130,11 @@ The URI of the linked sub-entity. Required. | |
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is there a good reason to remove the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
There is still the section that defines what a rel is and it states that it is required for sub entities. (it just doesn't show up in the diff) Is there a better way to communicate the |
||
####Embedded Representation | ||
|
||
Embedded sub-entity representations retain all the characteristics of a standard entity, but MUST also contain a `rel` attribute describing the relationship of the sub-entity to its parent. | ||
Unlike an embedded link, a sub-entity that's an embedded representation must contain an `entity` instead of an `href`: | ||
|
||
#####`entity` | ||
|
||
The embedded representation of the entity, retaining all the characteristics of a standard entity. Required. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This would be a good place to note the |
||
|
||
###Classes vs. Relationships | ||
|
||
|
@@ -200,7 +207,7 @@ A name describing the control. Required. | |
The input type of the field. This may include any of the following [input types](http://www.w3.org/TR/html5/single-page.html#the-input-element) specified in HTML5: | ||
|
||
`hidden`, `text`, `search`, `tel`, `url`, `email`, `password`, `datetime`, `date`, | ||
`month`, `week`, `time`, `datetime-local`, | ||
`month`, `week`, `time`, `datetime-local`, | ||
`number`, `range`, `color`, `checkbox`, | ||
`radio`, `file`, `image`, `reset`, `button` | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The "standard entity" representation. It's now nested inside of a sub-entity wrapper. By doing this we don't have to modify the actual entity if its nested. Attributes like "href", "rel", and "name" would go in the sub-entity wrapper since they would never be found on the standard entity.
*I'm using the term "standard entity" in the way it is used in the docs to signify an entity that is not a "sub-entity"