go-openapi/jsonpointer
GitHub: go-openapi/jsonpointer
Stars: 51 | Forks: 18
# jsonpointer
[][test-url] [][cov-url] [][vuln-scan-url] [][codeql-url]
[][release-url] [][gocard-url] [][codefactor-url] [][license-url]
[][godoc-url] [][discord-url] [][goversion-url]  
An implementation of JSON Pointer for golang, which supports go `struct`.
## Announcements
## Status
API is stable and feature-complete.
## Import this library in your project
go get github.com/go-openapi/jsonpointer
## Basic usage
See also some [examples](./examples_test.go)
### Retrieving a value
import (
"github.com/go-openapi/jsonpointer"
)
var doc any
...
pointer, err := jsonpointer.New("/foo/1")
if err != nil {
... // error: e.g. invalid JSON pointer specification
}
value, kind, err := pointer.Get(doc)
if err != nil {
... // error: e.g. key not found, index out of bounds, etc.
}
...
### Setting a value
...
var doc any
...
pointer, err := jsonpointer.New("/foo/1")
if err != nil {
... // error: e.g. invalid JSON pointer specification
}
doc, err = p.Set(doc, "value")
if err != nil {
... // error: e.g. key not found, index out of bounds, etc.
}
## Change log
See
## References
also known as [RFC6901][RFC6901].
## Licensing
This library ships under the [SPDX-License-Identifier: Apache-2.0](./LICENSE).
See the license [NOTICE](./NOTICE), which recalls the licensing terms of all the pieces of software
on top of which it has been built.
## Limitations
* [RFC6901][RFC6901] is now fully supported, including trailing "-" semantics for arrays (for `Set` operations).
* Default behavior: JSON name detection in go `struct`s
- Unlike go standard marshaling, untagged fields do not default to the go field name and are ignored.
- anonymous fields are not traversed if untagged
- the above limitations may be overcome by calling `UseGoNameProvider()` at initialization time.
- alternatively, users may inject the desired custom behavior for naming fields as an option.
## Other documentation
## Cutting a new release
Maintainers can cut a new release by either:
* running [this workflow](https://github.com/go-openapi/jsonpointer/actions/workflows/bump-release.yml)
* or pushing a semver tag
* signed tags are preferred
* The tag message is prepended to release notes
标签:EVTX分析