-
Notifications
You must be signed in to change notification settings - Fork 8.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix maybe behavior with object type #55932
Conversation
32c974f
to
469b572
Compare
Pinging @elastic/kibana-platform (Team:Platform) |
469b572
to
a60a464
Compare
💚 Build SucceededHistory
To update your PR or re-run it, just comment with: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the changes to event_log LGTM
@elasticmachine merge upstream |
@elasticmachine merge upstream |
@elasticmachine retest |
💚 Build SucceededHistory
To update your PR or re-run it, just comment with: |
Summary
Fixes #55966
This makes a couple fundamental changes to how
ObjectType
andMaybeType
work in conjunction with one another.schema.maybe
actually beundefined
rather than calling Joi'sdefault()
method which does something else -- populates the default options for all subkeys of an object.applyDefaults
option toschema.object
that is true by default. This will automatically populate the subkeys of the object if nothing is defined for that key on the input. If the key does not have a default, the validation will fail.applyDefaults
istrue
by default, but can be toggledfalse
if this behavior is not desired in some cases.This aligns the functionality to be more similar to Joi and what developers tend to expect to happen. I did have to correct a handful of existing config schemas, but as far as I can tell, this improved their readability.
Checklist
Use
strikethroughsto remove checklist items you don't feel are applicable to this PR.For maintainers