Skip to content

Commit

Permalink
docs: validateOpenRPCDocument Example
Browse files Browse the repository at this point in the history
Adjusted example code with import and try/catch

BREAKING CHANGE: N
  • Loading branch information
codingwithmanny authored and codingwithmanny committed Jan 2, 2023
1 parent de615ee commit a71ecde
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions src/validate-open-rpc-document.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
* }
* ```
*
*/
Expand Down

0 comments on commit a71ecde

Please sign in to comment.