Skip to content

Improve Form to stash schemaUtils.rootSchema as state.schema #4687

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 16, 2025

Conversation

heath-freenome
Copy link
Member

@heath-freenome heath-freenome commented Jul 11, 2025

Reasons for making this change

To assist potential future transformations of the rootSchema in the schemaUtils, updated Form to always use that as the state.schema

  • In @rjsf/utils:
    • Added getRootSchema() to the SchemaUtilsType and createSchemaUtils()
    • Updated the tests to maintain 100% coverage
  • In @rjsf/core:
    • Updated Form to always pull the rootSchema from the schemaUtils and put it into the state.schema, making sure to use that in the render(), getStateFromProps() and getRegistry()
    • Updated the test_utils.js to pass the validator in the setProps() function
  • Updated CHANGELOG.md accordingly

Checklist

  • I'm updating documentation
  • I'm adding or updating code
    • I've added and/or updated tests. I've run npx nx run-many --target=build --exclude=@rjsf/docs && npm run test:update to update snapshots, if needed.
    • I've updated docs if needed
    • I've updated the changelog with a description of the PR
  • I'm adding a new feature
    • I've updated the playground with an example use of the feature

To assist potential future transformations of the `rootSchema` in the `schemaUtils` updated `Form` to always use that as the `state.schema`
- In `@rjsf/utils`:
  - Added `getRootSchema()` to the `SchemaUtilsType` and `createSchemaUtils()`
  - Updated the tests to maintain 100% coverage
- In `@rjsf/core`:
  - Updated `Form` to always pull the `rootSchema` from the `schemaUtils` and put it into the `state.schema`, making sure to use that in the `render()`, `getStateFromProps()` and `getRegistry()`
  - Updated the `test_utils.js` to pass the `validator` in the `setProps()` function
- Updated `CHANGELOG.md` accordingly
@heath-freenome heath-freenome merged commit 1f03322 into main Jul 16, 2025
4 checks passed
@heath-freenome heath-freenome deleted the alway-use-schemaUtils-rootSchema-in-Form branch July 16, 2025 16:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants