When you start handling all possibilities of subtasks, get ready for more problems…
Subtasks can have no project (default), or “any” project. Not just the one from its parent.
Task1 -> Project 1
Task1.1 (no project)
Task1.3 (Project2) <-- !!!
If you want to make subtasks easier to query, I suggest to use the the “Advanced Search API”, if you have access to it, and filter subtasks.
GET /workspaces/xxx/tasks/search?is_subtasks=true (+ any other filter)
And, if you want only subtasks without projects:
You can have 5 levels of subtasks, each with 0, 1 or or multiple different projects on each level of subtasks!
Also, very funny…
You can open task 1.3, and go to “advanced options” and choose “make a subtask of”, and you choose any task, of any project, as the new parent of that subtask.
The subtask is now linked to the new task, but NOT the previous one,.
I think and hope I am right on it, 1 subtask can only have 1 parent.
So 1 subtask can’t be child of 2 different tasks…
Imagine if you have Subtask1 of Task1 in Project1, and you add subtask1 to project1. Now, use the “make subtask of” option, and choose Task 3 in Project 3!
Subtask1 in project1 is now owned by Task3 in project3. Is the subtask1 member of project1 from its membership property, or project3 from its “parent.project” property? And if the parent is member of multiple projects? It’s up to you!
Then, repeat it on 5 levels of subtask!
Subtasks can quickly become a real pain because a lot of possibilities are allowed.