internal/mcp: treat zero struct fields generously

Validating a struct is ambiguous, because a zero field could be
considered missing or present.

Interpret a zero optional struct field in whichever way results in
success.

Change-Id: I6a9474e6f6558d2a8522bc5ba0451967367e467d
Reviewed-on: https://go-review.googlesource.com/c/tools/+/675956
Reviewed-by: Alan Donovan <adonovan@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
This commit is contained in:
Jonathan Amsterdam 2025-05-23 15:41:07 -04:00
commit a08732fd0a

View file

@ -155,6 +155,9 @@ type Schema struct {
// compiled regexps
pattern *regexp.Regexp
patternProperties map[*regexp.Regexp]*Schema
// the set of required properties
isRequired map[string]bool
}
// falseSchema returns a new Schema tree that fails to validate any value.