misc/agent-introspection-validator/agent-introspection-validator.go
func verifyTasksMetadata(tasksMetadataRawMsg json.RawMessage) error {
	var tasksMetadataMap map[string]json.RawMessage
	json.Unmarshal(tasksMetadataRawMsg, &tasksMetadataMap)

	if tasksMetadataMap["Tasks"] == nil {
		return notEmptyErrMsg("Tasks")
	}

	var tasksMetadataArray []json.RawMessage
	json.Unmarshal(tasksMetadataMap["Tasks"], &tasksMetadataArray)

	if len(tasksMetadataArray) != 1 {
		return fmt.Errorf("incorrect number of tasks, expected 1, received %d",
			len(tasksMetadataArray))
	}

	return verifyTaskMetadata(tasksMetadataArray[0])
}
func verifyTasksMetadata(tasksMetadataRawMsg json.RawMessage) error {
	var tasksMetadataMap map[string]json.RawMessage
	json.Unmarshal(tasksMetadataRawMsg, &tasksMetadataMap)

	if tasksMetadataMap["Tasks"] == nil {
		return notEmptyErrMsg("Tasks")
	}

	var tasksMetadataArray []json.RawMessage
	json.Unmarshal(tasksMetadataMap["Tasks"], &tasksMetadataArray)

	if len(tasksMetadataArray) != 1 {
		return fmt.Errorf("incorrect number of tasks, expected 1, received %d",
			len(tasksMetadataArray))
	}

	return verifyTaskMetadata(tasksMetadataArray[0])
}
// verifyTasksMetadata verifies the number of tasks in tasks metadata.