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:
parent
b7d1ec0604
commit
a08732fd0a
1 changed files with 122 additions and 26 deletions
|
|
@ -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.
|
||||
|
|
|
|||
Loading…
Reference in a new issue