Function validateOpenRPCDocument

  • Returns any JSON Schema validation errors that are found with the OpenRPC document passed in.

    Parameters

    • document: OpenrpcDocument

      OpenRPC Document to validate.

    Returns OpenRPCDocumentValidationError | true

    Either true if everything checks out, or a well formatted error.

    Example


    import { validateOpenRPCDocument } from "@open-rpc/schema-utils-js";
    const badOpenRPCDocument = {} as any;

    const result = validateOpenRPCDocument(badOpenRPCDocument);
    if (result !== true) {
    console.error(result);
    }