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 able to run compileSchemaValidators for commonJS output generation just fine. However, when I try to compile for esm: true the same schema generates an error. I have found that if I remove the "oneOf" statement the error goes away.
"use strict";
const path = require("path");
const cfgSchema = require("./cfgSchema.json");
const compileSchemaValidators = require("@rjsf/validator-ajv8/dist/compileSchemaValidators").default;
const RJSF_OUTPUT_PATH = path.join(__dirname, "./validateSchema_rjsf.js");
// ------------------------------------------------------------------------------------
// react-jsonschema-form
// ------------------------------------------------------------------------------------
const options = {
ajvOptionsOverrides: {
// using "esm: true" results in a crash:
// Error: CodeGen: invalid export name: -634615b0, use explicit $id name mapping
// at getEsmExportName (C:\repos\MMA_Ng\node_modules\ajv\dist\compile\codegen\code.js:149:11)
// at multiExportsCode (C:\repos\MMA_Ng\node_modules\ajv\dist\standalone\index.js:40:81)
// at standaloneCode (C:\repos\MMA_Ng\node_modules\ajv\dist\standalone\index.js:14:15)
// at compileSchemaValidatorsCode (C:\repos\MMA_Ng\node_modules\@rjsf\validator-ajv8\dist\compileSchemaValidators.js:91:40)
// at compileSchemaValidators (C:\repos\MMA_Ng\node_modules\@rjsf\validator-ajv8\dist\compileSchemaValidators.js:97:22)
// at Object.<anonymous> (C:\repos\MMA_Ng\tasks\precompileSchema.js:70:3)
// at Module._compile (node:internal/modules/cjs/loader:1469:14)
// at Module._extensions..js (node:internal/modules/cjs/loader:1548:10)
// at Module.load (node:internal/modules/cjs/loader:1288:32)
// at Module._load (node:internal/modules/cjs/loader:1104:12)
code: { source: true, esm: true }
}
};
try {
// React-jsonschema-form requires its own precompiled format, so compile again
compileSchemaValidators(cfgSchema, RJSF_OUTPUT_PATH, options);
}
catch (err) {
console.error("RJSF precompilation failed...");
console.error(err);
}
My full schema has several "oneOf" statements so I had to delete definitions to find the originating error-- the numeric reference (e.g. -634615b0) offered nothing useful.
Expected Behavior
I expect the compiler to generate an ES compatible validator.
Steps To Reproduce
Using the attached zip file in Windows:
extract the zip to a directory (e.g. c:\tmp\rjsfissue)
cd rjsfissue
npm install
npm start
Errored result:
$ npm start
> [email protected] start
> node ./precompileSchema.js
parsing the schema
RJSF precompilation failed...
Error: CodeGen: invalid export name: -634615b0, use explicit $id name mapping
at getEsmExportName (C:\tmp\rsjffIssue\node_modules\ajv\dist\compile\codegen\code.js:149:11)
at multiExportsCode (C:\tmp\rsjffIssue\node_modules\ajv\dist\standalone\index.js:40:81)
at standaloneCode (C:\tmp\rsjffIssue\node_modules\ajv\dist\standalone\index.js:14:15)
at compileSchemaValidatorsCode (C:\tmp\rsjffIssue\node_modules\@rjsf\validator-ajv8\dist\compileSchemaValidators.js:91:40)
at compileSchemaValidators (C:\tmp\rsjffIssue\node_modules\@rjsf\validator-ajv8\dist\compileSchemaValidators.js:97:22)
at Object.<anonymous> (C:\tmp\rsjffIssue\precompileSchema.js:34:3)
at Module._compile (node:internal/modules/cjs/loader:1469:14)
at Module._extensions..js (node:internal/modules/cjs/loader:1548:10)
at Module.load (node:internal/modules/cjs/loader:1288:32)
at Module._load (node:internal/modules/cjs/loader:1104:12)
Prerequisites
What theme are you using?
bootstrap-4
Version
5.23.1
Current Behavior
I am able to run
compileSchemaValidators
for commonJS output generation just fine. However, when I try to compile foresm: true
the same schema generates an error. I have found that if I remove the "oneOf" statement the error goes away.Sample schema:
Generation code:
My full schema has several "oneOf" statements so I had to delete definitions to find the originating error-- the numeric reference (e.g. -634615b0) offered nothing useful.
Expected Behavior
I expect the compiler to generate an ES compatible validator.
Steps To Reproduce
Using the attached zip file in Windows:
c:\tmp\rjsfissue
)cd rjsfissue
npm install
npm start
Environment
Anything else?
rsjffIssue.zip
The text was updated successfully, but these errors were encountered: