Skip to content

Commit

Permalink
Merge pull request #1 from bmeg/fix/hyper-schema
Browse files Browse the repository at this point in the history
Fix/hyper schema
  • Loading branch information
matthewpeterkort authored Oct 21, 2024
2 parents 9e31c47 + ba5264c commit e027c98
Show file tree
Hide file tree
Showing 6 changed files with 30 additions and 9 deletions.
4 changes: 2 additions & 2 deletions cmd/jv/go.mod
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
module github.com/santhosh-tekuri/jsonschema/cmd/jv
module github.com/bmeg/jsonschema/cmd/jv

go 1.15

require (
github.com/santhosh-tekuri/jsonschema/v5 v5.3.1
github.com/bmeg/jsonschema/v5 v5.3.1
gopkg.in/yaml.v3 v3.0.1
)
4 changes: 2 additions & 2 deletions cmd/jv/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ import (
"path/filepath"
"strings"

"github.com/santhosh-tekuri/jsonschema/v5"
_ "github.com/santhosh-tekuri/jsonschema/v5/httploader"
"github.com/bmeg/jsonschema/v5"
_ "github.com/bmeg/jsonschema/v5/httploader"
"gopkg.in/yaml.v3"
)

Expand Down
23 changes: 23 additions & 0 deletions draft.go
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,27 @@ var (
"https://json-schema.org/draft/2020-12/vocab/validation",
},
}
Draft2020HyperSchema = &Draft{
version: 2020,
id: "$id",
boolSchema: true,
vocab: []string{
"https://json-schema.org/draft/2020-12/vocab/core",
"https://json-schema.org/draft/2020-12/vocab/applicator",
"https://json-schema.org/draft/2020-12/vocab/unevaluated",
"https://json-schema.org/draft/2020-12/vocab/validation",
"https://json-schema.org/draft/2020-12/vocab/meta-data",
"https://json-schema.org/draft/2020-12/vocab/format-annotation",
"https://json-schema.org/draft/2020-12/vocab/content",
"https://json-schema.org/draft/2019-09/vocab/hyper-schema",
},
defaultVocab: []string{
"https://json-schema.org/draft/2020-12/vocab/core",
"https://json-schema.org/draft/2020-12/vocab/applicator",
"https://json-schema.org/draft/2020-12/vocab/unevaluated",
"https://json-schema.org/draft/2020-12/vocab/validation",
},
}

latest = Draft2020
)
Expand All @@ -241,6 +262,8 @@ func findDraft(url string) *Draft {
return latest
case "https://json-schema.org/draft/2020-12/schema":
return Draft2020
case "https://json-schema.org/draft/2020-12/hyper-schema":
return Draft2020HyperSchema
case "https://json-schema.org/draft/2019-09/schema":
return Draft2019
case "https://json-schema.org/draft-07/schema":
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
module github.com/santhosh-tekuri/jsonschema/v5
module github.com/bmeg/jsonschema/v5

go 1.19
4 changes: 1 addition & 3 deletions httploader/httploader.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,14 @@
// registering its Loaders.
//
// To use httploader, link this package into your program:
//
// import _ "github.com/santhosh-tekuri/jsonschema/v5/httploader"
package httploader

import (
"fmt"
"io"
"net/http"

"github.com/santhosh-tekuri/jsonschema/v5"
"github.com/bmeg/jsonschema/v5"
)

// Client is the default HTTP Client used to Get the resource.
Expand Down
2 changes: 1 addition & 1 deletion schema_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ import (
"strings"
"testing"

_ "github.com/bmeg/jsonschema/v5/httploader"
"github.com/santhosh-tekuri/jsonschema/v5"
_ "github.com/santhosh-tekuri/jsonschema/v5/httploader"
)

var skipTests = map[string]map[string][]string{
Expand Down

0 comments on commit e027c98

Please sign in to comment.