From 0aca88d57c9488a0944879ee6f4baae76639de3e Mon Sep 17 00:00:00 2001 From: Jacob Bolda Date: Wed, 4 Oct 2023 16:44:42 -0500 Subject: [PATCH] isObject needs the type coercion --- .../src/hooks/useAsyncValidation.ts | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/plugins/scaffolder-frontend-workflow/src/hooks/useAsyncValidation.ts b/plugins/scaffolder-frontend-workflow/src/hooks/useAsyncValidation.ts index 6ae2d3d551..25e564bd45 100644 --- a/plugins/scaffolder-frontend-workflow/src/hooks/useAsyncValidation.ts +++ b/plugins/scaffolder-frontend-workflow/src/hooks/useAsyncValidation.ts @@ -10,7 +10,7 @@ import { Draft07 as JSONSchema, isJSONError } from 'json-schema-library'; import { useApiHolder, ApiHolder } from '@backstage/core-plugin-api'; import { JsonObject, JsonValue } from '@backstage/types'; -import { ErrorSchemaBuilder, isObject } from '@rjsf/utils'; +import { ErrorSchemaBuilder, isObject as isRJSFObject } from '@rjsf/utils'; import { Validators } from './useValidators'; export interface AsyncValidationProps { @@ -156,3 +156,12 @@ function createAsyncValidators( return validated.ErrorSchema; }; } + +function isObject(value: unknown): value is JsonObject { + return ( + typeof value === 'object' && + value !== null && + !Array.isArray(value) && + isRJSFObject(value) + ); +}