Skip to content
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

HAL support for multiple link objects per relationship? #58

Closed
abargnesi opened this issue Jan 23, 2015 · 1 comment · Fixed by #60
Closed

HAL support for multiple link objects per relationship? #58

abargnesi opened this issue Jan 23, 2015 · 1 comment · Fixed by #60

Comments

@abargnesi
Copy link
Contributor

I am trying to capture multiple item link objects in a HAL representation. Something like:

{
  "person": {
    "name": "Oaty",
    "_links": {
      "item": [
        {
          "type": "address",
          "href": "/people/1/address/1"
        },
        {
          "type": "address",
          "href": "/people/1/address/2"
        }
      ]
    }
  }
}

The HAL adapter seems to need an :href key on the link hash (e.g. opts[:href]) to set the link object for the relationship (lib/oat/adapters/hal.rb:6).

Is there another way to set an array of link objects for a single relationship? HAL supports this (spec reference).

@ismasan
Copy link
Owner

ismasan commented Jan 24, 2015

Hi.

Thanks for this. The current HAL implementation needs to be brought up to date with the current spec in order to cover this. Happy to accept pull requests for this specific feature.

abargnesi added a commit to abargnesi/oat that referenced this issue Feb 5, 2015
This change does not affect the interface of the link method. The
options hash position can be a type of Array which conveys multiple
linked objects for a single relationship.

The specification tests were updated as a new rspec context so the
existing tests would not be affected.

fixes ismasan#58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants