-
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
rename deprecation factory does not remove an empty object #120876
Comments
Pinging @elastic/kibana-core (Team:Core) |
++ to removing the empty properties. IMO, if renaming, the old name should completely go away.
Do we know how many cases are affected by this statement? |
Another option would be to allow I'm ++ to remove all parents of the
I would say it's unlikely for configuration schemas as most/all properties are optional by nature. We could eventually introduce an option for these deprecations to disable this 'delete the empty parents behavior', but I feel like this will not be necessary. |
Maybe this step of removing empty objects can be done after all factory functions are run instead of doing something specific to Another thing I have in mind but it might not be a concern is; Since the deprecation updates are run sequentially we might remove an object that will later get repopulated? We also want to keep in mind that we are tracking deprecated configs through telemetry and we do not want to break the usage sent around that |
e.g renameFromRoot('foo.bar', 'hello.dolly'); would return, when the config is {
set: [{ path: 'hello.dolly', value: valueOfFooBar }],
unset: [{ path: 'foo' }],
} and when the config is {
set: [{ path: 'hello.dolly', value: valueOfFooBar }],
unset: [{ path: 'foo.bar' }],
} Or am I missing something?
Wasn't this already the case when using |
when looking at the actual implementation, I think that we need to apply this parent cleanup check after every I'm submitting the PR now #120889.
@pgayvallet the problem I see with that approach is that |
We're applying the kibana/packages/kbn-config/src/deprecation/apply_deprecations.ts Lines 36 to 49 in 58bab91
unless I'm missing something? |
@pgayvallet you are right! I was misreading the code. Do you think it's best to change the behaviours of the APIs |
Na, your implementation looks fine, and I don't think mine is better in any way since we don't want to add the option to enabled or disable the behavior from the deprecation's options (mostly wanted to understand, thanks!). |
version:
main
branchCloud staging is failing after #120110 with an error:
It's been caused by a bunch of
rename
deprecations in https://github.com/elastic/kibana/blob/da78a9ecd5eecfae86a31ee652857006af4141a5/x-pack/plugins/screenshotting/server/config/index.ts.Therefore, if Config contains at least a single property under
xpack.reporting.capture.browser.*
namespace, Kibana will move it underxpack.screenshotting.browser.*
. However, the config validation will fail forxpack.reporting.capture.browser
since it contains an empty object without a validation schema.@elastic/kibana-reporting-services can't change the deprecation declaration from
xpack.reporting.capture
toxpack.screenshotting
because it contains other properties besidesbrowser
.Another option is to declare the
rename
operation on a level higher but it's rather a non-obvious workaroundMy suggestion is to extend
rename
functionality to remove an empty property after therename
operation.now:
with fix:
Downsides:
Some code may expect an empty object to present after the
rename
operation.The text was updated successfully, but these errors were encountered: