rjsf-team / react-jsonschema-form

A React component for building Web forms from JSON Schema.
https://rjsf-team.github.io/react-jsonschema-form/
Apache License 2.0
14.3k stars 2.19k forks source link

Could ajv be *optionally* swapped with `@cfworker/json-schema`? #3269

Open fregante opened 1 year ago

fregante commented 1 year ago

Prerequisites

What theme are you using?

bootstrap-4

Is your feature request related to a problem? Please describe.

The issue is that I can't use RJSF in a context that disallows unsafe-eval, as described a few times before.

Describe the solution you'd like

Could RJSF offer validation based on @cfworker/json-schema, for example? I noticed that was made in the v5 branch towards this goal:

This could be offered as an alternative to the built-in ajv-based validation

Describe alternatives you've considered

No response

heath-freenome commented 1 year ago

@fregante Does this still occur with the avj8 validator provided in the beta? Also, one definitely CAN build a validator implementation that uses @cfworker/json-schema. As a small team of volunteers we don't have the bandwidth to build it ourselves, but we would definitely consider adding it to the repo if someone else were to build it and it passes all of the tests with the utils and core libraries. Can we sign you up? :)

fregante commented 1 year ago

According to this issue, v8 still uses unsafe evaluation, so the issue still exists: https://github.com/ajv-validator/ajv/issues/1830

heath-freenome commented 1 year ago

According to this issue, v8 still uses unsafe evaluation, so the issue still exists: ajv-validator/ajv#1830

Lovely... Are you interested in building a validator for @rjsf that uses @cfworker/json-schema?

joeyJsonar commented 1 year ago

We definitely need a custom validator at this point. We cannot precomile as our forms are themselves form so dynamically from an api, so cannot precompile. @heath-freenome

alfonsoar commented 2 months ago

@joeyJsonar @fregante did you ever find a path forward? I'm considering contributing a validator that uses @cfworker/json-schema.

Dynamic pre-compiling is not an option since we need to do this all on the client side.

fregante commented 2 months ago

@alfonsoar I wasn't the one who worked on this in the end. Apparently it was done in https://github.com/pixiebrix/pixiebrix-extension/pull/7081 but I have no knowledge of it.