We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 32839f4 commit ca0a3bcCopy full SHA for ca0a3bc
packages/optimizely-sdk/lib/utils/json_schema_validator/index.ts
@@ -27,11 +27,11 @@ const MODULE_NAME = 'JSON_SCHEMA_VALIDATOR';
27
* @return {boolean} true if the given object is valid
28
*/
29
export function validate(jsonObject: unknown): boolean {
30
- if (!jsonObject) {
+ if (typeof jsonObject !== 'object' || jsonObject === null) {
31
throw new Error(sprintf(ERROR_MESSAGES.NO_JSON_PROVIDED, MODULE_NAME));
32
}
33
34
- const result = jsonSchemaValidator(jsonObject as {}, schema);
+ const result = jsonSchemaValidator(jsonObject, schema);
35
if (result.valid) {
36
return true;
37
} else {
0 commit comments