https://github.com/oxheadalpha/tezos-snapshot-metadata-schema
A public place to field feedback and releases of metadata schema for Tezos storage artifacts.
https://github.com/oxheadalpha/tezos-snapshot-metadata-schema
Last synced: 4 months ago
JSON representation
A public place to field feedback and releases of metadata schema for Tezos storage artifacts.
- Host: GitHub
- URL: https://github.com/oxheadalpha/tezos-snapshot-metadata-schema
- Owner: oxheadalpha
- Created: 2023-01-27T20:28:27.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2023-03-28T20:38:21.000Z (about 2 years ago)
- Last Synced: 2025-01-05T08:55:16.462Z (5 months ago)
- Size: 38.1 KB
- Stars: 0
- Watchers: 8
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# tezos-schema
A public place to field feedback and releases of metadata schema for Tezos storage artifacts.We're using **GitHub discussions** to field questions/improvements/suggestions for this repo. Feel free to [open a discussion](https://github.com/oxheadalpha/tezos-schema/discussions) and we'll turn it into an issue, and eventually- a release.
- [tezos-schema](#tezos-schema)
- [Validate your own metadata](#validate-your-own-metadata)
- [bash](#bash)
- [python](#python)
- [go](#go)
- [npm/\*script](#npmscript)## Validate your own metadata
### bash
https://github.com/python-jsonschema/check-jsonschema
```bash
pip install check-jsonschema
check-jsonschema --schemafile schema.json input.json
ok -- validation done
```### python
https://pypi.org/project/jsonschema/
```python
from jsonschema import validate
import jsonf = open('schema.json')
schema = json.load(f)f = open('input.json')
input = json.load(f)validate(input,schema=schema)
# returns nothing if valid
```### go
https://github.com/xeipuuv/gojsonschema
```go
package mainimport (
"fmt"
"github.com/xeipuuv/gojsonschema"
)func main() {
schemaLoader := gojsonschema.NewReferenceLoader("file:///home/me/schema.json")
documentLoader := gojsonschema.NewReferenceLoader("file:///home/me/document.json")result, err := gojsonschema.Validate(schemaLoader, documentLoader)
if err != nil {
panic(err.Error())
}if result.Valid() {
fmt.Printf("The document is valid\n")
} else {
fmt.Printf("The document is not valid. see errors :\n")
for _, desc := range result.Errors() {
fmt.Printf("- %s\n", desc)
}
}
}
// Returns "The document is valid" if successful
```### npm/*script
https://www.npmjs.com/package/jsonschema
```bash
npm install jsonschema
``````javascript
var validate = require('jsonschema').validate;
var schema = JSON.parse(fs.readFileSync('schema.json'))
var input = JSON.parse(fs.readFileSync('input.json'))
validate(input,schema)
```