Contributing
Development server
We are using Vite to power our playground, which caches all the built @rjsf/* distributions.
In order to test the playground locally after a new clone or fresh pull from main, run the following from the root directory of the monorepo:
pnpm install
pnpm run build
cd packages/playground
pnpm start
This will start the live development server showcasing components at localhost:8080.
Whenever you make changes to source code, stop the running playground and return to the root directory and rerun pnpm run build.
Thanks to nx caching, this should only rebuild what is necessary.
After the build is complete, return to the root of the playground and restart the server via pnpm start.
First time step
If this is the first time you have cloned the repo, run the pnpm run prepare script that will set up husky to provide a git precommit hook that will format and lint any code you have added to a PR.
Optional development process
With the large number of packages, sometimes running pnpm run build or pnpm start from the root directory will overwhelm an underpowered computer.
If that is the situation for you, you can instead use pnpm run build-serial to build the packages one at a time instead of all at once.
Also, if you are only working on one package, you can pnpm run build and pnpm run test from within the subdirectory.
Finally, you can simply pnpm start inside of the playground directory to test changes if you have already built all of your packages, without needing to watch all of the packages via the root directory pnpm start.
Troubleshooting build failures
Sometimes your local builds fail and you can't figure out why. This is most likely to happen after rebase to main due
to package.json changes upstream. There are two commands you can use to (hopefully) get your environment back to a
working state. Try running the following two commands:
pnpm run refresh-node-modules
pnpm run clean-build
The first command will delete all of the node_modules directories in the environment and then rerun pnpm install.
The second command deletes every package's built lib/ before retrying the build.
Worst case scenario when neither of those commands work, try running pnpm run nuke-build-env and then rerun the two commands.
Cloud builds
When building in environments with limited memory, such as Netlify, it's recommended to use pnpm run build-serial that builds the packages serially.
Coding style
All the JavaScript/Typescript code in this project is formatted with oxfmt and linted with oxlint.
oxfmt formats every file type it supports, not just source: Markdown, YAML, JSON and CSS are checked too, so a changelog or docs edit can need formatting as much as a component does.
Staged files are automatically formatted upon commit using precommit hooks, assuming you followed the First time step above.
CI checks the formatting with pnpm cs-check, so run pnpm cs-format from the repository root for any commit the hooks did not see — one made with --no-verify, from a fresh worktree, or through the GitHub web editor.
Public entry points
A package's public API is what its root exports, plus the subpaths its package.json exports lists: @rjsf/core/markdown, @rjsf/core/testing, core's two stylesheets, compileSchemaValidators in @rjsf/validator-ajv8 and @rjsf/validator-ata, and @rjsf/snapshot-tests/setup.
Nothing under lib/ can be imported on its own, so a new module is internal until the package root exports something from it, and every name the root exports has to keep working until the next major.
To make something public, export it from the package root and add a changelog entry; add a subpath to exports only for an entry point that has to load separately, as @rjsf/core/markdown does.
@rjsf/utils exports only what another RJSF package's source imports, which pnpm run knip checks: its src/index.ts names every value it exports rather than re-exporting a module with export *, and an export only tests import is tagged @testSeam. An export that is public API though no other package's source imports it is tagged @public, which knip never reports: the validator-based schema functions, which consumers call on their own though RJSF reaches them through createSchemaUtils(), the id generators optionDescriptionId(), optionHelpId() and selectedOptionDescriptionId(), which name parts RJSF renders, RJSF_PROVENANCE_KEY, which consumers' tests strip from a retrieved schema before comparing it with one written by hand, and SHARED_COPY_ID, by which a custom validator recognises a part an option's scoring copy holds once.
Changelog
A PR that changes anything a user of a published package can notice adds an entry to the changelog for each change users notice, so a PR that fixes one thing and adds another adds two.
Append each as the last bullet under the heading of each package whose users notice the change, in the upcoming release at the top of the file.
If the top heading is dated, that release has shipped: add an undated heading for the next version above it.
A change that belongs to no single package, such as a new Node or React requirement, goes once under All packages instead.
If the change needs a bigger semver bump than that release's heading names, update the heading.
A change to a package's peer dependency range goes under that package, and so does a dependency bump that changes what its users get, such as a fix or a new minimum version.
Tests, CI, refactors, docs changes, playground changes and dependency bumps users can't notice need no entry, and neither does a change to something that isn't released yet: edit that change's entry instead, keeping its PR link and adding yours after it.
Write the entry for someone deciding whether to upgrade, who won't open the PR:
- Start with
Add,Change,Deprecate,FixorRemove, and name the component, prop or export a user meets, in backticks. UseFixwhen the old behavior was wrong for users andChangewhen it worked as intended but now works differently. - Say what users notice, not how the code does it, and leave out internal helpers, hooks and concepts users never meet. A fix names what went wrong for them: "Fix
ArrayFielddropping the last item's errors when an item is removed". - Leave the reasoning, the alternatives, the edge cases and related issues to the PR description.
- End the entry with its PR and then each issue it fixes, as in
([#5305](https://github.com/rjsf-team/react-jsonschema-form/pull/5305), [#4666](https://github.com/rjsf-team/react-jsonschema-form/issues/4666)): a PR's link haspull, an issue's hasissues. - Start a breaking change with
**BREAKING CHANGE:**followed by the verb, as in**BREAKING CHANGE:** Remove …, say what now happens, and end the text withSee [the upgrade guide](…), linking the upgrade guide section that says what to change. Link it on the docs site, as inhttps://rjsf-team.github.io/react-jsonschema-form/docs/migration-guides/vN.x%20upgrade%20guide#<section>, since the entry is also copied into a GitHub Release, where relative paths don't resolve. - A change is breaking if users have to change their code, styles or tests to keep what they had, including a different default, generated
idor class name, or a narrower or reshaped type, such as anenumbecoming a union type. A type-only break gets an upgrade guide section too. - Aim for a sentence or two, about 200 characters of text, not counting link URLs. If it can't be both short and clear, keep it clear.
For example, instead of an entry that explains the implementation:
Fixed
ObjectFieldTemplaterendering a property with no column span when thecolSpanmap informContexthas no usable entry for its widget or field name. The lookup now falls through to the schema type and then to the default span, skipping entries that are not a whole number of columns from 0 to 24 and aui:fieldthat names no registered component. …
write what users see:
Fix
ObjectFieldTemplategiving a property no column span whenformContext.colSpanhas no valid entry for it (#5450, #5447)
A breaking entry has the same shape:
BREAKING CHANGE: Change an additional property's key input id from
root_foo-keytoroot_foo__key. See the upgrade guide (#5626)
Upgrade guide
A breaking change also gets a section in the upgrade guide for the next major version N, packages/docs/docs/migration-guides/vN.x upgrade guide.md, in the same PR. Create the file if it doesn't exist yet.
The guide answers one question: "my code broke, what do I change?". Each section has a heading that names the change as users meet it, then says who it affects, what happened before and what happens now, and what to do instead, with a before/after diff when code has to change. Link the reference docs for anything more.
New features, the reasons behind a change and comparisons of alternatives belong in the reference docs, not in the guide.
Documentation
We use Docusaurus to build our documentation. To run documentation locally, run:
cd packages/docs
pnpm start
Documentation will be served on localhost:3000.
Tests
You can run all tests from the root directory OR from packages subdirectory using the following command:
pnpm run test
Snapshot testing
All the themes, including core use snapshot testing (NOTE: core also has extensive non-snapshot tests).
The source-code of these snapshot tests resides in the snapshot-tests package and is shared with all the themes. core's own snapshot tests live in packages/snapshot-tests/test, since snapshot-tests depends on core.
In order to support the various themes, the code for the tests are actually functions that take the theme's Form component (ComponentType<FormProps>).
The snapshot-tests package provides arrayTests, formTests and objectTests, plus gridTests, which also takes a map of the props (such as classNames) that the theme's layout grid needs for each row and column width.
Each theme will basically run these functions by creating a Xxx.test.tsx file (where Xxx is Array, Form or Object) that looks like the following:
import { arrayTests } from '@rjsf/snapshot-tests'; // OR
// import { formTests } from '@rjsf/snapshot-tests';
// import { objectTests } from '@rjsf/snapshot-tests';
import Form from '../src';
arrayTests(Form); // OR
// formTests(Form);
// objectTests(Form);
The suites expect getTestIds from @rjsf/utils to be mocked out before the theme's Form is imported, so each theme's vitest.config.mts lists a test/snapshotSetup.ts that loads @rjsf/snapshot-tests/setup. Without it the snapshots pick up numbered data-testid values that the other themes don't produce, and fail.
The file imports the setup rather than setupFiles naming it, since Vitest resolves a setupFiles entry without the @rjsf/source condition, so naming it there would load the built lib/setup.js and need a build first:
// test/snapshotSetup.ts
import '@rjsf/snapshot-tests/setup';
export default mergeConfig(base, {
test: {
setupFiles: ['./test/snapshotSetup.ts'],
},
});
Anytime you add a new feature, be sure to update the appropriate xxxTests() function in the snapshot-tests package and do pnpm run test:update from the root directory to update all the snapshots.
If you add a theme-only feature, it is ok to update the appropriate Xxx.test.tsx file to add (or update) the theme-specific describe() block.
For example:
import { RJSFSchema, UiSchema } from '@rjsf/utils';
import { arrayTests } from '@rjsf/snapshot-tests';
import Form from '../src';
formTests(Form);
describe('Theme specific tests', () => {
it('test a theme-specific option', () => {
const schema: RJSFSchema = {
type: 'object',
properties: {
name: {
type: 'string',
},
},
};
const uiSchema: UiSchema = {
// Enable the theme specific feature
};
const tree = renderer.create(<Form schema={schema} uiSchema={uiSchema} validator={validator} />).toJSON();
expect(tree).toMatchSnapshot();
});
});
See the antd Form.test.tsx for a specific example of this.
Code coverage
Code coverage reports are currently available only for the @rjsf/core theme package.
They are generated using nyc each time the pnpm test-coverage script is run.
The full report can be seen by opening ./coverage/lcov-report/index.html.
Utils and validator-ajv8 code coverage
100% code coverage is required by the @rjsf/utils and @rjsf/validator-ajv8 tests.
If you make changes to those libraries, you will have to maintain that coverage, otherwise the tests will fail.
NOTE: All three of these directories share the same tests for verifying
validatorbased APIs. See the documentation in thegetTestValidator()functions for more information.
Releasing
Each release starts by turning the upcoming release's section of the changelog into release notes. Commit them on the rc branch below before you run pnpm exec nx release version --git-tag, so that the tagged commit carries them. Date the section's heading with the day you plan to publish, as in # 7.100.10 (2026-11-01), and if the rc PR merges on a later day, correct the date in that PR before merging it. Start the section with a few highlights, put breaking changes first under each package, and merge entries that describe one change.
To release, go to the main branch (NOT a fork) and then create a new branch with the version number (with an rc prefix instead of v).
For instance if you are about to create the new 7.100.10 branch, then you would run the following commands:
git checkout -b rc7.100.10
git commit -m "Release notes for 7.100.10" CHANGELOG.md
pnpm exec nx release version --git-tag
git commit -m "Releasing 7.100.10"
git push
pnpm run update-version-tags
Make sure you use semver for version numbering when selecting the version.
The pnpm exec nx release version --git-tag command will update the package*.json files and create a new version tag.
Committing and pushing the branch will allow you to create the PR on GitHub.
The pnpm run update-version-tags will push the tags up to GitHub.
Then, make a PR to main. Merge the PR into main -- make sure you use "merge commit", not squash and merge, so that the original commit where the tag was based on is still present in the main branch.
Then, create a release in the GitHub "Releases" tab, select the new tag that you have added,
and copy the release's changelog section into its description.
If this is a new major's first stable release (e.g. 7.0.0), also update the previous major's docs banner as Releasing docs describes.
This will trigger a GitHub Actions pipeline that will build and publish all packages to npm.
The package is published through an automation token belonging to the
rjsf-bot user on npm. This token
is stored as the NPM_TOKEN secret on GitHub Actions.
Releasing docs
Docs are automatically published to GitHub Pages when the main branch is updated.
packages/docs/docs holds the docs for the major on main; each earlier major keeps a frozen copy under packages/docs/versioned_docs/.
Once a new major lands on main, freeze the outgoing major's docs:
- Check out the outgoing major's last release commit (e.g.
Releasing 6.11.1), runpnpm install, thenpnpm --filter ./packages/docs docusaurus docs:version <x.y.z>with that release's version. It writesversioned_docs/version-<x.y.z>/,versioned_sidebars/version-<x.y.z>-sidebars.jsonand theversions.jsonentry; copy those onto a branch frommain. In the copy, point theblob/mainandtree/mainGitHub links at the release's tag (e.g.blob/v6.11.1), so they keep showing that release's code. - Add the version to
versionsinpackages/docs/docusaurus.config.jswithlabel: 'v<major>'andpath: 'version-<x.y.z>'. Thecurrentlabel reads@rjsf/docs's version, so it names the outgoing major until the new major's first release, such as7.0.0-beta.1, is versioned. Until the new major's first stable release (e.g.7.0.0) is published, also give the frozen versionbanner: 'none': until then, npm'slatesttag still installs the frozen major, so its docs are the ones that match. - Check that
pnpm --filter ./packages/docs buildpasses and that the version dropdown links the frozen pages.
Until then, a prerelease is published under npm's next tag, so the install commands in packages/docs/docs/00-introduction.mdx and the package READMEs name each @rjsf/* package with @next.
When the new major's first stable release is published, remove that banner: 'none', so the frozen docs show Docusaurus's "no longer actively maintained" banner, and drop the @next from those install commands.
After that, fix the outgoing major's docs in its versioned_docs/version-<x.y.z>/ copy, not in packages/docs/docs.
Releasing the playground
The playground automatically gets deployed from GitHub Pages.
If you need to manually publish the latest playground to https://rjsf-team.github.io/react-jsonschema-form/, though, run:
cd packages/playground
pnpm run publish-to-gh-pages
Releasing a new package
Publishing a new @rjsf/* package requires additional setup. The package must first be published locally, then in the NPM web app, you must set up "Trusted Publishing" so future releases can be published via GitHub Actions. The steps to accomplish this are:
- Create the new release as described above. Existing packages will be published, but the jobs to publish new package(s) will fail.
- Locally, check out the release tag (e.g.
git checkout v7.100.10). You may need togit fetch --tags. Make sure yourgit statusis clean. cd packages/new-packagepnpm login(login to an account with RJSF publishing privileges)pnpm publish --no-git-checks.
The new package will be released. Then, set up Trusted Publishing:
- Navigate to the new package in NPM (e.g.
https://www.npmjs.com/package/@rjsf/new-package) - Go to Settings -> Trusted Publisher -> GitHub Actions
- Set up the fields to match an existing package (e.g. look at
@rjsf/core).- Organization or user:
rjsf-team - Repository:
react-jsonschema-form - Workflow filename:
release.yml - Allow
npm publish
- Organization or user: