Err embedding when multiple relationships found #1401
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
When having one-to-many relationships like:
(Where
person_detail
is a view of person)This request:
Is ambiguous. Both
person
orperson_detail
could be embedded.Until now we have returned the first detected relationship but with this PR we would return a
300 Multiple Choices
error with this body:So, for the request to succeed, the user would have to disambiguate by following the
details
info:Or:
This gets more helpful when there are more complex relationships. The aim of this PR is to formalize the disambiguation capabilities we have.
As it is now, the disambiguation syntax is hard to grok and the duck typing stuff is hard to explain and document. We get frequent questions about this on gitter chat.
This will also help for future features like #818, were a wrong embed would result in a more serious error.
This PR would imply a breaking change.
(Related to #1230)