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:
Jonathan Amsterdam 2025-04-27 09:32:18 -04:00 • committed by Gopher Robot
commit fdbd35a415

View file

@ -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)