mirror of
https://github.com/agent-substrate/substrate.git
synced 2026-11-12 10:35:06 +08:00
This mostly eliminates the need to hand-write validation code. This PR is a long series of commits which add DV for most of Actor and all of Atespace. Here is a map to the commits: * The first few take a dep on a new Kubernetes tag, import the code into third_party, and apply a single patch. Because we have different Go modules for tools, I had to do it twice. When that patch lands, we can revert these commits, but that won't be until the 1.38 cycle in a few months. * The next commits slowly add DV support, so a human can review each of them in a reasonable amount of time. The emphasis is on great test cases. * I made a bad choice early on as to where to generate the code into, so I moved it. Rebasing on that was exceedingly hard, so I left it as a move. * This required changing update/go-generate -> update/codegen -- we need to get the ordering of tools right, which `go generate` does not guarantee. * Then I added a "middle" layer called "ServiceImpl" between the RPC and storage layers. This allows things like workflow to call the same business logic as the RPC layer, including validation. Lots of test fixes. * Then I finished the Create() and Update() paths for Actor. Those represent the "right" (or closest to) way to implement resources, and tests for validation. I strongly encourage reviewers to read it commit-by-commit. Rebasing this is VERY tedious, so the sooner it lands or dies completely, the better. Then we can start converting the rest. `./hack/run-tool.sh validation-gen --docs` will produce some docs on the tool and the available tags. @laoj2 @juli4n @EItanya @HavenXia @lalitc375 @yongruilin @jpbetz FYI
124 lines
5.2 KiB
Markdown
124 lines
5.2 KiB
Markdown
# jsonreference
|
|
|
|
<!-- Badges: status -->
|
|
[![Tests][test-badge]][test-url] [![Coverage][cov-badge]][cov-url] [![CI vuln scan][vuln-scan-badge]][vuln-scan-url] [![CodeQL][codeql-badge]][codeql-url]
|
|
<!-- Badges: release & docker images -->
|
|
<!-- Badges: code quality -->
|
|
<!-- Badges: license & compliance -->
|
|
[![Release][release-badge]][release-url] [![Go Report Card][gocard-badge]][gocard-url] [![CodeFactor Grade][codefactor-badge]][codefactor-url] [![License][license-badge]][license-url]
|
|
<!-- Badges: documentation & support -->
|
|
<!-- Badges: others & stats -->
|
|
[![GoDoc][godoc-badge]][godoc-url] [![Discord Channel][discord-badge]][discord-url] [![go version][goversion-badge]][goversion-url] ![Top language][top-badge] ![Commits since latest release][commits-badge]
|
|
|
|
---
|
|
|
|
An implementation of JSON Reference for golang.
|
|
|
|
## Announcements
|
|
|
|
* **2026-07-07** : landing v1.0.0
|
|
* stable API pledge
|
|
|
|
## Status
|
|
|
|
API is stable.
|
|
|
|
## Import this library in your project
|
|
|
|
```cmd
|
|
go get github.com/go-openapi/jsonreference
|
|
```
|
|
|
|
## Dependencies
|
|
|
|
* <https://github.com/go-openapi/jsonpointer>
|
|
|
|
## Basic usage
|
|
|
|
```go
|
|
// Creating a new reference
|
|
ref, err := jsonreference.New("http://example.com/doc.json#/definitions/Pet")
|
|
|
|
// Fragment-only reference
|
|
fragRef := jsonreference.MustCreateRef("#/definitions/Pet")
|
|
|
|
// Resolving references
|
|
parent, _ := jsonreference.New("http://example.com/base.json")
|
|
child, _ := jsonreference.New("#/definitions/Pet")
|
|
resolved, _ := parent.Inherits(child)
|
|
// Result: "http://example.com/base.json#/definitions/Pet"
|
|
```
|
|
|
|
|
|
## Change log
|
|
|
|
See <https://github.com/go-openapi/jsonreference/releases>
|
|
|
|
## References
|
|
|
|
* <http://tools.ietf.org/html/draft-ietf-appsawg-json-pointer-07>
|
|
* <http://tools.ietf.org/html/draft-pbryan-zyp-json-ref-03>
|
|
|
|
## 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.
|
|
|
|
## Other documentation
|
|
|
|
* [All-time contributors](./CONTRIBUTORS.md)
|
|
* [Contributing guidelines][contributing-doc-site]
|
|
* [Maintainers documentation][maintainers-doc-site]
|
|
* [Code style][style-doc-site]
|
|
|
|
## Cutting a new release
|
|
|
|
Maintainers can cut a new release by either:
|
|
|
|
* running [this workflow](https://github.com/go-openapi/jsonreference/actions/workflows/bump-release.yml)
|
|
* or pushing a semver tag
|
|
* signed tags are preferred
|
|
* The tag message is prepended to release notes
|
|
|
|
<!-- Badges: status -->
|
|
[test-badge]: https://github.com/go-openapi/jsonreference/actions/workflows/go-test.yml/badge.svg
|
|
[test-url]: https://github.com/go-openapi/jsonreference/actions/workflows/go-test.yml
|
|
[cov-badge]: https://codecov.io/gh/go-openapi/jsonreference/branch/master/graph/badge.svg
|
|
[cov-url]: https://codecov.io/gh/go-openapi/jsonreference
|
|
[vuln-scan-badge]: https://github.com/go-openapi/jsonreference/actions/workflows/scanner.yml/badge.svg
|
|
[vuln-scan-url]: https://github.com/go-openapi/jsonreference/actions/workflows/scanner.yml
|
|
[codeql-badge]: https://github.com/go-openapi/jsonreference/actions/workflows/codeql.yml/badge.svg
|
|
[codeql-url]: https://github.com/go-openapi/jsonreference/actions/workflows/codeql.yml
|
|
<!-- Badges: release & docker images -->
|
|
[release-badge]: https://badge.fury.io/gh/go-openapi%2Fjsonreference.svg
|
|
[release-url]: https://badge.fury.io/gh/go-openapi%2Fjsonreference
|
|
[gomod-badge]: https://badge.fury.io/go/github.com%2Fgo-openapi%2Fjsonreference.svg
|
|
[gomod-url]: https://badge.fury.io/go/github.com%2Fgo-openapi%2Fjsonreference
|
|
<!-- Badges: code quality -->
|
|
[gocard-badge]: https://goreportcard.com/badge/github.com/go-openapi/jsonreference
|
|
[gocard-url]: https://goreportcard.com/report/github.com/go-openapi/jsonreference
|
|
[codefactor-badge]: https://img.shields.io/codefactor/grade/github/go-openapi/jsonreference
|
|
[codefactor-url]: https://www.codefactor.io/repository/github/go-openapi/jsonreference
|
|
<!-- Badges: documentation & support -->
|
|
[doc-badge]: https://img.shields.io/badge/doc-site-blue?link=https%3A%2F%2Fgoswagger.io%2Fgo-openapi%2F
|
|
[doc-url]: https://goswagger.io/go-openapi
|
|
[godoc-badge]: https://pkg.go.dev/badge/github.com/go-openapi/jsonreference
|
|
[godoc-url]: http://pkg.go.dev/github.com/go-openapi/jsonreference
|
|
[discord-badge]: https://img.shields.io/discord/1446918742398341256?logo=discord&label=discord&color=blue
|
|
[discord-url]: https://discord.gg/FfnFYaC3k5
|
|
|
|
<!-- Badges: license & compliance -->
|
|
[license-badge]: http://img.shields.io/badge/license-Apache%20v2-orange.svg
|
|
[license-url]: https://github.com/go-openapi/jsonreference/?tab=Apache-2.0-1-ov-file#readme
|
|
<!-- Badges: others & stats -->
|
|
[goversion-badge]: https://img.shields.io/github/go-mod/go-version/go-openapi/jsonreference
|
|
[goversion-url]: https://github.com/go-openapi/jsonreference/blob/master/go.mod
|
|
[top-badge]: https://img.shields.io/github/languages/top/go-openapi/jsonreference
|
|
[commits-badge]: https://img.shields.io/github/commits-since/go-openapi/jsonreference/latest
|
|
<!-- Organization docs -->
|
|
[contributing-doc-site]: https://go-openapi.github.io/doc-site/contributing/contributing/index.html
|
|
[maintainers-doc-site]: https://go-openapi.github.io/doc-site/maintainers/index.html
|
|
[style-doc-site]: https://go-openapi.github.io/doc-site/contributing/style/index.html
|