jpiquot / ChildTasksTemplate

Apache License 2.0
8 stars 4 forks source link

compact json option? [low priority] #12

Open o-o00o-o opened 2 years ago

o-o00o-o commented 2 years ago

the json structure is very verbose and allows duplicate collection and field names which are not desirable.

these could be both solved by using objects instead of arrays, so instead of:

{
    "name": "My Example Tasks",
    "tasks": [
        {
            "name": "My Design Task",
            "fields": [
                {
                    "name": "System.Title",
                    "value": "{System.Title} AF:{id}"
                },
                {
                    "name": "System.IterationPath",
                    "value": "{System.IterationPath}"
                },
                {
                    "name": "System.AreaPath",
                    "value": "{System.AreaPath}"
                },
                {
                    "name": "Microsoft.VSTS.Common.Priority",
                    "value": "{Microsoft.VSTS.Common.Priority}"
                },
                {
                    "name": "Microsoft.VSTS.Common.Activity",
                    "value": "Design"
                }
            ]
        }
    ]
}

how about

{
    "My Example Tasks": {
        "tasks": {
            "My Design Task": {
                "fields": {
                    "System.Title": "{System.Title} AF:{id}",
                    "System.IterationPath": "{System.IterationPath}",
                    "System.AreaPath": "{System.AreaPath}",
                    "Microsoft.VSTS.Common.Priority": "{Microsoft.VSTS.Common.Priority}",
                    "Microsoft.VSTS.Common.Activity": "Design"
                }
            }
        }
    }
}

or to include the idea from #13

{
    "My Example Tasks": {
        "workItems": [
            "Bug",
            "Product Backlog Item"
        ],
        "children": {
            "My Design Task": {
                "workItemType": "Task",
                "fields": {
                    "System.Title": "{System.Title} AF:{id}",
                    "System.IterationPath": "{System.IterationPath}",
                    "System.AreaPath": "{System.AreaPath}",
                    "Microsoft.VSTS.Common.Priority": "{Microsoft.VSTS.Common.Priority}",
                    "Microsoft.VSTS.Common.Activity": "Design"
                }
            }
        }
    }
}

This way it isn't valid json to have duplicate "example Tasks" or duplicate fields inside a single task and autoformat produces more concise code

o-o00o-o commented 2 years ago

I've actually solved this for now by building something like the above and a powershell that generates ChildTasksTemplate json correctly.

So for me this is now a lower priority issue