Skip to content

Commit

Permalink
isObject needs the type coercion
Browse files Browse the repository at this point in the history
  • Loading branch information
jbolda committed Oct 4, 2023
1 parent 00840d5 commit 0aca88d
Showing 1 changed file with 10 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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)
);
}

0 comments on commit 0aca88d

Please sign in to comment.