forked from elastic/kibana
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implements config deprecation in New Platform (elastic#52251)
* implements 'rename' and 'unset' deprecations * introduce usage of ConfigDeprecationProvider * adapt RawConfigService to only returns unmodified raw config * apply deprecations when accessing config * register legacy plugin deprecation in new platform * implements ConfigService#validate * add exemple config deprecation usage in testbed * documentation * export public config deprecation types * fix new test due to rebase * name ConfigDeprecationFactory * update generated doc * add tests for unset and move it to src/core/utils * add tests for renameFromRoot and unusedFromRoot * cast paths as any as get expects a fixed-length string array * use specific logger for deprecations * add additional test on renameFromRoot * update migration guide * migrate core deprecations to NP * add integration test * use same log context as legacy * remove old deprecation warnings integration tests, now covered in NP * migrates csp deprecation to NP * removes deprecationWarningMixin from legacy * remove legacy core deprecations * remove unused import * rename setupConfigSchemas to setupCoreConfig * update generated doc
- Loading branch information
1 parent
4823430
commit fa610e9
Showing
74 changed files
with
2,399 additions
and
723 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
18 changes: 18 additions & 0 deletions
18
docs/development/core/server/kibana-plugin-server.configdeprecation.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
<!-- Do not edit this file. It is automatically generated by API Documenter. --> | ||
|
||
[Home](./index.md) > [kibana-plugin-server](./kibana-plugin-server.md) > [ConfigDeprecation](./kibana-plugin-server.configdeprecation.md) | ||
|
||
## ConfigDeprecation type | ||
|
||
Configuration deprecation returned from [ConfigDeprecationProvider](./kibana-plugin-server.configdeprecationprovider.md) that handles a single deprecation from the configuration. | ||
|
||
<b>Signature:</b> | ||
|
||
```typescript | ||
export declare type ConfigDeprecation = (config: Record<string, any>, fromPath: string, logger: ConfigDeprecationLogger) => Record<string, any>; | ||
``` | ||
|
||
## Remarks | ||
|
||
This should only be manually implemented if [ConfigDeprecationFactory](./kibana-plugin-server.configdeprecationfactory.md) does not provide the proper helpers for a specific deprecation need. | ||
|
36 changes: 36 additions & 0 deletions
36
docs/development/core/server/kibana-plugin-server.configdeprecationfactory.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
<!-- Do not edit this file. It is automatically generated by API Documenter. --> | ||
|
||
[Home](./index.md) > [kibana-plugin-server](./kibana-plugin-server.md) > [ConfigDeprecationFactory](./kibana-plugin-server.configdeprecationfactory.md) | ||
|
||
## ConfigDeprecationFactory interface | ||
|
||
Provides helpers to generates the most commonly used [ConfigDeprecation](./kibana-plugin-server.configdeprecation.md) when invoking a [ConfigDeprecationProvider](./kibana-plugin-server.configdeprecationprovider.md)<!-- -->. | ||
|
||
See methods documentation for more detailed examples. | ||
|
||
<b>Signature:</b> | ||
|
||
```typescript | ||
export interface ConfigDeprecationFactory | ||
``` | ||
|
||
## Methods | ||
|
||
| Method | Description | | ||
| --- | --- | | ||
| [rename(oldKey, newKey)](./kibana-plugin-server.configdeprecationfactory.rename.md) | Rename a configuration property from inside a plugin's configuration path. Will log a deprecation warning if the oldKey was found and deprecation applied. | | ||
| [renameFromRoot(oldKey, newKey)](./kibana-plugin-server.configdeprecationfactory.renamefromroot.md) | Rename a configuration property from the root configuration. Will log a deprecation warning if the oldKey was found and deprecation applied.<!-- -->This should be only used when renaming properties from different configuration's path. To rename properties from inside a plugin's configuration, use 'rename' instead. | | ||
| [unused(unusedKey)](./kibana-plugin-server.configdeprecationfactory.unused.md) | Remove a configuration property from inside a plugin's configuration path. Will log a deprecation warning if the unused key was found and deprecation applied. | | ||
| [unusedFromRoot(unusedKey)](./kibana-plugin-server.configdeprecationfactory.unusedfromroot.md) | Remove a configuration property from the root configuration. Will log a deprecation warning if the unused key was found and deprecation applied.<!-- -->This should be only used when removing properties from outside of a plugin's configuration. To remove properties from inside a plugin's configuration, use 'unused' instead. | | ||
|
||
## Example | ||
|
||
|
||
```typescript | ||
const provider: ConfigDeprecationProvider = ({ rename, unused }) => [ | ||
rename('oldKey', 'newKey'), | ||
unused('deprecatedKey'), | ||
] | ||
|
||
``` | ||
|
36 changes: 36 additions & 0 deletions
36
...development/core/server/kibana-plugin-server.configdeprecationfactory.rename.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
<!-- Do not edit this file. It is automatically generated by API Documenter. --> | ||
|
||
[Home](./index.md) > [kibana-plugin-server](./kibana-plugin-server.md) > [ConfigDeprecationFactory](./kibana-plugin-server.configdeprecationfactory.md) > [rename](./kibana-plugin-server.configdeprecationfactory.rename.md) | ||
|
||
## ConfigDeprecationFactory.rename() method | ||
|
||
Rename a configuration property from inside a plugin's configuration path. Will log a deprecation warning if the oldKey was found and deprecation applied. | ||
|
||
<b>Signature:</b> | ||
|
||
```typescript | ||
rename(oldKey: string, newKey: string): ConfigDeprecation; | ||
``` | ||
|
||
## Parameters | ||
|
||
| Parameter | Type | Description | | ||
| --- | --- | --- | | ||
| oldKey | <code>string</code> | | | ||
| newKey | <code>string</code> | | | ||
|
||
<b>Returns:</b> | ||
|
||
`ConfigDeprecation` | ||
|
||
## Example | ||
|
||
Rename 'myplugin.oldKey' to 'myplugin.newKey' | ||
|
||
```typescript | ||
const provider: ConfigDeprecationProvider = ({ rename }) => [ | ||
rename('oldKey', 'newKey'), | ||
] | ||
|
||
``` | ||
|
38 changes: 38 additions & 0 deletions
38
...ent/core/server/kibana-plugin-server.configdeprecationfactory.renamefromroot.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
<!-- Do not edit this file. It is automatically generated by API Documenter. --> | ||
|
||
[Home](./index.md) > [kibana-plugin-server](./kibana-plugin-server.md) > [ConfigDeprecationFactory](./kibana-plugin-server.configdeprecationfactory.md) > [renameFromRoot](./kibana-plugin-server.configdeprecationfactory.renamefromroot.md) | ||
|
||
## ConfigDeprecationFactory.renameFromRoot() method | ||
|
||
Rename a configuration property from the root configuration. Will log a deprecation warning if the oldKey was found and deprecation applied. | ||
|
||
This should be only used when renaming properties from different configuration's path. To rename properties from inside a plugin's configuration, use 'rename' instead. | ||
|
||
<b>Signature:</b> | ||
|
||
```typescript | ||
renameFromRoot(oldKey: string, newKey: string): ConfigDeprecation; | ||
``` | ||
|
||
## Parameters | ||
|
||
| Parameter | Type | Description | | ||
| --- | --- | --- | | ||
| oldKey | <code>string</code> | | | ||
| newKey | <code>string</code> | | | ||
|
||
<b>Returns:</b> | ||
|
||
`ConfigDeprecation` | ||
|
||
## Example | ||
|
||
Rename 'oldplugin.key' to 'newplugin.key' | ||
|
||
```typescript | ||
const provider: ConfigDeprecationProvider = ({ renameFromRoot }) => [ | ||
renameFromRoot('oldplugin.key', 'newplugin.key'), | ||
] | ||
|
||
``` | ||
|
35 changes: 35 additions & 0 deletions
35
...development/core/server/kibana-plugin-server.configdeprecationfactory.unused.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
<!-- Do not edit this file. It is automatically generated by API Documenter. --> | ||
|
||
[Home](./index.md) > [kibana-plugin-server](./kibana-plugin-server.md) > [ConfigDeprecationFactory](./kibana-plugin-server.configdeprecationfactory.md) > [unused](./kibana-plugin-server.configdeprecationfactory.unused.md) | ||
|
||
## ConfigDeprecationFactory.unused() method | ||
|
||
Remove a configuration property from inside a plugin's configuration path. Will log a deprecation warning if the unused key was found and deprecation applied. | ||
|
||
<b>Signature:</b> | ||
|
||
```typescript | ||
unused(unusedKey: string): ConfigDeprecation; | ||
``` | ||
|
||
## Parameters | ||
|
||
| Parameter | Type | Description | | ||
| --- | --- | --- | | ||
| unusedKey | <code>string</code> | | | ||
|
||
<b>Returns:</b> | ||
|
||
`ConfigDeprecation` | ||
|
||
## Example | ||
|
||
Flags 'myplugin.deprecatedKey' as unused | ||
|
||
```typescript | ||
const provider: ConfigDeprecationProvider = ({ unused }) => [ | ||
unused('deprecatedKey'), | ||
] | ||
|
||
``` | ||
|
37 changes: 37 additions & 0 deletions
37
...ent/core/server/kibana-plugin-server.configdeprecationfactory.unusedfromroot.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
<!-- Do not edit this file. It is automatically generated by API Documenter. --> | ||
|
||
[Home](./index.md) > [kibana-plugin-server](./kibana-plugin-server.md) > [ConfigDeprecationFactory](./kibana-plugin-server.configdeprecationfactory.md) > [unusedFromRoot](./kibana-plugin-server.configdeprecationfactory.unusedfromroot.md) | ||
|
||
## ConfigDeprecationFactory.unusedFromRoot() method | ||
|
||
Remove a configuration property from the root configuration. Will log a deprecation warning if the unused key was found and deprecation applied. | ||
|
||
This should be only used when removing properties from outside of a plugin's configuration. To remove properties from inside a plugin's configuration, use 'unused' instead. | ||
|
||
<b>Signature:</b> | ||
|
||
```typescript | ||
unusedFromRoot(unusedKey: string): ConfigDeprecation; | ||
``` | ||
|
||
## Parameters | ||
|
||
| Parameter | Type | Description | | ||
| --- | --- | --- | | ||
| unusedKey | <code>string</code> | | | ||
|
||
<b>Returns:</b> | ||
|
||
`ConfigDeprecation` | ||
|
||
## Example | ||
|
||
Flags 'somepath.deprecatedProperty' as unused | ||
|
||
```typescript | ||
const provider: ConfigDeprecationProvider = ({ unusedFromRoot }) => [ | ||
unusedFromRoot('somepath.deprecatedProperty'), | ||
] | ||
|
||
``` | ||
|
13 changes: 13 additions & 0 deletions
13
docs/development/core/server/kibana-plugin-server.configdeprecationlogger.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
<!-- Do not edit this file. It is automatically generated by API Documenter. --> | ||
|
||
[Home](./index.md) > [kibana-plugin-server](./kibana-plugin-server.md) > [ConfigDeprecationLogger](./kibana-plugin-server.configdeprecationlogger.md) | ||
|
||
## ConfigDeprecationLogger type | ||
|
||
Logger interface used when invoking a [ConfigDeprecation](./kibana-plugin-server.configdeprecation.md) | ||
|
||
<b>Signature:</b> | ||
|
||
```typescript | ||
export declare type ConfigDeprecationLogger = (message: string) => void; | ||
``` |
28 changes: 28 additions & 0 deletions
28
docs/development/core/server/kibana-plugin-server.configdeprecationprovider.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
<!-- Do not edit this file. It is automatically generated by API Documenter. --> | ||
|
||
[Home](./index.md) > [kibana-plugin-server](./kibana-plugin-server.md) > [ConfigDeprecationProvider](./kibana-plugin-server.configdeprecationprovider.md) | ||
|
||
## ConfigDeprecationProvider type | ||
|
||
A provider that should returns a list of [ConfigDeprecation](./kibana-plugin-server.configdeprecation.md)<!-- -->. | ||
|
||
See [ConfigDeprecationFactory](./kibana-plugin-server.configdeprecationfactory.md) for more usage examples. | ||
|
||
<b>Signature:</b> | ||
|
||
```typescript | ||
export declare type ConfigDeprecationProvider = (factory: ConfigDeprecationFactory) => ConfigDeprecation[]; | ||
``` | ||
|
||
## Example | ||
|
||
|
||
```typescript | ||
const provider: ConfigDeprecationProvider = ({ rename, unused }) => [ | ||
rename('oldKey', 'newKey'), | ||
unused('deprecatedKey'), | ||
myCustomDeprecation, | ||
] | ||
|
||
``` | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
13 changes: 13 additions & 0 deletions
13
...lopment/core/server/kibana-plugin-server.pluginconfigdescriptor.deprecations.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
<!-- Do not edit this file. It is automatically generated by API Documenter. --> | ||
|
||
[Home](./index.md) > [kibana-plugin-server](./kibana-plugin-server.md) > [PluginConfigDescriptor](./kibana-plugin-server.pluginconfigdescriptor.md) > [deprecations](./kibana-plugin-server.pluginconfigdescriptor.deprecations.md) | ||
|
||
## PluginConfigDescriptor.deprecations property | ||
|
||
Provider for the [ConfigDeprecation](./kibana-plugin-server.configdeprecation.md) to apply to the plugin configuration. | ||
|
||
<b>Signature:</b> | ||
|
||
```typescript | ||
deprecations?: ConfigDeprecationProvider; | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.