From 878f2efc514810e03567d167b61b92f66cd74790 Mon Sep 17 00:00:00 2001 From: Vincenzo Scamporlino Date: Thu, 20 Jun 2024 15:45:02 +0200 Subject: [PATCH] backend-plugin-api: fix typings in health service Signed-off-by: Vincenzo Scamporlino --- docs/backend-system/core-services/root-health.md | 4 ++-- packages/backend-plugin-api/api-report.md | 4 ++-- .../src/services/definitions/RootHealthService.ts | 6 ++++-- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/docs/backend-system/core-services/root-health.md b/docs/backend-system/core-services/root-health.md index cdf18aa1f9..fc73ba9546 100644 --- a/docs/backend-system/core-services/root-health.md +++ b/docs/backend-system/core-services/root-health.md @@ -17,12 +17,12 @@ import { RootHealthService, coreServices } from '@backstage/backend-plugin-api'; const backend = createBackend(); class MyRootHealthService implements RootHealthService { - async getLiveness(): Promise<{ status: number; payload?: any }> { + async getLiveness() { // provide your own implementation return { status: 200, payload: { status: 'ok' } }; } - async getReadiness(): Promise<{ status: number; payload?: any }> { + async getReadiness() { // provide your own implementation return { status: 200, payload: { status: 'ok' } }; } diff --git a/packages/backend-plugin-api/api-report.md b/packages/backend-plugin-api/api-report.md index ef5aa22cf4..e9762f652e 100644 --- a/packages/backend-plugin-api/api-report.md +++ b/packages/backend-plugin-api/api-report.md @@ -505,11 +505,11 @@ export interface RootConfigService extends Config {} export interface RootHealthService { getLiveness(): Promise<{ status: number; - payload?: any; + payload?: JsonValue; }>; getReadiness(): Promise<{ status: number; - payload?: any; + payload?: JsonValue; }>; } diff --git a/packages/backend-plugin-api/src/services/definitions/RootHealthService.ts b/packages/backend-plugin-api/src/services/definitions/RootHealthService.ts index ac482b5dbb..e6c56e8654 100644 --- a/packages/backend-plugin-api/src/services/definitions/RootHealthService.ts +++ b/packages/backend-plugin-api/src/services/definitions/RootHealthService.ts @@ -14,6 +14,8 @@ * limitations under the License. */ +import { JsonValue } from '@backstage/types'; + /** * @public */ @@ -21,9 +23,9 @@ export interface RootHealthService { /** * Get the liveness status of the backend. */ - getLiveness(): Promise<{ status: number; payload?: any }>; + getLiveness(): Promise<{ status: number; payload?: JsonValue }>; /** * Get the readiness status of the backend. */ - getReadiness(): Promise<{ status: number; payload?: any }>; + getReadiness(): Promise<{ status: number; payload?: JsonValue }>; }