jsonreference

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Dec 25, 2015 License: Apache-2.0 Imports: 5 Imported by: 0

README

gojsonreference

An implementation of JSON Reference - Go language

Status

Work in progress ( 90% done )

Dependencies

https://github.com/xeipuuv/gojsonpointer

References

http://tools.ietf.org/html/draft-ietf-appsawg-json-pointer-07

http://tools.ietf.org/html/draft-pbryan-zyp-json-ref-03

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Ref

type Ref struct {
	HasFullURL      bool
	HasURLPathOnly  bool
	HasFragmentOnly bool
	HasFileScheme   bool
	HasFullFilePath bool
	// contains filtered or unexported fields
}

Ref represents a json reference object

func MustCreateRef

func MustCreateRef(ref string) Ref

MustCreateRef parses the ref string and panics when it's invalid. Use the New method for a version that returns an error

func New

func New(jsonReferenceString string) (Ref, error)

New creates a new reference for the given string

func (*Ref) GetPointer

func (r *Ref) GetPointer() *jsonpointer.Pointer

GetPointer gets the json pointer for this reference

func (*Ref) GetURL

func (r *Ref) GetURL() *url.URL

GetURL gets the URL for this reference

func (*Ref) Inherits

func (r *Ref) Inherits(child Ref) (*Ref, error)

Inherits creates a new reference from a parent and a child If the child cannot inherit from the parent, an error is returned

func (*Ref) IsCanonical

func (r *Ref) IsCanonical() bool

IsCanonical returns true when this pointer starts with http(s):// or file://

func (*Ref) IsRoot

func (r *Ref) IsRoot() bool

IsRoot returns true if this reference is a root document

func (*Ref) String

func (r *Ref) String() string

String returns the best version of the url for this reference

Jump to

Keyboard shortcuts

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