loopback-component-jsonapi
loopback-component-jsonapi copied to clipboard
fix(deserializer): Unable to create polymorphic relationship #298
Adds polymorphic support for belongsTo relationships.
Thanks for the PR @grahambates ! Looks like theres a small lint error to get the tests passing
Coverage decreased (-0.9%) to 93.643% when pulling 94c439db7527ac1298061f7c8a16876175fe149a on grahambates:master into 40f928273fe50acfebb11cbaf2e0469f0d56efea on digitalsadhu:master.
Coverage increased (+0.08%) to 94.634% when pulling be3ab33509dba9117d583296cd9fb2bc049bc6e3 on grahambates:master into a7083aad413b3404bc1466650b20b6437983133a on digitalsadhu:master.
I've fixed the lint errors and added some tests.
The failing check is due to use of the spread operator in a dependency (strong-globalize) which breaks compatibility with node 4. This is obviously unreleated to the change.
In getting my tests to work I've also fixed an issue where the serializer did not handle optional polymorphic belongsTo relationships. It would trigger an error where the discriminator value was empty because the relationship was not set. I've added a test case for this too.