MCPcopy Create free account
hub / github.com/google/go-github / normalizeOpPath

Function normalizeOpPath

tools/metadata/metadata.go:83–97  ·  view source on GitHub ↗

normalizeOpPath returns an endpoint with all templated path parameters replaced with *.

(opPath string)

Source from the content-addressed store, hash-verified

81
82// normalizeOpPath returns an endpoint with all templated path parameters replaced with *.
83func 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
99func normalizedOpName(name string) string {
100 verb, u := parseOpName(name)

Callers 1

normalizedOpNameFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…