MCPcopy Index your code
hub / github.com/go-openapi/jsonpointer / parse

Method parse

pointer.go:216–230  ·  view source on GitHub ↗

"Constructor", parses the given string JSON pointer.

(jsonPointerString string)

Source from the content-addressed store, hash-verified

214
215// "Constructor", parses the given string JSON pointer.
216func (p *Pointer) parse(jsonPointerString string) error {
217 if jsonPointerString == emptyPointer {
218 return nil
219 }
220
221 if !strings.HasPrefix(jsonPointerString, pointerSeparator) {
222 // non empty pointer must start with "/"
223 return errors.Join(ErrInvalidStart, ErrPointer)
224 }
225
226 referenceTokens := strings.Split(jsonPointerString, pointerSeparator)
227 p.referenceTokens = append(p.referenceTokens, referenceTokens[1:]...)
228
229 return nil
230}
231
232func (p *Pointer) get(node any, nameProvider NameProvider) (any, reflect.Kind, error) {
233 if nameProvider == nil {

Callers 1

NewFunction · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected