@grafana/viz-contract 1.5.0 → 1.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +23 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -100,6 +100,29 @@ const pkg = createRequire(import.meta.url).resolve('@grafana/viz-contract/packag
|
|
|
100
100
|
const fixturesDir = path.join(path.dirname(pkg), 'fixtures');
|
|
101
101
|
```
|
|
102
102
|
|
|
103
|
+
## Use the Go module
|
|
104
|
+
|
|
105
|
+
The Go module `github.com/grafana/viz-contract` holds the bundled schemas, the registries and the fixtures. It has
|
|
106
|
+
the same tags as the npm package. A function gives each folder as its own `fs.FS`: `Registry()` (`registry/`),
|
|
107
|
+
`Schemas()` (`schemas/bundled/`) and `Fixtures()` (`fixtures/`). A binary that calls only `Registry()` does not
|
|
108
|
+
carry the fixtures. A path does not start with the folder name. It is the path after the folder in the npm package.
|
|
109
|
+
|
|
110
|
+
```sh
|
|
111
|
+
go get github.com/grafana/viz-contract@latest
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
```go
|
|
115
|
+
import (
|
|
116
|
+
"io/fs"
|
|
117
|
+
|
|
118
|
+
vizcontract "github.com/grafana/viz-contract"
|
|
119
|
+
)
|
|
120
|
+
|
|
121
|
+
chartTypes, err := fs.ReadFile(vizcontract.Registry(), "chart-types.json")
|
|
122
|
+
vizSpec, err := fs.ReadFile(vizcontract.Schemas(), "viz-spec.schema.json")
|
|
123
|
+
args, err := fs.ReadFile(vizcontract.Fixtures(), "prometheus-line/args.json")
|
|
124
|
+
```
|
|
125
|
+
|
|
103
126
|
## Promises
|
|
104
127
|
|
|
105
128
|
The interfaces do not have the same promise of stability. [8-versioning.md](8-versioning.md) gives the three
|