-
-
Notifications
You must be signed in to change notification settings - Fork 158
Error PATCH'ing with json relationship #282
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
Comments
@joshhubers this should be fixed by #254. There is some mixing of concerns in the de-serialization process that required this call:
The original approach to updating relationships, was to actually fetch the relationship so EF would track it and it could be updated 😞 . However, #254 is removing that requirement. The reason you are getting the above error is because when we try to resolve the
So, while the error you're currently experiencing will be fixed soon, I think there may still be some other lurking issues, especially when trying to use the new implementation of json:api v1.1 operations. |
So I started using your 2.2.2-alpha1-0075 branch in my project. As per #254 . It has been working issue free, until I try to set the relationship to null/unset the relationship. Do you know of this issue or have a workaround? Edit: I should mention that the request goes through successfully, but the returned data still contains the relationship and the change does not persist. |
Any word on this? |
I had same problem. The temp solution for me is define extra "reset" route to unset relationship and make second request after Patch. The most similar http method is HttpDelete, so for your case it should be:
After fix, this route can be removed and start using standard Patch |
@joshhubers sorry for the delay on this. I'm working on wrapping up a few other items but should be able to finish this out this week. Thanks @joshhubers and @milosloub for grabbing the alpha and providing feedback! That is super helpful. |
The error you hit around dropping relationships has been fixed on #254...if you don't mind, can you try pulling the latest pre-release (2.2.5-alpha1-0086)? If that works for you guys, then I think that PR is just about ready to merge. |
@jaredcnance Looks to be working on my end! |
I'll do my best to be brief and descriptive.
I should mention the application has two DbContexts and so far everything has been working well.
I have two seperate IDbContextResolvers, one for each of my database contexts. I DI the resolvers, and have seperate base repositories for each database connection and repositories for each model that extend from the two repositories. (As per #269 ).
I have a model EntityA which has a has-one relationship with EntityB
EntityB has-many EntityA's
Calling a PATCH to EntityB endpoint works as expected when I DO NOT include the json
relationships: ...
which include EntityA'sCalling a PATCH to EntityB endpoint errors when PATCH'ing with relationships included...
Endpoints for both EntityA and EntityB work fine, with no issues or other errors. Both EntityA and EntityB belong to the same repository and should fall under the same context resolver. I don't believe I'm missing anything obvious as everything else has been working perfectly, and I'm not sure if it's an issue because of the multiple IDbContextResolvers or not.
The text was updated successfully, but these errors were encountered: