jsonschema: validate object keywords

Add validation for JSON objects (Go maps).

The map keys are called "properties."

As with arrays, annotations are needed to support the
unevaluatedProperties keyword.

Change-Id: Ia01f74300f4bcdbce94065572d83c46dfaa53ae7
Reviewed-on: https://go-review.googlesource.com/c/tools/+/668256
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-25 11:13:31 -04:00
commit 0def4e0327

View file

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