jsonschema: add more schema fields
Add additional fields to Schema which are mentioned in the spec but do not affect validation. Change-Id: I89488261a00c207d01cd7fc59d782f43692fe528 Reviewed-on: https://go-review.googlesource.com/c/tools/+/674976 Reviewed-by: Alan Donovan <adonovan@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Auto-Submit: Jonathan Amsterdam <jba@google.com>
This commit is contained in:
parent
715e9f1935
commit
fdbd35a415
1 changed files with 134 additions and 17 deletions
|
|
@ -153,6 +153,14 @@ func (s *Schema) checkLocal(report func(error)) {
|
|||
// TODO: validate the schema's properties,
|
||||
// ideally by jsonschema-validating it against the meta-schema.
|
||||
|
||||
// Some properties are present so that Schemas can round-trip, but we do not
|
||||
// validate them.
|
||||
// Currently, it's just the $vocabulary property.
|
||||
// As a special case, we can validate the 2020-12 meta-schema.
|
||||
if s.Vocabulary != nil && s.Schema != draft202012 {
|
||||
addf("cannot validate a schema with $vocabulary")
|
||||
}
|
||||
|
||||
// Check and compile regexps.
|
||||
if s.Pattern != "" {
|
||||
re, err := regexp.Compile(s.Pattern)
|
||||
|
|
|
|||
Loading…
Reference in a new issue