Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

compileSchemaValidatorsCode not working on server side due to : The requested module '@rjsf/utils' does not provide an export named 'ADDITIONAL_PROPERTY_FLAG' #4766

Open
Labels
bug needs reproducible exampleMissing a link to a reproduction in the playground, CodeSandbox, JSFiddle, etc.
@cperotAxway

Description

Prerequisites

What theme are you using?

antd

Version

5.24.13

Current Behavior

In order to be able to supports CSP without 'unsafe-eval' I'm trying to set up what is described here: https://rjsf-team.github.io/react-jsonschema-form/docs/usage/validation/#dynamically-pre-compiling-validators.
So I have to call on server side:

import { compileSchemaValidatorsCode } from '@rjsf/validator-ajv8/compileSchemaValidators';

const code = compileSchemaValidatorsCode(schema, options);

It's working with latest v6 beta but not with 5.24.13. I encounter the following error:

import { ADDITIONAL_PROPERTY_FLAG, RJSF_ADDITIONAL_PROPERTIES_FLAG } from '@rjsf/utils';
^^^^^^^^^^^^^^^^^^^^^^^^

SyntaxError: The requested module '@rjsf/utils' does not provide an export named 'ADDITIONAL_PROPERTY_FLAG'
at ModuleJobSync.runSync (node:internal/modules/esm/module_job:376:37)
at ModuleLoader.importSyncForRequire (node:internal/modules/esm/loader:323:47)
at loadESMFromCJS (node:internal/modules/cjs/loader:1371:24)
at Module._compile (node:internal/modules/cjs/loader:1511:5)
at Module._extensions..js (node:internal/modules/cjs/loader:1613:10)
at Module.load (node:internal/modules/cjs/loader:1275:32)
at Module._load (node:internal/modules/cjs/loader:1096:12)
at Module.require (node:internal/modules/cjs/loader:1298:19)
at require (node:internal/modules/helpers:182:18)
at Object. (/home/cperot/workspace/marketplace-web/dist-server/app.js:46:35)

Is there a workaround ? Is there an estimated date of when V6 will be delivered not in beta ?

Expected Behavior

No exception is thrown

Steps To Reproduce

  1. have a webserver like fastify or express and use rjsf version 5.24.13
  2. add and endpoint that calls
import compileSchemaValidatorsCode } from '@rjsf/validator-ajv8/compileSchemaValidators';
const code = compileSchemaValidatorsCode(schema, options);
  1. when starting the server it complains:
    SyntaxError: The requested module '@rjsf/utils' does not provide an export named 'ADDITIONAL_PROPERTY_FLAG'
    at ModuleJobSync.runSync (node:internal/modules/esm/module_job:376:37)
    at ModuleLoader.importSyncForRequire (node:internal/modules/esm/loader:323:47)
    at loadESMFromCJS (node:internal/modules/cjs/loader:1371:24)
    at Module._compile (node:internal/modules/cjs/loader:1511:5)
    at Module._extensions..js (node:internal/modules/cjs/loader:1613:10)
    at Module.load (node:internal/modules/cjs/loader:1275:32)
    at Module._load (node:internal/modules/cjs/loader:1096:12)
    at Module.require (node:internal/modules/cjs/loader:1298:19)
    at require (node:internal/modules/helpers:182:18)
    at Object. (/home/cperot/workspace/marketplace-web/dist-server/app.js:46:35)

Environment

- OS: 
Linux A-2D5VCY3 6.8.0-65-generic #68~22.04.1-Ubuntu SMP PREEMPT_DYNAMIC Tue Jul 15 18:06:34 UTC 2 x86_64 x86_64 x86_64 GNU/Linux
- Node:
v20.19.3
- npm:
10.8.2

Anything else?

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug needs reproducible exampleMissing a link to a reproduction in the playground, CodeSandbox, JSFiddle, etc.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

        AltStyle によって変換されたページ (->オリジナル) /