Skip to content

Hyper-Schema examples: wrong, confusing, or changed? #97

Closed
@jdesrosiers

Description

@jdesrosiers

This example is either wrong, confusing, or significantly changes the semantics of Hyper-Schema. All of the examples look like this, so I'm concerned.

For example, if a schema is defined:

 {
    "links": [{
        "rel": "self",
        "href": "{id}"
   }, {
        "rel": "up",
        "href": "{upId}"
    }]
}

And if a collection of instance resources were retrieved with JSON
representation:

GET /Resource/

[{
    "id": "thing",
    "upId": "parent"
}, {
    "id": "thing2",
    "upId": "parent"
}]

Wrong
This Hyper-Schema and JSON Document do not match up in a meaningful way. The links apply to the array, not the items in the list. An array has no property "id" or "upId", so neither of these links will apply.

Confusing
Maybe you intended that the Hyper-Schema was a segment of the full Hyper-Schema describing this resource and that the LDO applied to each item in the list. In that case, the example is confusing and misleading.

Changed
The other option is that you changed the semantics of how LDO's work in a way that is not well documented.

A Hyper-Schema that correctly describes the JSON Document in the example would look like this.

{
    "type": "array",
    "items": {
        "links": [{
            "rel": "self",
            "href": "{id}"
        }, {
            "rel": "up",
            "href": "{upId}"
        }]
    }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions