jsonpointer

package
v0.56.0-alpha.2 Latest Latest
Warning

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

Go to latest
Published: Dec 19, 2022 License: Apache-2.0 Imports: 7 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 DummyURL added in v0.55.0

func DummyURL() *url.URL

DummyURL is dummy URL for testing purposes.

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 is an URL of JSON document.
	Loc string
	// Ptr is JSON Pointer.
	Ptr 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.

func (RefKey) IsZero added in v0.55.0

func (r RefKey) IsZero() bool

IsZero returns true if RefKey is zero.

func (RefKey) String added in v0.55.0

func (r RefKey) String() string

String returns string representation of reference.

type ResolveCtx added in v0.48.0

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

ResolveCtx is JSON Reference resolve context.

func NewResolveCtx added in v0.48.0

func NewResolveCtx(root *url.URL, depthLimit int) *ResolveCtx

NewResolveCtx creates new ResolveCtx.

func (*ResolveCtx) AddKey added in v0.48.2

func (r *ResolveCtx) AddKey(key RefKey, file location.File) 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) File added in v0.53.0

func (r *ResolveCtx) File() (f location.File)

File returns last file from stack.

func (*ResolveCtx) IsRoot added in v0.54.0

func (r *ResolveCtx) IsRoot(key RefKey) bool

IsRoot returns true if location stack is empty.

func (*ResolveCtx) Key added in v0.48.2

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

Key creates new reference key.

Jump to

Keyboard shortcuts

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