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

Response when updating relationship of resource not conform spec #578

Closed
maurei opened this issue Oct 16, 2019 · 2 comments · Fixed by #875
Closed

Response when updating relationship of resource not conform spec #578

maurei opened this issue Oct 16, 2019 · 2 comments · Fixed by #875
Assignees

Comments

@maurei
Copy link
Member

maurei commented Oct 16, 2019

This issue is analogous to #577 but for relationships instead of attributes.

200 OK
If a server accepts an update but also changes the targeted relationship(s) in other ways than those specified by the request, it MUST return a 200 OK response. The response document MUST include a representation of the updated relationship(s).

A server MUST return a 200 OK status code if an update is successful, the client’s current data remain up to date, and the server responds only with top-level meta data. In this case the server MUST NOT include a representation of the updated relationship(s).

the part in bold is currently not properly implemented.

The associated repository method does not return anything:

public interface IEntityWriteRepository<TEntity, in TId>
    where TEntity : class, IIdentifiable<TId>
{
  ....
  Task UpdateRelationshipsAsync(object parent, RelationshipAttribute relationship, IEnumerable<string> relationshipIds);
  ....
}

This is fine for the default implementation. But if, as in #577, a developer has business logic that affects the relationships in a way different than as specified by the request, a response must include a representation of the updated relationships

@bart-degreed
Copy link
Contributor

If a server accepts an update but also changes the targeted relationship(s) in other ways than those specified by the request

I cannot think of a scenario in which this applies. An example would be helpful.

@maurei
Copy link
Member Author

maurei commented Nov 30, 2020

We have decided to hold off implementing this part of the spec because we are not sure what any use-case for this would be. For a more detailed consideration, please check out json-api/json-api#1524

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

Successfully merging a pull request may close this issue.

2 participants