Hi there,
I thought about this problem, so I will share you what I did, because I had the same problem.
First of all, I am using REST API.
So, when I want to complete a task, I would like to check if there's no subtask(s). At the beginning, I do a GET call with
<code>
GET runtime/tasks/" + myTaskId + "/subtasks
</code>
if it retrieves null, I can complete the task, otherwise I force the completion of the subtasks.
When I want to create a subtask, I create a normal one, and at the end I give a "parentTaskId". So when I edit my subtask, I can see that the field "parentTaskId" has a value, and when I want to complete this parent task, it will retrieve impossible because of existing subtask(s).
If this helped anyone …
Regards,
Aurelien