normalizeOpPath returns an endpoint with all templated path parameters replaced with *.
(opPath string)
| 81 | |
| 82 | // normalizeOpPath returns an endpoint with all templated path parameters replaced with *. |
| 83 | func normalizeOpPath(opPath string) string { |
| 84 | if !strings.ContainsAny(opPath, "{%") { |
| 85 | return opPath |
| 86 | } |
| 87 | segments := strings.Split(opPath, "/") |
| 88 | for i, segment := range segments { |
| 89 | if len(segment) == 0 { |
| 90 | continue |
| 91 | } |
| 92 | if segment[0] == '{' || segment[0] == '%' { |
| 93 | segments[i] = "*" |
| 94 | } |
| 95 | } |
| 96 | return strings.Join(segments, "/") |
| 97 | } |
| 98 | |
| 99 | func normalizedOpName(name string) string { |
| 100 | verb, u := parseOpName(name) |
no outgoing calls
no test coverage detected
searching dependent graphs…