From a71ecded0d35fbe0682cc39750ae440bf5e0bb30 Mon Sep 17 00:00:00 2001 From: codingwithmanny Date: Mon, 2 Jan 2023 23:22:47 +0300 Subject: [PATCH] docs: validateOpenRPCDocument Example Adjusted example code with import and try/catch BREAKING CHANGE: N --- src/validate-open-rpc-document.ts | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/src/validate-open-rpc-document.ts b/src/validate-open-rpc-document.ts index 050cac40..2ef65d17 100644 --- a/src/validate-open-rpc-document.ts +++ b/src/validate-open-rpc-document.ts @@ -35,13 +35,17 @@ export class OpenRPCDocumentValidationError implements Error { * @example * ```typescript * - * const { types } from "@open-rpc/meta-schema" - * const { validateOpenRPCDocument } from "@open-rpc/schema-utils-js"; - * const badOpenRPCDocument = {}; - * const errors = validateOpenRPCDocument({}); - * if (errors) { - * // handle errors + * import { validateOpenRPCDocument } from "@open-rpc/schema-utils-js"; + * const badOpenRPCDocument = {} as any; + * try { + * const isValid = validateOpenRPCDocument(badOpenRPCDocument); + * if (isValid) { + * // handle validity + * } + * } catch (error) { + * // handle error * } + * ``` * */