ref

package module
v0.0.0-...-750e8a9 Latest Latest
Warning

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

Go to latest
Published: Sep 30, 2020 License: Apache-2.0 Imports: 4 Imported by: 0

README

JSON Reference

JSON Reference allows a JSON value to reference another value in a JSON document.


Allows a JSON value to reference another value in a JSON document. This provides the basis for transclusion in JSON: the use of a target resource as an effective substitute for the reference.

Source: draft-pbryan-zyp-json-ref-03

Documentation

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type JSONReference

type JSONReference struct {
	URL     *url.URL
	Pointer ptr.JSONPointer
}

func New

func New(reference string) (JSONReference, error)
Example (Fragment)
package main

import (
	"fmt"
	ref "github.com/oas3/json-reference"
)

func main() {
	r, _ := ref.New("#/ok")
	fmt.Println(r.URL.String())
	fmt.Println(r.Pointer.String())

}
Output:
#/ok
/ok
Example (Full)
package main

import (
	"fmt"
	ref "github.com/oas3/json-reference"
)

func main() {
	r, _ := ref.New("http://example.com/example.json#/foo/bar")
	fmt.Println(r.URL.String())
	fmt.Println(r.Pointer.String())

}
Output:
http://example.com/example.json#/foo/bar
/foo/bar

Jump to

Keyboard shortcuts

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