I am wondering if there is a best practise for resources that have a relationship with themselves. For example if I have an
images resource and an image can have different
images related to them, like a mobile version of the image.
My main question is how I would name the relationship.
I can not use image for both the relationship and the inverse relationship, obviously.
So would the image have a relationship
images which would give me all related “child”
images and a relationship
parentimages that would give me the parent `images? “Parent” by itself does not work, because a back and forth relationship might also exists for more tables.
e.g. a comment could be related to an image as in “comment in the image” but an image could also be related to a comment as in “an image inside a comment”.
I hope you understand my naming problem. I need some kind of rule, so that an api user knows how to retrieve those kinds of relationships.