Skip to content
This repository was archived by the owner on Nov 13, 2019. It is now read-only.
This repository was archived by the owner on Nov 13, 2019. It is now read-only.

Support for polymorphic relationship target types #15

Description

@emetsger

Relationships between OSF objects are represented as URIs in the spirit of IANA link relations (e.g. related, self) per the JSON-API 1.0 spec. The name of the relationship can be thought of as the URI type. For example, a Node may have an affiliated_institutions relationship, and the relationship may carry multiple link relations. One for manipulating the relationship itself (self) and one for retrieving the target of the relationship (related):

{
  "affiliated_institutions": {
    "links": {
      "self": {
        "href": "http://localhost:8000/v2/nodes/xug4a/relationships/institutions/",
        "meta": {}
      },
      "related": {
        "href": "http://localhost:8000/v2/nodes/xug4a/institutions/",
        "meta": {}
      }
    }
  }
}

The type of resource (or resources) targeted by a link are typically clear. Resolving the affiliated_institutions related link will result in a JSON document representing Institutions. However, the type is not always clear, and additional information is required. For example, the target relationship of a comments object may point to another Comment, Node, or Registration:

{
  "target": {
    "links": {
      "related": {
        "href": "http://localhost:8000/v2/nodes/y9jdt/",
        "meta": {
          "type": "nodes"
        }
      }
    }
  }
}

In this case, the target relationship will resolve to a Node object as specified in the meta section of the related link object.

The OSF Java client API needs to be updated to support the resolution of relationships that may result in distinct object types.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions