From a465b21303e830c4bac8803887c93b9ae06a9431 Mon Sep 17 00:00:00 2001 From: "Christiane (Tina) Heiligers" Date: Mon, 28 Oct 2024 17:37:28 -0700 Subject: [PATCH] adds deprecation info to all deprecated SO routes, updates integration tests --- .../src/routes/bulk_create.ts | 7 ++-- .../src/routes/bulk_delete.ts | 7 ++-- .../src/routes/bulk_get.ts | 7 ++-- .../src/routes/bulk_resolve.ts | 7 ++-- .../src/routes/bulk_update.ts | 7 ++-- .../src/routes/index.ts | 40 ++++++++++++++++--- .../allow_api_access/bulk_create.test.ts | 15 ++++++- .../allow_api_access/bulk_delete.test.ts | 16 +++++++- .../routes/allow_api_access/bulk_get.test.ts | 15 ++++++- .../allow_api_access/bulk_resolve.test.ts | 15 ++++++- .../allow_api_access/bulk_update.test.ts | 15 ++++++- .../routes/allow_api_access/create.test.ts | 15 ++++++- .../routes/allow_api_access/delete.test.ts | 15 ++++++- .../routes/allow_api_access/find.test.ts | 16 +++++++- .../routes/allow_api_access/get.test.ts | 15 ++++++- .../routes/allow_api_access/resolve.test.ts | 16 +++++++- .../routes/allow_api_access/update.test.ts | 15 ++++++- .../saved_objects/routes/bulk_create.test.ts | 16 +++++++- .../saved_objects/routes/bulk_delete.test.ts | 16 +++++++- .../saved_objects/routes/bulk_get.test.ts | 16 +++++++- .../saved_objects/routes/bulk_resolve.test.ts | 16 +++++++- .../saved_objects/routes/bulk_update.test.ts | 16 +++++++- .../legacy_import_export/export.test.ts | 8 ++++ .../legacy_import_export/import.test.ts | 8 ++++ .../saved_objects/routes/resolve.test.ts | 16 +++++++- .../saved_objects/routes/update.test.ts | 15 ++++++- 26 files changed, 323 insertions(+), 47 deletions(-) diff --git a/packages/core/saved-objects/core-saved-objects-server-internal/src/routes/bulk_create.ts b/packages/core/saved-objects/core-saved-objects-server-internal/src/routes/bulk_create.ts index c9a8656b3f753..98395e919fdde 100644 --- a/packages/core/saved-objects/core-saved-objects-server-internal/src/routes/bulk_create.ts +++ b/packages/core/saved-objects/core-saved-objects-server-internal/src/routes/bulk_create.ts @@ -18,17 +18,19 @@ import { logWarnOnExternalRequest, throwIfAnyTypeNotVisibleByAPI, } from './utils'; +import { DeprecationInfo } from '.'; interface RouteDependencies { config: SavedObjectConfig; coreUsageData: InternalCoreUsageDataSetup; logger: Logger; access: RouteAccess; + deprecationInfo: DeprecationInfo; } export const registerBulkCreateRoute = ( router: InternalSavedObjectRouter, - { config, coreUsageData, logger, access }: RouteDependencies + { config, coreUsageData, logger, access, deprecationInfo }: RouteDependencies ) => { const { allowHttpApiAccess } = config; router.post( @@ -38,8 +40,7 @@ export const registerBulkCreateRoute = ( summary: `Create saved objects`, tags: ['oas-tag:saved objects'], access, - // @ts-expect-error TODO(https://github.com/elastic/kibana/issues/196095): Replace {RouteDeprecationInfo} - deprecated: true, + deprecated: deprecationInfo, }, validate: { query: schema.object({ diff --git a/packages/core/saved-objects/core-saved-objects-server-internal/src/routes/bulk_delete.ts b/packages/core/saved-objects/core-saved-objects-server-internal/src/routes/bulk_delete.ts index 65209a6072748..96d6c0793b30e 100644 --- a/packages/core/saved-objects/core-saved-objects-server-internal/src/routes/bulk_delete.ts +++ b/packages/core/saved-objects/core-saved-objects-server-internal/src/routes/bulk_delete.ts @@ -18,17 +18,19 @@ import { logWarnOnExternalRequest, throwIfAnyTypeNotVisibleByAPI, } from './utils'; +import { DeprecationInfo } from '.'; interface RouteDependencies { config: SavedObjectConfig; coreUsageData: InternalCoreUsageDataSetup; logger: Logger; access: RouteAccess; + deprecationInfo: DeprecationInfo; } export const registerBulkDeleteRoute = ( router: InternalSavedObjectRouter, - { config, coreUsageData, logger, access }: RouteDependencies + { config, coreUsageData, logger, access, deprecationInfo }: RouteDependencies ) => { const { allowHttpApiAccess } = config; router.post( @@ -38,8 +40,7 @@ export const registerBulkDeleteRoute = ( summary: `Delete saved objects`, tags: ['oas-tag:saved objects'], access, - // @ts-expect-error TODO(https://github.com/elastic/kibana/issues/196095): Replace {RouteDeprecationInfo} - deprecated: true, + deprecated: deprecationInfo, }, validate: { body: schema.arrayOf( diff --git a/packages/core/saved-objects/core-saved-objects-server-internal/src/routes/bulk_get.ts b/packages/core/saved-objects/core-saved-objects-server-internal/src/routes/bulk_get.ts index 3f87ca12248ae..a41e9e1ab977a 100644 --- a/packages/core/saved-objects/core-saved-objects-server-internal/src/routes/bulk_get.ts +++ b/packages/core/saved-objects/core-saved-objects-server-internal/src/routes/bulk_get.ts @@ -18,17 +18,19 @@ import { logWarnOnExternalRequest, throwIfAnyTypeNotVisibleByAPI, } from './utils'; +import { DeprecationInfo } from '.'; interface RouteDependencies { config: SavedObjectConfig; coreUsageData: InternalCoreUsageDataSetup; logger: Logger; access: RouteAccess; + deprecationInfo: DeprecationInfo; } export const registerBulkGetRoute = ( router: InternalSavedObjectRouter, - { config, coreUsageData, logger, access }: RouteDependencies + { config, coreUsageData, logger, access, deprecationInfo }: RouteDependencies ) => { const { allowHttpApiAccess } = config; router.post( @@ -38,8 +40,7 @@ export const registerBulkGetRoute = ( summary: `Get saved objects`, tags: ['oas-tag:saved objects'], access, - // @ts-expect-error TODO(https://github.com/elastic/kibana/issues/196095): Replace {RouteDeprecationInfo} - deprecated: true, + deprecated: deprecationInfo, }, validate: { body: schema.arrayOf( diff --git a/packages/core/saved-objects/core-saved-objects-server-internal/src/routes/bulk_resolve.ts b/packages/core/saved-objects/core-saved-objects-server-internal/src/routes/bulk_resolve.ts index 8e19114e798e0..e29d5dc3a2f0e 100644 --- a/packages/core/saved-objects/core-saved-objects-server-internal/src/routes/bulk_resolve.ts +++ b/packages/core/saved-objects/core-saved-objects-server-internal/src/routes/bulk_resolve.ts @@ -18,17 +18,19 @@ import { logWarnOnExternalRequest, throwIfAnyTypeNotVisibleByAPI, } from './utils'; +import { DeprecationInfo } from '.'; interface RouteDependencies { config: SavedObjectConfig; coreUsageData: InternalCoreUsageDataSetup; logger: Logger; access: RouteAccess; + deprecationInfo: DeprecationInfo; } export const registerBulkResolveRoute = ( router: InternalSavedObjectRouter, - { config, coreUsageData, logger, access }: RouteDependencies + { config, coreUsageData, logger, access, deprecationInfo }: RouteDependencies ) => { const { allowHttpApiAccess } = config; router.post( @@ -38,8 +40,7 @@ export const registerBulkResolveRoute = ( summary: `Resolve saved objects`, tags: ['oas-tag:saved objects'], access, - // @ts-expect-error TODO(https://github.com/elastic/kibana/issues/196095): Replace {RouteDeprecationInfo} - deprecated: true, + deprecated: deprecationInfo, description: `Retrieve multiple Kibana saved objects by ID, using any legacy URL aliases if they exist. Under certain circumstances, when Kibana is upgraded, saved object migrations may necessitate regenerating some object IDs to enable new features. When an object's ID is regenerated, a legacy URL alias is created for that object, preserving its old ID. In such a scenario, that object can be retrieved with the bulk resolve API using either its new ID or its old ID.`, }, diff --git a/packages/core/saved-objects/core-saved-objects-server-internal/src/routes/bulk_update.ts b/packages/core/saved-objects/core-saved-objects-server-internal/src/routes/bulk_update.ts index 825a5f95482c0..3af8806fb631f 100644 --- a/packages/core/saved-objects/core-saved-objects-server-internal/src/routes/bulk_update.ts +++ b/packages/core/saved-objects/core-saved-objects-server-internal/src/routes/bulk_update.ts @@ -18,17 +18,19 @@ import { logWarnOnExternalRequest, throwIfAnyTypeNotVisibleByAPI, } from './utils'; +import { DeprecationInfo } from '.'; interface RouteDependencies { config: SavedObjectConfig; coreUsageData: InternalCoreUsageDataSetup; logger: Logger; access: RouteAccess; + deprecationInfo: DeprecationInfo; } export const registerBulkUpdateRoute = ( router: InternalSavedObjectRouter, - { config, coreUsageData, logger, access }: RouteDependencies + { config, coreUsageData, logger, access, deprecationInfo }: RouteDependencies ) => { const { allowHttpApiAccess } = config; router.put( @@ -38,8 +40,7 @@ export const registerBulkUpdateRoute = ( summary: `Update saved objects`, tags: ['oas-tag:saved objects'], access, - // @ts-expect-error TODO(https://github.com/elastic/kibana/issues/196095): Replace {RouteDeprecationInfo} - deprecated: true, + deprecated: deprecationInfo, }, validate: { body: schema.arrayOf( diff --git a/packages/core/saved-objects/core-saved-objects-server-internal/src/routes/index.ts b/packages/core/saved-objects/core-saved-objects-server-internal/src/routes/index.ts index f27a537efef4f..8b7b00f08f8ec 100644 --- a/packages/core/saved-objects/core-saved-objects-server-internal/src/routes/index.ts +++ b/packages/core/saved-objects/core-saved-objects-server-internal/src/routes/index.ts @@ -126,11 +126,41 @@ export function registerRoutes({ access: internalOnServerless, deprecationInfo, }); - registerBulkGetRoute(router, { config, coreUsageData, logger, access: internalOnServerless }); - registerBulkCreateRoute(router, { config, coreUsageData, logger, access: internalOnServerless }); - registerBulkResolveRoute(router, { config, coreUsageData, logger, access: internalOnServerless }); - registerBulkUpdateRoute(router, { config, coreUsageData, logger, access: internalOnServerless }); - registerBulkDeleteRoute(router, { config, coreUsageData, logger, access: internalOnServerless }); + registerBulkGetRoute(router, { + config, + coreUsageData, + logger, + access: internalOnServerless, + deprecationInfo, + }); + registerBulkCreateRoute(router, { + config, + coreUsageData, + logger, + access: internalOnServerless, + deprecationInfo, + }); + registerBulkResolveRoute(router, { + config, + coreUsageData, + logger, + access: internalOnServerless, + deprecationInfo, + }); + registerBulkUpdateRoute(router, { + config, + coreUsageData, + logger, + access: internalOnServerless, + deprecationInfo, + }); + registerBulkDeleteRoute(router, { + config, + coreUsageData, + logger, + access: internalOnServerless, + deprecationInfo, + }); registerExportRoute(router, { config, coreUsageData }); registerImportRoute(router, { config, coreUsageData }); diff --git a/src/core/server/integration_tests/saved_objects/routes/allow_api_access/bulk_create.test.ts b/src/core/server/integration_tests/saved_objects/routes/allow_api_access/bulk_create.test.ts index 8d40280806379..590eb34750c06 100644 --- a/src/core/server/integration_tests/saved_objects/routes/allow_api_access/bulk_create.test.ts +++ b/src/core/server/integration_tests/saved_objects/routes/allow_api_access/bulk_create.test.ts @@ -56,7 +56,20 @@ describe('POST /api/saved_objects/_bulk_create with allowApiAccess true', () => const logger = loggerMock.create(); const config = setupConfig(true); const access = 'public'; - registerBulkCreateRoute(router, { config, coreUsageData, logger, access }); + const deprecationMock = { + documentationUrl: 'http://elastic.co', + severity: 'warning' as const, + reason: { + type: 'remove' as const, + }, + }; + registerBulkCreateRoute(router, { + config, + coreUsageData, + logger, + access, + deprecationInfo: deprecationMock, + }); await server.start(); }); diff --git a/src/core/server/integration_tests/saved_objects/routes/allow_api_access/bulk_delete.test.ts b/src/core/server/integration_tests/saved_objects/routes/allow_api_access/bulk_delete.test.ts index 26a2d22403bc1..289566b032ca6 100644 --- a/src/core/server/integration_tests/saved_objects/routes/allow_api_access/bulk_delete.test.ts +++ b/src/core/server/integration_tests/saved_objects/routes/allow_api_access/bulk_delete.test.ts @@ -60,8 +60,20 @@ describe('POST /api/saved_objects/_bulk_delete with allowApiAccess as true', () const config = setupConfig(true); const access = 'public'; - - registerBulkDeleteRoute(router, { config, coreUsageData, logger, access }); + const deprecationMock = { + documentationUrl: 'http://elastic.co', + severity: 'warning' as const, + reason: { + type: 'remove' as const, + }, + }; + registerBulkDeleteRoute(router, { + config, + coreUsageData, + logger, + access, + deprecationInfo: deprecationMock, + }); await server.start(); }); diff --git a/src/core/server/integration_tests/saved_objects/routes/allow_api_access/bulk_get.test.ts b/src/core/server/integration_tests/saved_objects/routes/allow_api_access/bulk_get.test.ts index da491110b0717..2c4972f0a1008 100644 --- a/src/core/server/integration_tests/saved_objects/routes/allow_api_access/bulk_get.test.ts +++ b/src/core/server/integration_tests/saved_objects/routes/allow_api_access/bulk_get.test.ts @@ -58,7 +58,20 @@ describe('POST /api/saved_objects/_bulk_get with allowApiAccess true', () => { const config = setupConfig(true); const access = 'public'; - registerBulkGetRoute(router, { config, coreUsageData, logger, access }); + const deprecationMock = { + documentationUrl: 'http://elastic.co', + severity: 'warning' as const, + reason: { + type: 'remove' as const, + }, + }; + registerBulkGetRoute(router, { + config, + coreUsageData, + logger, + access, + deprecationInfo: deprecationMock, + }); await server.start(); }); diff --git a/src/core/server/integration_tests/saved_objects/routes/allow_api_access/bulk_resolve.test.ts b/src/core/server/integration_tests/saved_objects/routes/allow_api_access/bulk_resolve.test.ts index 054f55f518a66..5b970e1a90763 100644 --- a/src/core/server/integration_tests/saved_objects/routes/allow_api_access/bulk_resolve.test.ts +++ b/src/core/server/integration_tests/saved_objects/routes/allow_api_access/bulk_resolve.test.ts @@ -59,7 +59,20 @@ describe('POST /api/saved_objects/_bulk_resolve with allowApiAccess true', () => const config = setupConfig(true); const access = 'public'; - registerBulkResolveRoute(router, { config, coreUsageData, logger, access }); + const deprecationMock = { + documentationUrl: 'http://elastic.co', + severity: 'warning' as const, + reason: { + type: 'remove' as const, + }, + }; + registerBulkResolveRoute(router, { + config, + coreUsageData, + logger, + access, + deprecationInfo: deprecationMock, + }); await server.start(); }); diff --git a/src/core/server/integration_tests/saved_objects/routes/allow_api_access/bulk_update.test.ts b/src/core/server/integration_tests/saved_objects/routes/allow_api_access/bulk_update.test.ts index 275e803f6ceb3..ff6203f7dd7cf 100644 --- a/src/core/server/integration_tests/saved_objects/routes/allow_api_access/bulk_update.test.ts +++ b/src/core/server/integration_tests/saved_objects/routes/allow_api_access/bulk_update.test.ts @@ -52,7 +52,20 @@ describe('PUT /api/saved_objects/_bulk_update with allowApiAccess true', () => { const config = setupConfig(true); const access = 'public'; - registerBulkUpdateRoute(router, { config, coreUsageData, logger, access }); + const deprecationMock = { + documentationUrl: 'http://elastic.co', + severity: 'warning' as const, + reason: { + type: 'remove' as const, + }, + }; + registerBulkUpdateRoute(router, { + config, + coreUsageData, + logger, + access, + deprecationInfo: deprecationMock, + }); await server.start(); }); diff --git a/src/core/server/integration_tests/saved_objects/routes/allow_api_access/create.test.ts b/src/core/server/integration_tests/saved_objects/routes/allow_api_access/create.test.ts index 478c233466727..feb021dc60957 100644 --- a/src/core/server/integration_tests/saved_objects/routes/allow_api_access/create.test.ts +++ b/src/core/server/integration_tests/saved_objects/routes/allow_api_access/create.test.ts @@ -58,7 +58,20 @@ describe('POST /api/saved_objects/{type} with allowApiAccess true', () => { const logger = loggerMock.create(); const config = setupConfig(true); const access = 'public'; - registerCreateRoute(router, { config, coreUsageData, logger, access }); + const deprecationMock = { + documentationUrl: 'http://elastic.co', + severity: 'warning' as const, + reason: { + type: 'remove' as const, + }, + }; + registerCreateRoute(router, { + config, + coreUsageData, + logger, + access, + deprecationInfo: deprecationMock, + }); handlerContext.savedObjects.typeRegistry.getType.mockImplementation((typename: string) => { return testTypes diff --git a/src/core/server/integration_tests/saved_objects/routes/allow_api_access/delete.test.ts b/src/core/server/integration_tests/saved_objects/routes/allow_api_access/delete.test.ts index 83cb90ab4d8d7..9197e941f2524 100644 --- a/src/core/server/integration_tests/saved_objects/routes/allow_api_access/delete.test.ts +++ b/src/core/server/integration_tests/saved_objects/routes/allow_api_access/delete.test.ts @@ -55,7 +55,20 @@ describe('DELETE /api/saved_objects/{type}/{id} with allowApiAccess true', () => const logger = loggerMock.create(); const config = setupConfig(true); const access = 'public'; - registerDeleteRoute(router, { config, coreUsageData, logger, access }); + const deprecationMock = { + documentationUrl: 'http://elastic.co', + severity: 'warning' as const, + reason: { + type: 'remove' as const, + }, + }; + registerDeleteRoute(router, { + config, + coreUsageData, + logger, + access, + deprecationInfo: deprecationMock, + }); await server.start(); }); diff --git a/src/core/server/integration_tests/saved_objects/routes/allow_api_access/find.test.ts b/src/core/server/integration_tests/saved_objects/routes/allow_api_access/find.test.ts index 3f7e0b815662e..9c82ee966ead7 100644 --- a/src/core/server/integration_tests/saved_objects/routes/allow_api_access/find.test.ts +++ b/src/core/server/integration_tests/saved_objects/routes/allow_api_access/find.test.ts @@ -71,8 +71,20 @@ describe('GET /api/saved_objects/_find with allowApiAccess true', () => { const config = setupConfig(true); const access = 'public'; - - registerFindRoute(router, { config, coreUsageData, logger, access }); + const deprecationMock = { + documentationUrl: 'http://elastic.co', + severity: 'warning' as const, + reason: { + type: 'remove' as const, + }, + }; + registerFindRoute(router, { + config, + coreUsageData, + logger, + access, + deprecationInfo: deprecationMock, + }); await server.start(); }); diff --git a/src/core/server/integration_tests/saved_objects/routes/allow_api_access/get.test.ts b/src/core/server/integration_tests/saved_objects/routes/allow_api_access/get.test.ts index c97ae350c0386..7b8e558c2f2ca 100644 --- a/src/core/server/integration_tests/saved_objects/routes/allow_api_access/get.test.ts +++ b/src/core/server/integration_tests/saved_objects/routes/allow_api_access/get.test.ts @@ -80,7 +80,20 @@ describe('GET /api/saved_objects/{type}/{id} with allowApiAccess true', () => { const config = setupConfig(true); const access = 'public'; - registerGetRoute(router, { config, coreUsageData, logger, access }); + const deprecationMock = { + documentationUrl: 'http://elastic.co', + severity: 'warning' as const, + reason: { + type: 'remove' as const, + }, + }; + registerGetRoute(router, { + config, + coreUsageData, + logger, + access, + deprecationInfo: deprecationMock, + }); await server.start(); }); diff --git a/src/core/server/integration_tests/saved_objects/routes/allow_api_access/resolve.test.ts b/src/core/server/integration_tests/saved_objects/routes/allow_api_access/resolve.test.ts index bc00a418a13b2..eca4eccbe533f 100644 --- a/src/core/server/integration_tests/saved_objects/routes/allow_api_access/resolve.test.ts +++ b/src/core/server/integration_tests/saved_objects/routes/allow_api_access/resolve.test.ts @@ -80,8 +80,20 @@ describe('GET /api/saved_objects/resolve/{type}/{id} with allowApiAccess true', const config = setupConfig(true); const access = 'public'; - - registerResolveRoute(router, { config, coreUsageData, logger, access }); + const deprecationMock = { + documentationUrl: 'http://elastic.co', + severity: 'warning' as const, + reason: { + type: 'remove' as const, + }, + }; + registerResolveRoute(router, { + config, + coreUsageData, + logger, + access, + deprecationInfo: deprecationMock, + }); await server.start(); }); diff --git a/src/core/server/integration_tests/saved_objects/routes/allow_api_access/update.test.ts b/src/core/server/integration_tests/saved_objects/routes/allow_api_access/update.test.ts index 25da93b526285..9b3411af74dd1 100644 --- a/src/core/server/integration_tests/saved_objects/routes/allow_api_access/update.test.ts +++ b/src/core/server/integration_tests/saved_objects/routes/allow_api_access/update.test.ts @@ -56,7 +56,20 @@ describe('PUT /api/saved_objects/{type}/{id?} with allowApiAccess true', () => { const config = setupConfig(true); const access = 'public'; - registerUpdateRoute(router, { config, coreUsageData, logger, access }); + const deprecationMock = { + documentationUrl: 'http://elastic.co', + severity: 'warning' as const, + reason: { + type: 'remove' as const, + }, + }; + registerUpdateRoute(router, { + config, + coreUsageData, + logger, + access, + deprecationInfo: deprecationMock, + }); await server.start(); }); diff --git a/src/core/server/integration_tests/saved_objects/routes/bulk_create.test.ts b/src/core/server/integration_tests/saved_objects/routes/bulk_create.test.ts index 3eaf3bbdc8865..135260f74f165 100644 --- a/src/core/server/integration_tests/saved_objects/routes/bulk_create.test.ts +++ b/src/core/server/integration_tests/saved_objects/routes/bulk_create.test.ts @@ -60,8 +60,20 @@ describe('POST /api/saved_objects/_bulk_create', () => { const config = setupConfig(); const access = 'public'; - - registerBulkCreateRoute(router, { config, coreUsageData, logger, access }); + const deprecationMock = { + documentationUrl: 'http://elastic.co', + severity: 'warning' as const, + reason: { + type: 'remove' as const, + }, + }; + registerBulkCreateRoute(router, { + config, + coreUsageData, + logger, + access, + deprecationInfo: deprecationMock, + }); await server.start(); }); diff --git a/src/core/server/integration_tests/saved_objects/routes/bulk_delete.test.ts b/src/core/server/integration_tests/saved_objects/routes/bulk_delete.test.ts index 24f2cf29fe14f..963d0b855de84 100644 --- a/src/core/server/integration_tests/saved_objects/routes/bulk_delete.test.ts +++ b/src/core/server/integration_tests/saved_objects/routes/bulk_delete.test.ts @@ -62,8 +62,20 @@ describe('POST /api/saved_objects/_bulk_delete', () => { const config = setupConfig(); const access = 'public'; - - registerBulkDeleteRoute(router, { config, coreUsageData, logger, access }); + const deprecationMock = { + documentationUrl: 'http://elastic.co', + severity: 'warning' as const, + reason: { + type: 'remove' as const, + }, + }; + registerBulkDeleteRoute(router, { + config, + coreUsageData, + logger, + access, + deprecationInfo: deprecationMock, + }); await server.start(); }); diff --git a/src/core/server/integration_tests/saved_objects/routes/bulk_get.test.ts b/src/core/server/integration_tests/saved_objects/routes/bulk_get.test.ts index 519bdbb5f6c74..3c0daba601e0f 100644 --- a/src/core/server/integration_tests/saved_objects/routes/bulk_get.test.ts +++ b/src/core/server/integration_tests/saved_objects/routes/bulk_get.test.ts @@ -60,8 +60,20 @@ describe('POST /api/saved_objects/_bulk_get', () => { const config = setupConfig(); const access = 'public'; - - registerBulkGetRoute(router, { config, coreUsageData, logger, access }); + const deprecationMock = { + documentationUrl: 'http://elastic.co', + severity: 'warning' as const, + reason: { + type: 'remove' as const, + }, + }; + registerBulkGetRoute(router, { + config, + coreUsageData, + logger, + access, + deprecationInfo: deprecationMock, + }); await server.start(); }); diff --git a/src/core/server/integration_tests/saved_objects/routes/bulk_resolve.test.ts b/src/core/server/integration_tests/saved_objects/routes/bulk_resolve.test.ts index 2636d38fc28b5..fee028804f1f2 100644 --- a/src/core/server/integration_tests/saved_objects/routes/bulk_resolve.test.ts +++ b/src/core/server/integration_tests/saved_objects/routes/bulk_resolve.test.ts @@ -61,8 +61,20 @@ describe('POST /api/saved_objects/_bulk_resolve', () => { const config = setupConfig(); const access = 'public'; - - registerBulkResolveRoute(router, { config, coreUsageData, logger, access }); + const deprecationMock = { + documentationUrl: 'http://elastic.co', + severity: 'warning' as const, + reason: { + type: 'remove' as const, + }, + }; + registerBulkResolveRoute(router, { + config, + coreUsageData, + logger, + access, + deprecationInfo: deprecationMock, + }); await server.start(); }); diff --git a/src/core/server/integration_tests/saved_objects/routes/bulk_update.test.ts b/src/core/server/integration_tests/saved_objects/routes/bulk_update.test.ts index 8ea206b4d902e..c67c64a44bcee 100644 --- a/src/core/server/integration_tests/saved_objects/routes/bulk_update.test.ts +++ b/src/core/server/integration_tests/saved_objects/routes/bulk_update.test.ts @@ -59,8 +59,20 @@ describe('PUT /api/saved_objects/_bulk_update', () => { const config = setupConfig(); const access = 'public'; - - registerBulkUpdateRoute(router, { config, coreUsageData, logger, access }); + const deprecationMock = { + documentationUrl: 'http://elastic.co', + severity: 'warning' as const, + reason: { + type: 'remove' as const, + }, + }; + registerBulkUpdateRoute(router, { + config, + coreUsageData, + logger, + access, + deprecationInfo: deprecationMock, + }); await server.start(); }); diff --git a/src/core/server/integration_tests/saved_objects/routes/legacy_import_export/export.test.ts b/src/core/server/integration_tests/saved_objects/routes/legacy_import_export/export.test.ts index 008ad527e03e3..030d41b2dfd6f 100644 --- a/src/core/server/integration_tests/saved_objects/routes/legacy_import_export/export.test.ts +++ b/src/core/server/integration_tests/saved_objects/routes/legacy_import_export/export.test.ts @@ -58,11 +58,19 @@ describe('POST /api/dashboards/export', () => { coreUsageStatsClient = coreUsageStatsClientMock.create(); coreUsageStatsClient.incrementLegacyDashboardsExport.mockRejectedValue(new Error('Oh no!')); // intentionally throw this error, which is swallowed, so we can assert that the operation does not fail const coreUsageData = coreUsageDataServiceMock.createSetupContract(coreUsageStatsClient); + const deprecationMock = { + documentationUrl: 'http://elastic.co', + severity: 'warning' as const, + reason: { + type: 'remove' as const, + }, + }; registerLegacyExportRoute(router, { kibanaVersion: 'mockversion', coreUsageData, logger: loggerMock.create(), access: 'public', + legacyDeprecationInfo: deprecationMock, }); handlerContext.savedObjects.client.bulkGet diff --git a/src/core/server/integration_tests/saved_objects/routes/legacy_import_export/import.test.ts b/src/core/server/integration_tests/saved_objects/routes/legacy_import_export/import.test.ts index 0355ac7d39706..7489ebcb6c780 100644 --- a/src/core/server/integration_tests/saved_objects/routes/legacy_import_export/import.test.ts +++ b/src/core/server/integration_tests/saved_objects/routes/legacy_import_export/import.test.ts @@ -58,11 +58,19 @@ describe('POST /api/dashboards/import', () => { coreUsageStatsClient = coreUsageStatsClientMock.create(); coreUsageStatsClient.incrementLegacyDashboardsImport.mockRejectedValue(new Error('Oh no!')); // intentionally throw this error, which is swallowed, so we can assert that the operation does not fail const coreUsageData = coreUsageDataServiceMock.createSetupContract(coreUsageStatsClient); + const deprecationMock = { + documentationUrl: 'http://elastic.co', + severity: 'warning' as const, + reason: { + type: 'remove' as const, + }, + }; registerLegacyImportRoute(router, { maxImportPayloadBytes: 26214400, coreUsageData, logger: loggerMock.create(), access: 'public', + legacyDeprecationInfo: deprecationMock, }); handlerContext.savedObjects.client.bulkCreate.mockResolvedValueOnce({ diff --git a/src/core/server/integration_tests/saved_objects/routes/resolve.test.ts b/src/core/server/integration_tests/saved_objects/routes/resolve.test.ts index e96c7ee9fb089..b858e3249c719 100644 --- a/src/core/server/integration_tests/saved_objects/routes/resolve.test.ts +++ b/src/core/server/integration_tests/saved_objects/routes/resolve.test.ts @@ -81,8 +81,20 @@ describe('GET /api/saved_objects/resolve/{type}/{id}', () => { loggerWarnSpy = jest.spyOn(logger, 'warn').mockImplementation(); const config = setupConfig(); const access = 'public'; - - registerResolveRoute(router, { config, coreUsageData, logger, access }); + const deprecationMock = { + documentationUrl: 'http://elastic.co', + severity: 'warning' as const, + reason: { + type: 'remove' as const, + }, + }; + registerResolveRoute(router, { + config, + coreUsageData, + logger, + access, + deprecationInfo: deprecationMock, + }); await server.start(); }); diff --git a/src/core/server/integration_tests/saved_objects/routes/update.test.ts b/src/core/server/integration_tests/saved_objects/routes/update.test.ts index 47f3ef4b73652..72ddc096e25ac 100644 --- a/src/core/server/integration_tests/saved_objects/routes/update.test.ts +++ b/src/core/server/integration_tests/saved_objects/routes/update.test.ts @@ -69,7 +69,20 @@ describe('PUT /api/saved_objects/{type}/{id?}', () => { const config = setupConfig(); const access = 'public'; - registerUpdateRoute(router, { config, coreUsageData, logger, access }); + const deprecationMock = { + documentationUrl: 'http://elastic.co', + severity: 'warning' as const, + reason: { + type: 'remove' as const, + }, + }; + registerUpdateRoute(router, { + config, + coreUsageData, + logger, + access, + deprecationInfo: deprecationMock, + }); await server.start(); });