Skip to content

Instantly share code, notes, and snippets.

@zdne
Last active February 16, 2016 14:59
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save zdne/988a54c03609655f47b7 to your computer and use it in GitHub Desktop.
Save zdne/988a54c03609655f47b7 to your computer and use it in GitHub Desktop.
HAL in MSON
# HAL Model
[HAL Specification](https://tools.ietf.org/html/draft-kelly-json-hal-07): `draft-kelly-json-hal-07`
# Data Structures
## HAL Resource (object)
HAL Specification: [Resource Object](https://tools.ietf.org/html/draft-kelly-json-hal-07#section-4)
### Properties
- `_links`
- *relation* (Link)
- curies (array[CURIE], optional)
- `_embedded`
- *relation* (Embedded)
## Embedded (enum)
HAL Specification: [`_embedded` property value](https://tools.ietf.org/html/draft-kelly-json-hal-07#section-4.1.2)
The value is either a descendant of `HAL Resource Base` or an array of its descendats.
### Members
- (HAL Resource)
- (array[HAL Resource])
## Link (object)
HAL Specification: [Link Object](https://tools.ietf.org/html/draft-kelly-json-hal-07#section-5)
### Properties
- href (string, required)
- templated (boolean, optional)
- type (string, optional)
- deprecation (string, optional)
- name (string, optional)
- profile (string, optional)
- title (string, optional)
- hreflang (string, optional)
## CURIE (Link)
HAL Specification: [Link relations](https://tools.ietf.org/html/draft-kelly-json-hal-07#section-8.2)
### Properties
- name (string, required)
- templated: true (string, required, fixed)
## List of Orders (HAL Resource)
HAL Specification: [Example Document](https://tools.ietf.org/html/draft-kelly-json-hal-07#section-6)
### Properties
- `_links`
- self (Link)
- href: /orders
- next (Link)
- href: /orders?page=2
- find (Link)
- href: /orders{?id}
- templated: true
- `_embedded`
- orders (array[Order])
- currentlyProcessing: 14 (number)
- shippedToday: 20 (number)
## Order (HAL Resource)
- `_links`
- self (Link)
- href: /orders/123
- basket (Link)
- href: /baskets/98712
- customer (Link)
- href: /customers/7809
- total (number)
- Sample: 30
- Sample: 20
- currency: USD (string)
- status (enum)
- processing
- shipped
# HAL Model
[HAL Specification](https://tools.ietf.org/html/draft-kelly-json-hal-07): `draft-kelly-json-hal-07`
# Data Structures
## HAL Resource Base (object)
Abstract base object. Not to be used directly. See `HAL Resource`.
## HAL Resource (HAL Resource Base)
HAL Specification: [Resource Object](https://tools.ietf.org/html/draft-kelly-json-hal-07#section-4)
### Properties
- `_links`
- *relation* (Link)
- curies (array[CURIE], optional)
- `_embedded`
- *relation* (Embedded)
## Embedded (enum)
HAL Specification: [`_embedded` property value](https://tools.ietf.org/html/draft-kelly-json-hal-07#section-4.1.2)
The value is either a descendant of `HAL Resource Base` or an array of its descendats.
### Members
- (HAL Resource Base)
- (array[HAL Resource Base])
## Link (object)
HAL Specification: [Link Object](https://tools.ietf.org/html/draft-kelly-json-hal-07#section-5)
### Properties
- href (string, required)
- templated (boolean, optional)
- type (string, optional)
- deprecation (string, optional)
- name (string, optional)
- profile (string, optional)
- title (string, optional)
- hreflang (string, optional)
## CURIE (Link)
HAL Specification: [Link relations](https://tools.ietf.org/html/draft-kelly-json-hal-07#section-8.2)
### Properties
- name (string, required)
- templated: true (string, required, fixed)
## List of Orders (HAL Resource)
HAL Specification: [Example Document](https://tools.ietf.org/html/draft-kelly-json-hal-07#section-6)
### Properties
- `_links`
- self (Link)
- href: /orders
- next (Link)
- href: /orders?page=2
- find (Link)
- href: /orders{?id}
- templated: true
- `_embedded`
- orders (array[Order])
- currentlyProcessing: 14 (number)
- shippedToday: 20 (number)
## Order (HAL Resource)
- `_links`
- self (Link)
- href: /orders/123
- basket (Link)
- href: /baskets/98712
- customer (Link)
- href: /customers/7809
- total (number)
- Sample: 30
- Sample: 20
- currency: USD (string)
- status (enum)
- processing
- shipped

HAL Model

HAL Specification: draft-kelly-json-hal-07

Data Structures

HAL Resource Base (object)

Abstract base object. Not to be used directly. See HAL Resource.

HAL Resource (HAL Resource Base)

HAL Specification: Resource Object

Properties

  • _links

    • relation (Link)
    • curies (array[CURIE], optional)
  • _embedded

    • relation (Embedded)

Embedded (enum)

HAL Specification: _embedded property value

The value is either a descendant of HAL Resource Base or an array of its descendats.

Members

  • (HAL Resource Base)
  • (array[HAL Resource Base])

Link (object)

HAL Specification: Link Object

Properties

  • href (string, required)
  • templated (boolean, optional)
  • type (string, optional)
  • deprecation (string, optional)
  • name (string, optional)
  • profile (string, optional)
  • title (string, optional)
  • hreflang (string, optional)

CURIE (Link)

HAL Specification: Link relations

Properties

  • name (string, required)
  • templated: true (string, required, fixed)

List of Orders (HAL Resource)

HAL Specification: Example Document

Properties

  • _links

    • self (Link)
      • href: /orders
    • next (Link)
      • href: /orders?page=2
    • find (Link)
      • href: /orders{?id}
      • templated: true
  • _embedded

    • orders (array[Order])
  • currentlyProcessing: 14 (number)

  • shippedToday: 20 (number)

Order (HAL Resource)

  • _links

    • self (Link)
      • href: /orders/123
    • basket (Link)
      • href: /baskets/98712
    • customer (Link)
      • href: /customers/7809
  • total (number)

    • Sample: 30
    • Sample: 20
  • currency: USD (string)

  • status (enum)

    • processing
    • shipped
{
"_links": {
"self": {
"href": "/orders"
},
"next": {
"href": "/orders?page=2"
},
"find": {
"href": "/orders{?id}",
"templated": "true"
}
},
"_embedded": {
"orders": [
{
"_links": {
"self": {
"href": "/orders/123"
},
"basket": {
"href": "/baskets/98712"
},
"customer": {
"href": "/customers/7809"
}
},
"_embedded": {
"relation": {}
},
"total": 30,
"currency": "USD",
"status": "processing"
}
]
},
"currentlyProcessing": 14,
"shippedToday": 20
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment