Skip to content

Is Precompiled Schema Validation Supported in RJSF 6.0.0-beta.7? #4618

Open
@WiktorG

Description

@WiktorG

Prerequisites

What theme are you using?

shadcn

What is your question?

Hi! Thanks for the recent updates—support for shadcn is awesome! 😊

I'm building a Chrome extension and running into the following error:

Refused to evaluate a string as JavaScript because 'unsafe-eval' is not an allowed source of script in the following Content Security Policy directive: "script-src 'self'".

From what I understand, based on the docs, I need to precompile my schema to avoid eval. However, the example there seems outdated.

First, it shows a TypeScript error indicating it needs more arguments than what's shown in the documentation:

Image

Even if I pass JSONSchema that I used to generate precompiledValidator it throws following error in the browsers console.

Image

Am I doing something the wrong way or is it not supported yet in the 6.0.0-beta.7 version?

Here's a part my package.json

"dependencies": {
     ...
    "@rjsf/core": "6.0.0-beta.7",
    "@rjsf/shadcn": "6.0.0-beta.7",
    "@rjsf/utils": "6.0.0-beta.7",
    "@rjsf/validator-ajv8": "6.0.0-beta.7",
    ...
  },

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions