func findDeepestPath(paths []*Path, pathString string) *Path {
	for _, path := range paths {
		if strings.HasPrefix(pathString, path.Endpoint.TemplateURL) {
			// matches endpoint. Check children
			match := findDeepestPath(path.Children, pathString)
			if match == nil {
				match = findDeepestPath(path.SubPaths, pathString)
				if match == nil {
					return path
				}
			}
			return match
		}
	}
	return nil
}
// findDeepestPath searches the endpoints tree to find the deepest point that the specified path can be nested at (used to build up the endpoint hierarchy)
findDeepestPath searches the endpoints tree to find the deepest point that the specified path can be nested at (used to build up the endpoint hierarchy)
// findDeepestPath searches the endpoints tree to find the deepest point that the specified path can be nested at ( used to build up the endpoint hierarchy )
func findDeepestPath(paths []*Path, pathString string) *Path {
	for _, path := range paths {
		if strings.HasPrefix(pathString, path.Endpoint.TemplateURL) {
			match := findDeepestPath(path.Children, pathString)
			if match == nil {
				match = findDeepestPath(path.SubPaths, pathString)
				if match == nil {
					return path
				}
			}
			return match
		}
	}
	return nil
}
func findDeepestPath ( paths [ ] * Path , pathString string ) * Path { for _ , path := range paths { if strings . HasPrefix ( pathString , path . Endpoint . TemplateURL ) { match := findDeepestPath ( path . Children , pathString ) if match == nil { match = findDeepestPath ( path . SubPaths , pathString ) if match == nil { return path } } return match } } return nil }
findDeepestPath searches the endpoints tree to find the deepest point that the specified path can be nested at (used to build up the endpoint hierarchy)
findDeepestPath searches the endpoints tree to find the deepest point that the specified path can be nested at ( used to build up the endpoint hierarchy )
// matches endpoint. Check children