Skip to content

Support Standard Schema #4614

@TheOneTheOnlyJJ

Description

@TheOneTheOnlyJJ

Prerequisites

  • I have read the documentation

What theme are you using?

other

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

I know this task is very likely monumental in size and difficulty, but I only intend this issue to serve as the basis of discussion for this feature, especially as AJV is being updated less and less frequently, which causes concern regarding long-term support.

Standard Schema is a new standard bridging the various JS/TS runtime data validation libraries.

All the most widely used JS/TS libraries (zod, valibot, etc.) conform to it, and it may be the gate toward their integration in RJSF.

Describe the solution you'd like

Up for discussion.

Describe alternatives you've considered

Up for discussion.

Activity

added
needs triageInitial label given, to be assigned correct labels and assigned
featureIs a feature request
on May 9, 2025
heath-freenome

heath-freenome commented on May 9, 2025

@heath-freenome
Member

@TheOneTheOnlyJJ I wonder whether this would help us solve the problem we are facing with #3751. Are you willing to attend one of our Friday meetings as posted in #2417?

TheOneTheOnlyJJ

TheOneTheOnlyJJ commented on May 10, 2025

@TheOneTheOnlyJJ
Author

@TheOneTheOnlyJJ I wonder whether this would help us solve the problem we are facing with #3751. Are you willing to attend one of our Friday meetings as posted in #2417?

I could join a Friday meeting, but I don't know how much help my presence would be. I am a college undergrad working on my thesis project, reporting bugs and suggesting improvements wherever I see them as potentially fit. I do not have the time or knowledge to make other extra contributions.

Also, take note that I have not used zod and Standard Schema in my projects as of now, but I found their syntax and workflow much easier to work with than writing complex JSON schemas.

Now, going back to the Standard Schema,

It is not directly related to JSON Schema, so I don't know how much it would help with #3751.
To me, it seems like a similar but still different topic, as it is aimed at supporting the runtime validation libs.

Some of these runtime validation libraries do have a very handy toJsonSchema() method for their runtime schema types. For example, zod will add it in V4: https://v4.zod.dev/v4#json-schema-conversion

And even better than that, there's an open issue in the Standard Schema repo suggesting the addition of toJSONSchema() directly to the standard (standard-schema/standard-schema#21), requiring all of the conforming libraries to support it if approved.

If this happens, I see it as nothing less than a direct invitation for RJSF to support all the Standard Schema-compliant runtime validation libraries, conveniently, all at once.

Imagine taking a zod, valibot, or any other such compliant library schema as input, typed as the generic Standard Schema interface, passing it to RJSF, and then just calling toJSONSchema() on it, and letting RJSF handle the rest as it already does, no further code changes being required.

Take into account that this is a situation in which #3751 may cause issues.

This could even be abstracted as some sort of inputSchemaAdapter in RJSF (utils? Maybe just a type declaration would be all that's needed), allowing the formatting of any input type to JSON Schema inside RJSF. This way, developers could add any conversion function they want, and the library can export a set of default functions (such as the Standard Schema adapter).
This way, someone could even create an XML Schema (XSD) adapter and have it play nicely with RJSF.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @heath-freenome@TheOneTheOnlyJJ

        Issue actions

          Support Standard Schema · Issue #4614 · rjsf-team/react-jsonschema-form