MCPcopy Index your code
hub / github.com/oapi-codegen/oapi-codegen / RefPathToObjName

Function RefPathToObjName

pkg/codegen/utils.go:425–431  ·  view source on GitHub ↗

RefPathToObjName returns the name of referenced object without changes. #/components/schemas/Foo -> Foo #/components/parameters/Bar -> Bar #/components/responses/baz_baz -> baz_baz document.json#/Foo -> Foo http://deepmap.com/schemas/document.json#/objObj -> objObj Does not check refPath corr

(refPath string)

Source from the content-addressed store, hash-verified

423//
424// Does not check refPath correctness.
425func RefPathToObjName(refPath string) string {
426 parts := strings.Split(refPath, "/")
427 if len(parts) > 0 {
428 return parts[len(parts)-1]
429 }
430 return ""
431}
432
433// RefPathToGoType takes a $ref value and converts it to a Go typename.
434// #/components/schemas/Foo -> Foo

Callers 2

TestRefPathToObjNameFunction · 0.85
generateUnionFunction · 0.85

Calls

no outgoing calls

Tested by 1

TestRefPathToObjNameFunction · 0.68