We have a template which has an item and a graph containing that item. And we have a host which uses that template and automatically we have child item and child graph. In frontend it's not allowed to add items from other hosts and templates, but in API it's allowed and results in corrupted child graph. See attached image for more visual explanation.
API should validate if graph item belongs to corresponding template and trow and error if it doesn't.