You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am unable to create a node script that can successfully call compileSchemaValidators.
Method from the docs: import { compileSchemaValidators } from '@rjsf/validator-ajv8' does not export the method
Method from similar issue: import { compileSchemaValidators } from '@rjsf/validator-ajv8/lib/compileSchemaValidators'; raises a module not found error
Require syntax to try to avoid module problems: const { compileSchemaValidators } = require('@rjsf/validator-ajv8/dist/compileSchemaValidators.esm') raises SyntaxError: Cannot use import statement outside a module due to fs import in @rjsf/validator-ajv8/lib/compileSchemaValidators.js:1
Expected Behavior
Be able to import compileSchemaValidators in a JS file so that precompiled validators can be constructed.
If possible, with the require syntax so that it doesn't have to be within a module.
- OS: Ubuntu 22.04
- Node: 20.5.1
- npm: 9.8.0
Originally tried to add as a script to my Create React App.
Also tried executing as a new npm project setup as a module.
Anything else?
Hopefully I'm missing something extremely obvious but so far I've lost hours just trying to be able to call the compileSchemaValidators
I also tried using the Ajv CLI but I'm guessing there is some difference in format as RJSF as I got No precompiled validator function was found for the given schema when trying to validate with it.
It would also be great to be able to not provide a validator if desired, instead of having to do this to get around CSP.
The text was updated successfully, but these errors were encountered:
Prerequisites
What theme are you using?
core
Version
5.17.0
Current Behavior
I am unable to create a node script that can successfully call
compileSchemaValidators
.import { compileSchemaValidators } from '@rjsf/validator-ajv8'
does not export the methodimport { compileSchemaValidators } from '@rjsf/validator-ajv8/lib/compileSchemaValidators';
raises a module not found errorconst { compileSchemaValidators } = require('@rjsf/validator-ajv8/dist/compileSchemaValidators.esm')
raisesSyntaxError: Cannot use import statement outside a module
due tofs
import in@rjsf/validator-ajv8/lib/compileSchemaValidators.js:1
Expected Behavior
Be able to import
compileSchemaValidators
in a JS file so that precompiled validators can be constructed.If possible, with the
require
syntax so that it doesn't have to be within a module.Steps To Reproduce
npm init -y
npm i @rjsf/validator-ajv8
package.json
with"type": "module"
node myFile.js
Environment
Anything else?
Hopefully I'm missing something extremely obvious but so far I've lost hours just trying to be able to call the
compileSchemaValidators
I also tried using the Ajv CLI but I'm guessing there is some difference in format as RJSF as I got
No precompiled validator function was found for the given schema
when trying to validate with it.It would also be great to be able to not provide a validator if desired, instead of having to do this to get around CSP.
The text was updated successfully, but these errors were encountered: