MCPcopy
hub / github.com/dosco/graphjin / isSingleResourcePath

Function isSingleResourcePath

core/openapi/classifier.go:375–382  ·  view source on GitHub ↗

isSingleResourcePath returns true when the path's only path parameter is at the trailing position (e.g. /users/{userId}, /accounts/{aid}). We deliberately reject paths like /users/{userId}/profile because their semantic mapping to a join key is ambiguous without explicit user input.

(path string)

Source from the content-addressed store, hash-verified

373// We deliberately reject paths like /users/{userId}/profile because their
374// semantic mapping to a join key is ambiguous without explicit user input.
375func isSingleResourcePath(path string) bool {
376 segs := strings.Split(strings.Trim(path, "/"), "/")
377 if len(segs) == 0 {
378 return false
379 }
380 last := segs[len(segs)-1]
381 return strings.HasPrefix(last, "{") && strings.HasSuffix(last, "}")
382}
383
384// splitPath turns "data.items" into ["data", "items"]. Empty input
385// returns nil so downstream code can treat "no result path" as a single

Callers 1

classifyOneFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected