import { schema , TypeOf } from '@kbn/config-schema' ; import { get } from 'lodash' ; import type { PluginConfigDescriptor } from 'kibana/server' ; import type { ConfigDeprecation } from '@kbn/config' ; const configSchema = schema . object ( { newProperty : schema . maybe ( schema . string ( { defaultValue : 'Some string' } ) ) , noLongerUsed : schema . maybe ( schema . string ( ) ) , secret : schema . maybe ( schema . number ( { defaultValue : 42 } ) ) , } ) ; type ConfigType = TypeOf < typeof configSchema > ; const configSecretDeprecation = ( settings , fromPath , addDeprecation ) => { if ( get ( settings , 'corePluginDeprecations.secret' ) !== 42 ) { addDeprecation ( { configPath : 'corePluginDeprecations.secret' , documentationUrl : 'config-secret-doc-url' , message : 'Kibana plugin functional tests will no longer allow corePluginDeprecations.secret ' + 'config to be set to anything except 42.' , correctiveActions : { manualSteps : [ `This is an intentional deprecation for testing with no intention for having it fixed!` , ] , } , } ) ; } return settings ; } ; export const config = { schema : configSchema , deprecations : ( { rename , unused } ) => [ rename ( 'oldProperty' , 'newProperty' ) , unused ( 'noLongerUsed' ) , configSecretDeprecation , ] , } ;