jsonschema: pre-compile regexps

This is the first CL that deals with the process of preparing a schema for validation.

Perform some basic checks on the scheme. Along the way, compile regexps and store
them in the schema for use during validation.

Change-Id: I0e5e6ce28656dcecb6d2d4b2fdc98998fa05b6f1
Reviewed-on: https://go-review.googlesource.com/c/tools/+/669696
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Alan Donovan <adonovan@google.com>
This commit is contained in:
Jonathan Amsterdam 2025-04-26 09:10:49 -04:00
commit 3d33fafc5d

View file

@ -51,7 +51,10 @@ func TestValidate(t *testing.T) {
}
for _, g := range groups {
t.Run(g.Description, func(t *testing.T) {
rs := &ResolvedSchema{root: g.Schema}
rs, err := g.Schema.Resolve()
if err != nil {
t.Fatal(err)
}
for s := range g.Schema.all() {
if s.Defs != nil || s.Ref != "" {
t.Skip("schema or subschema has unimplemented keywords")