Registry / serialization / xeipuuv-gojsonschema

xeipuuv-gojsonschema

JSON →
library1.2.0gogounverified

A Go implementation of JSON Schema validation for validating JSON documents against a schema.

go get github.com/xeipuuv/gojsonschema
INSTALL
IMPORT
SIG · XEIPUUV-GOJSONSCHE
X
xeipuuv-gojsonschema
serializationgov1.2.0
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

gojsonschema
github.com/xeipuuv/gojsonschema

Validates a JSON document against a JSON Schema.

package main import ( "fmt" "github.com/xeipuuv/gojsonschema" ) func main() { schemaLoader := gojsonschema.NewReferenceLoader("file:///path/to/schema.json") documentLoader := gojsonschema.NewReferenceLoader("file:///path/to/document.json") result, err := gojsonschema.Validate(schemaLoader, documentLoader) if err != nil { panic(err) } if result.Valid() { fmt.Println("The document is valid") } else { fmt.Println("The document is not valid. See errors:") for _, desc := range result.Errors() { fmt.Printf("- %s\n", desc) } } }
Debug
Known issues

No known issues recorded.

Upgrade
Version history
1.2.0latest on pkg.go.dev
Audit
Dependencies

No dependency data recorded yet.

Agent activity
16 hits · last 30 days
node
14
OpenAI (training)
1
Resources
xeipuuv-gojsonschema — go get xeipuuv-gojsonschema · libregistry