Skip to content

Deserializer: Cannot deserialize included, independent HasOne #349

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

Closed
jaredcnance opened this issue Jul 20, 2018 · 0 comments · Fixed by #348
Closed

Deserializer: Cannot deserialize included, independent HasOne #349

jaredcnance opened this issue Jul 20, 2018 · 0 comments · Fixed by #348
Labels

Comments

@jaredcnance
Copy link
Contributor

jaredcnance commented Jul 20, 2018

If you try to deserialize a json:api document that includes a resource identifier object (RIO) that points from the independent side of the relationship to the dependent side, you will get the following error:

JsonApiDotNetCore.Internal.JsonApiException : Failed to deserialize request body
---- JsonApiDotNetCore.Internal.JsonApiException : Permissions does not contain a foreign key property 'RoleId' for has one relationship 'Role'

example:

{
   "data":{
      "type":"independents",
      "id":"4a129a19-bcf3-42f5-f229-08d5edf8dba5",
      "attributes":{
      },
      "relationships":{
         "dependents":{
            "data":{
               "type":"dependents",
               "id":"730bfc72-df9b-4193-de01-08d5edf8dba0"
            }
         }
      }
   }
}

Instead it should instantiate the dependent side and set the value.

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

Successfully merging a pull request may close this issue.

1 participant