# `MishkaCmsCore.Runtime.Resources.Validations.ParentBelongsToDocument`
[🔗](https://github.com/mishka-group/mishka_cms_core/blob/v0.0.1/lib/mishka_cms_core/runtime/resources/__validations/parent_belongs_to_document.ex#L5)

The two things a reply's parent has to be.

Learned from `MishkaBlog.Comment`, which carries the same pair for the same reasons and has had
longer to find out they were needed:

  * **On the same document.** A reply that answers a note about another page is not an answer; it
    is a note that has been moved somewhere nobody will look for it, silently, because the thread
    it appears in is chosen by `document_id` and not by the parent.
  * **Not itself.** A row that is its own parent is a cycle, and every renderer that walks the
    thread hangs on it. A form cannot produce this by hand, but a stale id or a copied payload
    can.

Both are checked here rather than in the panel because the panel is not the only way in — the
JSON:API and a seed reach the same actions.

Nothing is checked when `parent_comment_id` is absent: a note that starts a thread is the common
case and has no parent to be wrong about.

---

*Consult [api-reference.md](api-reference.md) for complete listing*
