If you use curies then the _links in HAL-compatible JSON looks like this:
"_links": {
"curies": [
{
"name": "image",
"href": null,
"templated": true
}
],
"thumbnail": {
"href": "https://d32dm0rphc51dk.cloudfront.net/Bzp0BLipfnPU1hd6DHyHJw/medium.jpg"
},
"image:self": {
"href": "{?image_version}.jpg",
"templated": true
},
"self": {
"href": "https://api.artsy.net/api/shows/4ea19ee97bab1a0001001908"
},
...
which means that:
/// A function to deserialize a HAL structure into a HTTP Transition.
public func deserializeHAL(hal:[String:AnyObject]) -> Representor<HTTPTransition> {
var hal = hal
var links = [String:HTTPTransition]()
if let halLinks = hal.removeValueForKey("_links") as? [String:[String:AnyObject]] {
links = parseHALLinks(halLinks)
}
Fails at if let halLinks = hal.removeValueForKey("_links") as? [String:[String:AnyObject]] {.
If you use curies then the
_linksin HAL-compatible JSON looks like this:which means that:
Fails at
if let halLinks = hal.removeValueForKey("_links") as? [String:[String:AnyObject]] {.