Fix nested namespaces parsing and resource resolving#1028
Merged
lgebhardt merged 1 commit intoJSONAPI-Resources:masterfrom May 5, 2017
Merged
Fix nested namespaces parsing and resource resolving#1028lgebhardt merged 1 commit intoJSONAPI-Resources:masterfrom
lgebhardt merged 1 commit intoJSONAPI-Resources:masterfrom
Conversation
Contributor
|
@elvanja Thanks! |
|
This issue was causing me some pain. Thanks for the fix, @elvanja |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
With this setup:
, there were several things that didn't work:
class_name: 'Managing::Profile'inCompanyResource, it would report that it could not find related modelhttp://localhost:3000/api/v1/companies/3?include=default_managing_profile, it would also break, unable to find the related resourceexample of post payload:
{ "data": { "attributes": { "name": "Dummy" }, "relationships": { "default_managing_profile": { "data": { "type": "profiles", "id": "3" } } }, "type": "companies" } }I also tried setting the data type for
default_managing_profileto one of:managing/profiles/managing/profilesManaging::Profilemanaging_profilesand probably some other too, but without luck.
The fix in
resource.rbsolved first two issues. The fix inrequest_parser.rbfixed the last one. I tried adding related tests, but could not find a simple way to test the last issue.Hopefully this makes sense 😄
P.S. I've noticed that
RequestParser#parse_to_many_relationshiphas a bit different logic thanparse_to_one_relationshipso maybe I'm missing something here. Maybe there is a way to accomplish the desired outcome without this fix?P.P.S. Possibly related to #893 and #927.