Deep creating relations with pass option doesn't work
I can't seem to get this example
const postProps = {
title: 'Relations',
comments: [
{
content: 'Awesome!'
},
{
content: 'So cool!'
}
]
};
store.create('post', postProps, { pass: ['comments'] })
.then((post) => {
// done
post.id === post.comments[0].post_id; // true!
});
at https://www.js-data.io/docs/relations#section-deep-creating-relations to work.
Although the objects serialize properly, the base adapter's withoutSerialization call on create, createMany, update, etc... filters out the relations because it expects the whitelisted relations to be specified in opts.with instead of opts.pass.
https://next.plnkr.co/edit/IXtJWp3gDy3fgqfY?preview
Just copying opts.pass to opts.with works for me:
https://github.com/Tyler-Zhang/js-data-http/tree/fix-deep-creating-relations-with-pass-opts
Copying opts.pass content to opts.with allows to bypass the filtering but it triggers a cascading create.