jsonpointer

package
v0.48.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 5, 2022 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Overview

Package jsonpointer contains RFC 6901 JSON Pointer implementation.

Index

Constants

View Source
const DefaultDepthLimit = 1000

DefaultDepthLimit is default depth limit for ResolveCtx.

Variables

This section is empty.

Functions

func Resolve

func Resolve(ptr string, node *yaml.Node) (*yaml.Node, error)

Resolve takes given pointer and returns byte slice of requested value if any. If value not found, returns NotFoundError.

Types

type NotFoundError

type NotFoundError struct {
	Pointer string
}

NotFoundError reports that requested value is not found.

func (*NotFoundError) Error

func (n *NotFoundError) Error() string

Error implements error.

type RefKey added in v0.48.0

type RefKey struct {
	Loc string
	Ref string
}

RefKey is JSON reference key.

func (*RefKey) FromURL added in v0.48.0

func (r *RefKey) FromURL(u *url.URL)

FromURL sets RefKey from URL.

type ResolveCtx added in v0.48.0

type ResolveCtx struct {
	// contains filtered or unexported fields
}

ResolveCtx is JSON pointer resolve context.

func DefaultCtx added in v0.48.0

func DefaultCtx() *ResolveCtx

DefaultCtx creates new ResolveCtx with default depth limit.

func NewResolveCtx added in v0.48.0

func NewResolveCtx(depthLimit int) *ResolveCtx

NewResolveCtx creates new ResolveCtx.

func (*ResolveCtx) Add added in v0.48.0

func (r *ResolveCtx) Add(ref string) (key RefKey, err error)

Add adds reference to context and returns key.

func (*ResolveCtx) AddKey added in v0.48.2

func (r *ResolveCtx) AddKey(key RefKey) error

AddKey adds reference key to context.

func (*ResolveCtx) Delete added in v0.48.0

func (r *ResolveCtx) Delete(key RefKey)

Delete removes reference from context.

func (*ResolveCtx) Key added in v0.48.2

func (r *ResolveCtx) Key(ref string) (key RefKey, _ error)

Key creates new reference key.

func (*ResolveCtx) LastLoc added in v0.48.0

func (r *ResolveCtx) LastLoc() string

LastLoc returns last location from stack.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL