Skip to content

Conversation

heath-freenome
Copy link
Member

Reasons for making this change

In order to support an upcoming feature as well as eliminate a performance issue, IdSchema was replace with FieldPathId

  • In @rjsf/utils:
    • Added new FieldPathList and FieldPathId types and DEFAULT_ID_PREFIX and DEFAULT_ID_SEPARATOR to constants.ts
    • Added the new toFieldPathId() function to generate FieldPathIds, exporting it from the library
    • BREAKING CHANGES
      • Removed the IdSchema type, replacing idSchema: IdSchema<T> in all types with fieldPathId: FieldPathId
      • Updated the idGenerators to replace id: IdSchema<T> | string with id: FieldPathId | string removing the need for the <T = any> generic on the functions
      • Removed the toIdSchema() function in the schema directory
      • Updated the SchemaUtilsType and createSchemaUtils() to remove the toIdSchema() function
      • Deleted the ui:rootFieldId from the UiSchema since idPrefix does the same exact thing
    • Updated the tests accordingly
  • In @rjsf/antd, @rjsf/chakra-ui, @rjsf/fluent-ui, @rjsf/mantine, @rjsf/mui, @rjsf/primereact, @rjsf/react-bootstrap, @rjsf/semantic-ui and @rjsf/shadcn:
    • BREAKING CHANGES - Updated all of the templates and widgets to change idSchema to fieldPathId or to remove the <T> off of the idGenerator functions
  • In @rjsf/core:
    • BREAKING CHANGES
      • Updated all of the fields, templates and widgets to change idSchema to fieldPathId or to remove the <T> off of the idGenerator functions
      • ObjectField and ArrayField to use toFieldPathId instead of toIdSchema() to generate the fieldPathIds of all its children
      • Updated the onChange handling of fields to make path required and either pass it straight through, or use the fieldPathId.path instead of using an empty array or appending path information
      • Updated Form to use toFieldPathId() to generate fieldPathId instead of idSchema, always providing the idPrefix and idSeparator in the globalFormOptions and make the path: FieldPathList required
      • Updated LayoutGridField to remove the IdSchema related code in favor of FieldPathId code
    • Also exported the getTestRegistry() function from the main index.ts to assist developers in creating registry object for tests
    • Updated all of the test to deal with the idSchema -> fieldPathId changes
  • In @rjsf/daisyui:
    • BREAKING CHANGES - Updated all of the templates and widgets to change idSchema to fieldPathId or to remove the <T> off of the idGenerator functions
    • Also fixed the FieldTemplate to extract the description element so that it was not spread onto the div, fixing the snapshots
  • In @rjsf/validator-ajv8:
    • Updated the test to no longer try to test the delete toIdSchema function
  • In docs:
    • Updated custom-templates.md, custom-widgets-fields.md and layout-grid.md to change the idSchema documentation to fieldPathId
    • Updated uiSchema.md to remove the ui:rootFieldId documentation
    • Updated utility-functions.md delete toIdSchema(), add toFieldPathId() and to remove the <T> from the id generator functions
    • Updated v6.x upgrade guide.md to document all the breaking changes made in this release
  • Updated the 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

In order to support an upcoming feature as well as eliminate a performance issue, `IdSchema` was replace with `FieldPathId`
- In @rjsf/utils:
  - Added new `FieldPathList` and `FieldPathId` types and `DEFAULT_ID_PREFIX` and `DEFAULT_ID_SEPARATOR` to `constants.ts`
  - Added the new `toFieldPathId()` function to generate `FieldPathId`s, exporting it from the library
  - BREAKING CHANGES
    - Removed the `IdSchema` type, replacing `idSchema: IdSchema<T>` in all types with `fieldPathId: FieldPathId`
    - Updated the `idGenerators` to replace `id: IdSchema<T> | string` with `id: FieldPathId | string` removing the need for the `<T = any>` generic on the functions
    - Removed the `toIdSchema()` function in the `schema` directory
    - Updated the `SchemaUtilsType` and `createSchemaUtils()` to remove the `toIdSchema()` function
    - Deleted the `ui:rootFieldId` from the `UiSchema` since `idPrefix` does the same exact thing
  - Updated the tests accordingly
- In `@rjsf/antd`, `@rjsf/chakra-ui`, `@rjsf/fluent-ui`, `@rjsf/mantine`, `@rjsf/mui`, `@rjsf/primereact`, `@rjsf/react-bootstrap`, `@rjsf/semantic-ui` and `@rjsf/shadcn`:
  - BREAKING CHANGES - Updated all of the templates and widgets to change `idSchema` to `fieldPathId` or to remove the `<T>` off of the idGenerator functions
- In @rjsf/core:
  - BREAKING CHANGES
    - Updated all of the fields, templates and widgets to change `idSchema` to `fieldPathId` or to remove the `<T>` off of the idGenerator functions
    - `ObjectField` and `ArrayField` to use `toFieldPathId` instead of `toIdSchema()` to generate the `fieldPathId`s of all its children
    - Updated the `onChange` handling of fields to make `path` required and either pass it straight through, or use the `fieldPathId.path` instead of using an empty array or appending path information
    - Updated `Form` to use `toFieldPathId()` to generate `fieldPathId` instead of `idSchema`, always providing the `idPrefix` and `idSeparator` in the `globalFormOptions` and make the `path: FieldPathList` required
    - Updated `LayoutGridField` to remove the `IdSchema` related code in favor of `FieldPathId` code
  - Also exported the `getTestRegistry()` function from the main `index.ts` to assist developers in creating `registry` object for tests
  - Updated all of the test to deal with the `idSchema` -> `fieldPathId` changes
- In @rjsf/daisyui:
  - BREAKING CHANGES - Updated all of the templates and widgets to change `idSchema` to `fieldPathId` or to remove the `<T>` off of the idGenerator functions
  - Also fixed the `FieldTemplate` to extract the `description` element so that it was not spread onto the `div`, fixing the snapshots
- In @rjsf/validator-ajv8:
  - Updated the test to no longer try to test the delete `toIdSchema` function
- In docs:
  - Updated `custom-templates.md`, `custom-widgets-fields.md` and `layout-grid.md` to change the `idSchema` documentation to `fieldPathId`
  - Updated `uiSchema.md` to remove the `ui:rootFieldId` documentation
  - Updated `utility-functions.md` delete `toIdSchema()`, add `toFieldPathId()` and to remove the `<T>` from the id generator functions
  - Updated `v6.x upgrade guide.md` to document all the breaking changes made in this release
- Updated the `CHANGELOG.md` accordingly
displayLabel,
classNames,
// Destructure props we don't want to pass to div
description,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice subtle fix, the only snapshot changes are related to this (so the ID Schema replacement is clean! 🙌 )

uiSchema: { ...gridFormUISchema, [UI_GLOBAL_OPTIONS_KEY]: globalUiOptions },
formData: {},
errorSchema: { employment: {} },
// IdSchema is weirdly recursive and it's easier to just ignore the error
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not anymore!

Comment on lines 536 to 537
idPrefix: props.idPrefix || DEFAULT_ID_PREFIX,
idSeparator: props.idSeparator || DEFAULT_ID_SEPARATOR,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are we able to call this.getDefaultRegistry().globalFormOptions here to get the prefix/separator?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, it blew things up because this is called in the constructor, before the this.props has been setup properly.

unset(copiedFormData, key);
// drop property will pass the name in `path` array
onChange(copiedFormData, []);
onChange(copiedFormData, fieldPathId.path);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Need to ensure no regression in #4763 since we didn't add a test for that

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I manually tested additional properties and arrays in my local playground. All works

@heath-freenome heath-freenome merged commit 90446a3 into main Oct 1, 2025
4 checks passed
@heath-freenome heath-freenome deleted the idSchema-to-fieldPathId branch October 1, 2025 20:36
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