diff --git a/cmd/obp/cmd/validate.go b/cmd/obp/cmd/validate.go index e2cf52f..7fe7ac8 100644 --- a/cmd/obp/cmd/validate.go +++ b/cmd/obp/cmd/validate.go @@ -63,7 +63,7 @@ var validateCmd = &cobra.Command{ log.Fatalf("error adding resource to jsonschema compiler: %s\n", err) } - schema, err := compiler.Compile("schema.json") + schema, err := compiler.Compile(schemaFilename) if err != nil { log.Fatalf("error compiling schema: %s\n", err) } diff --git a/go.mod b/go.mod index d4cb606..1668bb9 100644 --- a/go.mod +++ b/go.mod @@ -4,9 +4,11 @@ go 1.19 require ( github.com/charmbracelet/lipgloss v0.7.1 + github.com/santhosh-tekuri/jsonschema/v5 v5.3.0 github.com/spf13/cobra v1.7.0 github.com/spf13/viper v1.15.0 go.uber.org/zap v1.24.0 + gopkg.in/yaml.v3 v3.0.1 ) require ( @@ -33,5 +35,4 @@ require ( golang.org/x/sys v0.6.0 // indirect golang.org/x/text v0.5.0 // indirect gopkg.in/ini.v1 v1.67.0 // indirect - gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/go.sum b/go.sum index c259d34..b6a6ec7 100644 --- a/go.sum +++ b/go.sum @@ -168,6 +168,8 @@ github.com/rivo/uniseg v0.2.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJ github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= github.com/rogpeppe/go-internal v1.6.1 h1:/FiVV8dS/e+YqF2JvO3yXRFbBLTIuSDkuC7aBOAvL+k= github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= +github.com/santhosh-tekuri/jsonschema/v5 v5.3.0 h1:uIkTLo0AGRc8l7h5l9r+GcYi9qfVPt6lD4/bhmzfiKo= +github.com/santhosh-tekuri/jsonschema/v5 v5.3.0/go.mod h1:FKdcjfQW6rpZSnxxUvEA5H/cDPdvJ/SZJQLWWXWGrZ0= github.com/spf13/afero v1.9.3 h1:41FoI0fD7OR7mGcKE/aOiLkGreyf8ifIOQmJANWogMk= github.com/spf13/afero v1.9.3/go.mod h1:iUV7ddyEEZPO5gA3zD4fJt6iStLlL+Lg4m2cihcDf8Y= github.com/spf13/cast v1.5.0 h1:rj3WzYc11XZaIZMPKmwP96zkFEnnAmV8s6XbB2aY32w= diff --git a/schemas/base.json b/schemas/base.json new file mode 100644 index 0000000..87d7905 --- /dev/null +++ b/schemas/base.json @@ -0,0 +1,20 @@ +{ + "$schema": "https://json-schema.org/draft/2020-12/schema", + "$id": "http://ndumas.com/schemas/myschema.json", + "title":"baseNote", + "description":"properties all notes must have", + "type":"object", + "properties": { + "title": { + "type": "string" + }, + "aliases": { + "type": "array", + "items": { + "type":"string", + "uniqueItems": true, + "minItems": 1 + } + } + } +}