-
Notifications
You must be signed in to change notification settings - Fork 8.3k
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
[fleet] Add to_yaml helper #136723
[fleet] Add to_yaml helper #136723
Conversation
Pinging @elastic/fleet (Team:Fleet) |
Hi @jeniawhite we added recently a |
…-ref HEAD~1..HEAD --fix'
💔 Build FailedFailed CI StepsMetrics [docs]Unknown metric groupsESLint disabled in files
ESLint disabled line counts
Total ESLint disabled count
History
To update your PR or re-run it, just comment with: |
case 'object': | ||
// Null classified as object | ||
if (isNil(value)) return; | ||
const safeValue = replaceUndefinedObjectValues(value, true); |
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.
Why do we need to replace undefined
by null? I think there is still value to support undefined value if we want some keys to not be in the final yaml no?
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.
Passing objects with undefined key values causes safeDump
to throw an exception.
> yaml.safeDump({key: undefined})
Uncaught:
YAMLException: unacceptable kind of an object to dump [object Undefined]
at writeNode (/Users/evgb/Documents/GitHub/kibana/node_modules/js-yaml/lib/js-yaml/dumper.js:779:13)
at writeBlockMapping (/Users/evgb/Documents/GitHub/kibana/node_modules/js-yaml/lib/js-yaml/dumper.js:657:10)
at writeNode (/Users/evgb/Documents/GitHub/kibana/node_modules/js-yaml/lib/js-yaml/dumper.js:750:9)
at dump (/Users/evgb/Documents/GitHub/kibana/node_modules/js-yaml/lib/js-yaml/dumper.js:840:7)
at Object.safeDump (/Users/evgb/Documents/GitHub/kibana/node_modules/js-yaml/lib/js-yaml/dumper.js:846:10) {
reason: 'unacceptable kind of an object to dump [object Undefined]',
mark: undefined
}
@nchaulet |
Summary
Adds to_yaml helper to handlebars for fleet server.
Checklist
For maintainers