Skip to content
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

Merge the long-lived RJSF v5 branch to master #3055

Merged
merged 82 commits into from
Aug 27, 2022

Conversation

heath-freenome
Copy link
Member

Reasons for making this change

Merge the rebased RJSF v5 branch onto master to prepare for the v5 beta

Checklist

  • I'm updating documentation
  • I'm adding or updating code
    • I've added and/or updated tests. I've run 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

* Implemented the utils package
- Refactored the `packages/core/src/utils.js` file into separate typescript files in the new `packages/utils/src`

* - More changes

* - Added all of the non-validation-based utilities and many of the tests

* - removed schema related files temporarily

* - Added missing tests to get test coverage up to 100% for all but `getWidget()`
- Also did some cleanup in the `src` files, moving types into `types.ts`, and exporting all the types

* - Fixed getWidget tests

* - Update README.md

* - update the target to  for typescript in

* - revert `package-lock.json` for antd, core and playground

* - fix build issues

* - Added the `rjsf-v5` branch to the `ci.yml`
- Added a new `RJSFSchema` as a redefine of `JSONSchema7` to make changing schemas everywhere else easier
- Updated all the utils and tests to change `JSONSchema7` to `RJSFSchema`
- Fixed test breaks by casting e to Error

* - changed tabs to spaces in package.json, fixed bug in deepEquals

* - Add `tsdx` to `package.json` to enable running `npm run test` inside of the `packages/utils` directory
  - Bumped `@types/jest` to match the version in use by `tsdx`
- Fixed the `utcToLocal()` test by mocking the `getDate()` and `getHours()` functions to be UTC + 2 hours to avoid server vs local timezone issues

* - Began adding documentation to the utility functions
- Reordered the logic in `asNumber` to avoid converting to number until we have to
- Updated `findSchemaDefinition()` to handle the case where a `$ref` in a schema also contains additional props
- Updated `getSubmitButtonOptions()` to export its `DEFAULT_OPTIONS` for testing purposes
- Updated `getUiOptions()` to no longer support `ui:widget` objects as it has been deprecated for years
- Made some other test fixes

* - Finished adding documentation to all of the remaining utils methods

* - Minor documentation changes, and allow `findSchemaDefinition()` to support undefined ref name

* - Responded to self-review comments
* Implemented the utils package
- Refactored the `packages/core/src/utils.js` file into separate typescript files in the new `packages/utils/src`

* - More changes

* - Added all of the non-validation-based utilities and many of the tests

* - removed schema related files temporarily

* - revert `package-lock.json` for antd, core and playground

* - The schema utilities that require validation

* - More changes

* - completed conversion to Typescript with some changes that were needed

* - Updated various files to make some parameters optional, to add generics typing where missed
- Created an `index.ts` in the `schema` subdirectory that exports all of the schema related functions
- Updated `types.ts` to add the new `SchemaUtilsType` interface
- Implemented a `createSchemaUtils()` function that returns a `SchemaUtilsType` interface given a `ValidatorType` and a `rootSchema`

* - Implemented createSchemaUtils
- Began testing the schema-based utils

* - More fixes and adding missing generics

* - Converted all the schema based tests over still missing 100% coverage

* - Completed 100% unit testing

* - Added documentation for most of the files and cleaned up some optionality on some arguments

* - Completed all of the documentation of the schema-based utils

* - Changed the `_NAME` constants to `_KEY`

* - Added missing generics on a few types

* - Added `ERRORS_KEY` constant for use in validation

* - Fixed types based on implementation of validator

* - Added missing generic to the `ValidationData` type for `ErrorSchema`

* - Fixed tests for the missing generic type

* - Incorporated rjsf-team#2876 by making props for UISchemaSubmitButtonOptions optional

* - Added generic `<T>` to the return value of `toIdSchema()` and `toPathSchema()`
…rjsf-team#2899)

* Refactored schema to support runnings from other packages
- Fixed the import of `types` in `mergeSchemas.ts`
- Renamed all of the `xxx.test.ts` to `xxxTest.ts` and wrapped them in an outer `xxxTest()` function that takes a `TestValidatorType`
- Added a `types.ts` file in the `schema` directory to provide the `TestValidatorType` and `TestValidatorParams` interfaces
- Added an `index.ts` file in the `schema` directory to export all of the `xxxTest` functions
- Updated `getTestValidator()` to import the types from the `schema/types`
- Added a `test/schema.test.ts` to create a `TestValidator` and run all of the `xxxTest()` functions from `schema`

* - Fixed the tests based on using the real validator

* - Removed the use of `xxx.hasOwnProperty('y')` in favor `'y' in xxx` to eliminate lint warnings
- Fixed bug in `stubExistingAdditionalProperties()` related to the `additionalProperties: true` case, adding new test to verify fix

* - Removed console.log statement

* - Moved `stubExistingAdditionalProperties()` into the `retrieveSchema.ts` file to eliminate a circular dependency
  - Did the same for the `stubExistingAdditionalPropertiesTest()` function
- Updated the `index.ts` files to remove the `stubExistingAdditionalProperties[Test]()` functions
- Updated `SchemaUtilsType` and `createSchemaUtils` to remove the `stubExistingAdditionalProperties()` function
* Added new package for validator-ajv6
- Refactored `packages/core/src/validate.js` into this new package

* - Switched to the new `@rjsf/utils` library and types

* - Finished types conversion to @rjsf/utils
- Began adding tests

* - Completed conversion for validator class-based tests. Just need to get to 100%
1

* - Finished 100% test coverage and documentation of the `AJV6Validator`

* - Completed the documentation of the remaining methods and types for the library

* - Responded to self-review feedback and also fixed tests to hopefully get it to pass

* - Fixed the build (this time hopefully)

* - Switched to just passing `stack` instead of the whole empty object

* - Added hacky run of tests from within the utils directory

* - Fixed a few little things

* - Fixed bug in custom validation, including adding a test to detect it

* - Removed schema utils test for `stubExistingAdditionalPropertiesTest()` as it no longer exists

* - Fixed self-review feedback and the import in the `test/createAjvInstance.test.ts`
- Also bumped all the packages that made sense
…am#2903)

* Update utils based on core refactor and update package.jsons
- Updated the main `package.json` to bump typescript
- Updated the utils `package.json` to bump everything but react
- Updated `SchemaUtilsType` to add the `getValidator()` and `doesSchemaUtilsDiffer()` functions
  - Updated `createSchemaUtils()` to implement the new functions and the tests to validate them
- Also updated other types to deal with issues found during core refactor
  - Changed `FormValidation` to `ErrorSchema` as needed
  - Updated the `Registry` type to remove `definitions` as it is never used and added the `xxxTemplate` props
  - Updated many interfaces to make previously required props to be optional
  - Switched to using the `React.ComponentType` which incorporates the `FunctionComponent` and `ClassComponent` both
- Fixed a bug in `getDefaultFormState()` by making the `array` defaults use effectively the same logic as it did in `core` but refactored to a function for type safety
  - Updated the tests to add one that verifies the bug is fixed

* - rollback typescript to previous version due to `fluent-ui` issue

* - Fixed bug in `getSchemaType()` related to incorrectly defaulting to `string` when no type exists

* - Made `uiSchema` optional in `canExpand()`, `getSubmitButtonOptions()` and `getUiOptions()`
- Updated the required-ness of a smattering of props in interfaces

* - Made all callbacks be required again

* - Made label required again

* - More updates to make `uiSchema` optional

* - Added new `processSelectValue()` utility, refactored from core's `SelectWidget`, with full tests
- Also updated the `UIOptionsType` to add optional `title` and `description` props, typed to `string` to eliminate the need to type cast them

* - Added documentation for the `[key: string]` prop

* - Responded to reviewer feedback
…jsf-team#2920)

* Updated @rjsf/core to use the new `utils` and `validator-ajv6` libraries
- Removed the `index.d.ts` file since all the types are now exported in `@rjsf/utils`
- Updated `package*.json` to make changes consistent with pulling utils and validator-ajv6 libraries
  - Removed `core-js-pure`, `json-schema-merge-allof`, `jsonpointer` and `react-is` from `dependencies` in favor of `@rjsf/utils`
  - Moved `ajv` and `@types/json-schema` into the `devDependencies`
  - Added `@rjsf/validator-ajv6`, `@types/lodash` and `tsdx`
  - Also, removed all mentions of `index.d.ts`
- Converted `ErrorList` to typescript, pulling types from `@rjsf/utils`
- Converted `Form` to typescript
  - Built `FormProps` and `FormState` props which are exported
  - Pulled in all the types from `@rjsf/utils` functions
  - Removed the `additionalMetaSchemas` and `customFormats` props in favor of the new, required `validator: ValidatorType` prop
  - Updated `getStateFromProps()` to create a `SchemaUtilsType` object and put it into both the state and the registry as `schemaUtils`
  - Switched to using the `schemaUtils.getValidator()` to access the `validateFormData()` and `toErrorList()` calls
  - Switched to using `schemaUtils` to access `getDefaultFormState()`, `toIdSchema()`, `toPathSchema()` and `retrieveSchema()`
- Updated `ArrayField` to use the `@rjsf/utils` functions
  - Also, switched to the `includes` function from `lodash`
  - Pull the `schemaUtils` from the `registry` and used it for `getDefaultFormState()`, `isMultiSelect()`, `isFilesArray()`, `retrieveSchema()` and `toIdSchema()`
  - Switched from `xxx.hadOwnProperty('y')` to `'y' in xxx` to remove an eslint warning
- Updated `BooleanField`, `NumberField`, `CheckboxWidget`, `DateTimeWidget`, `FileWidget`, `RangeWidget`, `SelectWidget` and `UpDownWidget` to pull utility functions from `@rjsf/utils`
- Updated `MultiSchemaField` to use the `@rjsf/utils` functions
  - Pulled the `schemaUtils` from the `registry` and used it for `getDefaultFormState()` and `getMatchingOption()`
  - Switched from `xxx.hadOwnProperty('y')` to `'y' in xxx` to remove an eslint warning
- Updated `ObjectField` to use the `@rjsf/utils` functions
  - Pulled the `schemaUtils` from the `registry` and used it for `retrieveSchema()`
  - Switched from `xxx.hadOwnProperty('y')` to `'y' in xxx` to remove an eslint warning
- Updated `SchemaField` to use the `@rjsf/utils` functions
  - Pulled the `schemaUtils` from the `registry` and used it for `getDisplayLabel()`, `isSelect()`, `retrieveSchema()` and `toIdSchema()`
  - Switched from `xxx.hadOwnProperty('y')` to `'y' in xxx` to remove an eslint warning
- Updated `StringField` to use the `@rjsf/utils` functions
  - Pulled the `schemaUtils` from the `registry` and used it for `isSelect()`
- Updated `AltDateWidget` to use the `@rjsf/utils` functions
  - Removed `prevState` from `componentDidUpdate()` because it is not used, removing lint error
- Updated `TextWidget` to add `bool` as a type for the value to avoid a React error that failed tests
- Converted `SubmitButton` to typescript, pulling types from `@rjsf/utils` and exporting it's props type
- Converted `getDefaultRegistry()` to typescript, pulling types from `@rjsf/utils`
  - Changed the export to be `default`
  - Temporarily needing to cast `fields` and `widgets` to the proper type until they are converted
- Converted `withTheme()` to typescript, pulling types from `@rjsf/utils` and the typescript `Form`
- Converted the `src/index.js` file to Typescript, exporting both the `Form` and its types along with `withTheme()`, `getDefaultRegistry()`
- Updated the `types.js` file to remove `definitions` and add in `schemaUtils` ffor the `registry` type.
- Deleted the `src/utils.js`, `src/validate.js` files since they have been replaced with `@rjsf/utils/` and `@rjsf/validator-ajv6`
  - Removed the `utils_test.js` file entirely and only kept the `Form` integration part of the `validate_test.js`
- Updated the tests as follows to make things work with `@rjsf/utils` and `@rjsf/validator-ajv6`
  - Updated `test_utils.js` to import the default `validator` from `@rjsf/validator-ajv6` and add it to the props for `createFormComponent()`
  - Updated the `Form_test.js` to import the default `validator` and the `customizeValidator()` function and passed `validator` into props for `<Form>...</Form>`
    - Updated the checking of `onChangeProp` to add `schemaValidationErrors`, `schemaValidationErrorSchema` and `schemaUtils` to the `calledWith()` check
    - Updated the checking of `onError` to add `schemaValidationErrors`, `schemaValidationErrorSchema` to the match
    - Deleted any tests that dealt with the now removed deprecated features
    - Replaced tests the used the `customFormats` or `additionalMetaSchemas` props with a customized validator with those values set on it
      - In one place, removed a piece of a test that was reverting the old props since they don't exist anymore
  - Updated the `SchemaField_test.js` file to check the `registry` in the received props to have `schemaUtils` instead of `definitions`
    - Fixed the import of `getDefaultRegistry()`
    - Also removed the test related to `empty definitions` since that isn't in the registry anymore
  - Updated the `StringField_test.js` to import the utility functions from `@rjsf/utils`
  - Updated the `uiSchema_test.js` file to deal with the removal of deprecated `ui:widget: {component, options}` feature in `@rjsf/utils`
    - Switched from `warn` to `error` for spying
    - Removed the deprecated `ui:widget` configurations in the tests, moving the options into the `ui:options` block instead`
    - Verified the proper error (instead of warning) is returned

* - Temporarily restore `index.d.ts` until next PR when it gets removed

* - Export `WithThemeProps` from core

* - Converted `AddButton` to Typescript
- Switched `SubmitButton` to use `WidgetProps`
- Removed `schemaUtils` as a param for `getDefaultRegistry()`
- Set generic defaults on `WithThemeProps`
- Fixed cast of `SubmitButton` in `Form`

* - Updated the type for `withTheme()`

* - Refactored `processValue` out of `SelectWidget` and used the new `processSelectValue()` method in utils

* - Fixed a few more things found while finishing up the themes conversion

* Updated antd theme to use new @rjsf/utils and @rjsf/validator
- Updated `package*.json` to add `@rjsf/utils` and `@rjsf/validator` to dev and peer dependencies
  - Also, Removed a bunch of packages that were never used since the conversion to `tsdx`
  - Finally, bumped most of the dev dependencies that made sense to the latest version, except for those that cause breaking tests
- Removed the `webpack.config.*.js` files since they are no longer needed since the conversion to `tsdx`
- Updated all uses of non-schema utilities methods to `@rjsf/utils` and switched to using `registry.schemaUtils.XXX()` for those schema-based utilities
- Updated the import of `getDefaultRegistry()` to be directly from `@rjsf/core`
- Modified `SelectWidget` to use the new `processSelectValue()` function from `@rjsf/utils`
- Updated the tests to import the `validator` from `@rjsf/validator` to pass to the `Form`
  - Also updated the snapshots via the `test:update` script to deal with the little differences from the conversion

* Updated bootstrap-4 theme to use new @rjsf/utils and @rjsf/validator
- Updated `package*.json` to add `@rjsf/utils` to dev and peer dependencies and `@rjsf/validator-ajv6` to dev dependencies
  - Also, Removed a bunch of packages that were never used since the conversion to `tsdx`
  - Finally, bumped most of the dev dependencies that made sense to the latest version, except for those that cause breaking tests
- Updated all uses of non-schema utilities methods to `@rjsf/utils` and switched to using `registry.schemaUtils.XXX()` for those schema-based utilities
- Updated the import of `getDefaultRegistry()` to be directly from `@rjsf/core`
- Updated components that used the `uiSchema['ui:xxx']` notation to get the `uiOptions` using `getUiOptions(uiSchema)` then doing `uiOptions.xxx` instead
- Updated the use of `React.FC` with `React.ComponentType` in `AddButton` and `SubmitButton`
- Updated `ArrayFieldTitleProps` and `ArrayFieldDescriptionProps` to make `title`, `required` and `description` optional in the `ArrayFieldTemplate.tsx` file
  - Also fixed the indentation of components
- Updated `WrapIfAdditionalProps` to pick props from `FieldTemplateProps` joining it with `children` to fix type issues
- Updated `Form` to use `React.ComponentType`
- Modified `SelectWidget` to use the new `processSelectValue()` function from `@rjsf/utils`
- Updated the tests to change to using `RJSFSchema` rather than `JSON7Schema` and import the `validator` from `@rjsf/validator` to pass to the `Form`
  - Also updated the snapshots via the `test:update` script to deal with the little differences from the conversion

* Updated chakra-ui theme to use new @rjsf/utils and @rjsf/validator
- Updated `package*.json` to add `@rjsf/utils` to dev and peer dependencies and `@rjsf/validator-ajv6` to dev dependencies
  - Also, Removed a bunch of packages that were never used since the conversion to `tsdx`
  - Finally, bumped most of the dev dependencies that made sense to the latest version, except for those that cause breaking tests
- Updated all uses of non-schema utilities methods to `@rjsf/utils` and switched to using `registry.schemaUtils.XXX()` for those schema-based utilities
- Updated the import of `getDefaultRegistry()` to be directly from `@rjsf/core`
- Updated components that used the `uiSchema['ui:xxx']` notation to get the `uiOptions` using `getUiOptions(uiSchema)` then doing `uiOptions.xxx` instead
- Updated the use of `React.FC` with `React.ComponentType` in `AddButton` and `SubmitButton`
- Updated `AltDateWidget` to extend the `AltDateStateType` object from the `DateObject`
- Updated `ArrayFieldTitleProps` and `ArrayFieldDescriptionProps` to make `title`, `required` and `description` optional in the `ArrayFieldTemplate.tsx` file
  - Also fixed the indentation of components
- Updated `WrapIfAdditionalProps` to pick props from `FieldTemplateProps` joining it with `children` to fix type issues
- Updated `Form` to use `React.ComponentType`
- Modified `SelectWidget` to use the new `processSelectValue()` function from `@rjsf/utils`
- Updated `utils.js` to remove the custom `ThemeProps` in favor of the new `WithThemeProps` from `@rjsf/core`
- Updated the tests to change to using `RJSFSchema` rather than `JSON7Schema` and import the `validator` from `@rjsf/validator` to pass to the `Form`
  - Also updated the snapshots via the `test:update` script to deal with the little differences from the conversion

* Updated fluent-ui theme to use new @rjsf/utils and @rjsf/validator
- Updated `package*.json` to add `@rjsf/utils` to dev and peer dependencies and `@rjsf/validator-ajv6` to dev dependencies
  - Also, Removed a bunch of packages that were never used since the conversion to `tsdx`
  - Finally, bumped most of the dev dependencies that made sense to the latest version, except for those that cause breaking tests
- Updated all uses of non-schema utilities methods to `@rjsf/utils` and switched to using `registry.schemaUtils.XXX()` for those schema-based utilities
- Updated the import of `getDefaultRegistry()` to be directly from `@rjsf/core`
- Updated `ArrayFieldTitleProps` and `ArrayFieldDescriptionProps` to make `title`, `required` and `description` optional in the `ArrayFieldTemplate.tsx` file
  - Also fixed the indentation of components
- Updated `WrapIfAdditionalProps` to pick props from `FieldTemplateProps` joining it with `children` to fix type issues
- Updated `FuiForm` to use `React.ComponentType`
- Modified `SelectWidget` to use the new `processSelectValue()` function from `@rjsf/utils`
- Updated the tests to change to using `RJSFSchema` rather than `JSON7Schema` and import the `validator` from `@rjsf/validator` to pass to the `Form`
  - Also updated the snapshots via the `test:update` script to deal with the little differences from the conversion

* Updated material-ui theme to use new @rjsf/utils and @rjsf/validator
- Updated `package*.json` to add `@rjsf/utils` to dev and peer dependencies and `@rjsf/validator-ajv6` to dev dependencies
  - Also, Removed a bunch of packages that were never used since the conversion to `tsdx`
  - Finally, bumped most of the dev dependencies that made sense to the latest version, except for those that cause breaking tests
- Updated all uses of non-schema utilities methods to `@rjsf/utils` and switched to using `registry.schemaUtils.XXX()` for those schema-based utilities
- Updated the import of `getDefaultRegistry()` to be directly from `@rjsf/core`
- Updated components that used the `uiSchema['ui:xxx']` notation to get the `uiOptions` using `getUiOptions(uiSchema)` then doing `uiOptions.xxx` instead
- Updated the use of `React.FC` with `React.ComponentType` in `AddButton` and `SubmitButton`
- Updated `ArrayFieldTitleProps` and `ArrayFieldDescriptionProps` to make `title`, `required` and `description` optional in the `ArrayFieldTemplate.tsx` file
  - Also fixed the indentation of components
- Updated `WrapIfAdditionalProps` to pick props from `FieldTemplateProps` joining it with `children` to fix type issues
- Updated `MuiForm` and `MuiForm5` to use `React.ComponentType`
- Modified `SelectWidget` to use the new `processSelectValue()` function from `@rjsf/utils`
- Updated the tests to change to using `RJSFSchema` rather than `JSON7Schema` and import the `validator` from `@rjsf/validator` to pass to the `Form`
  - Also updated the snapshots via the `test:update` script to deal with the little differences from the conversion

* Updated semantic-ui theme to use new @rjsf/utils and @rjsf/validator
- Bumped the main `package.json` to use the latest version of `Typescript`
- Updated `.eslintrc` with what was needed to support the latest eslint version
- Updated `package*.json` to add `@rjsf/utils` to dev and peer dependencies and `@rjsf/validator-ajv6` to dev dependencies
  - Also, Removed a bunch of packages that were never used since the conversion to `tsdx`
  - Finally, bumped most of the dev dependencies that made sense to the latest version, except for those that cause breaking tests
- Updated all uses of non-schema utilities methods to `@rjsf/utils` and switched to using `registry.schemaUtils.XXX()` for those schema-based utilities
- Updated the import of `getDefaultRegistry()` to be directly from `@rjsf/core`
- Modified `SelectWidget` to use the new `processSelectValue()` function from `@rjsf/utils`
- Updated the tests to import the `validator` from `@rjsf/validator` to pass to the `Form`
  - Also updated the snapshots via the `test:update` script to deal with the little differences from the conversion

* - Fixed material-ui build to no longer generate the v4 and v5 versions since the theme will soon be separated into two packages

* - Update material-ui package-lock.json to match package.json
…ding (rjsf-team#2929)

- Updated `CustomValidatorOptionsType` to add `ajvOptionsOverrides`
- Updated the `createAjvInstance()` function to spread any `ajvOptionsOverrides` on top of the `AJV_CONFIG`
- Updated `AJV6Validator` constructor to pass `ajvOptionsOverrides` to `createAjvInstance()`
- Updated tests to add test-case for the `$data` flag mentioned in rjsf-team#1668
* Optimized and updated imports in core package.json
- Updated `tsdx` build to also run umd, eliminating the need for the one-off webpack version build
- Deleted the `test-old` and `build-umd` scripts
- Added `@rjsf/utils` to `peerDependencies`
- Removed all of the webpack and cross-env related packages no longer needed for the one-off build
- Also removed `express`, `gh-pages`, `estraverse*` and `husky`
- Updated a bunch of the `peerDependencies` package versions to the latest
- Deleted the now unnecessary `webpack.config.dist.js`

* - Removed `prettier` from `package.json` as it differs from the version used in the main `package.json`
- Ran `cs-format` to fix all of the prettier errors reported by `cs-check`

* - Bumped `prettier` to pickup latest typescript support
  - Switched from `jsxBracketSameLine: true` to `bracketSameLine: false`
- Ran `cs-format` over `playground` as well
…jsf-team#2932)

* Added support for node 16 and linting
- Regenerated the `package-lock.json` file with node-16
- Added the `cs-check`, `cs-format` and `lint` scripts along with `lint-staged` to the `package.json` file

* - Ran `cs-format` on the `validator-ajv6` source to fix build

* - Switched the `no-unused-vars` rule to `@typescript-eslint/no-unused-vars` in `.eslintrc`
…2933)

* Added support for node 16, formatting and linting
- Regenerated the `package-lock.json` file with node-16
- Added the `cs-check`, `cs-format` and `lint` scripts along with `lint-staged` to the `package.json` file
- Ran `cs-format` over the `src` and `test` directories to fix the build

* - Switched the `no-unused-vars` rule to `@typescript-eslint/no-unused-vars` in `.eslintrc`
…-team#2936)

* Added support for node 16, formatting and linting
- Regenerated the `package-lock.json` file with node-16
  - Also added packages to support linting
- Added the `cs-check`, `cs-format` and `lint` scripts along with `lint-staged` to the `package.json` file
- Ran `eslint --fix` and `cs-format` over the `src` and `test` directories to fix the build
- Added a slight adaptation of the `.eslintrc` file from `core` to this package

* - Fixed build
…eam#2938)

* Added support for node 16, formatting and linting
- Regenerated the `package-lock.json` file with node-16
  - Also added packages to support linting
- Added the `cs-check`, `cs-format` and `lint` scripts along with `lint-staged` to the `package.json` file
- Ran `eslint --fix` and `cs-format` over the `src` and `test` directories to fix the build
- Added a slight adaptation of the `.eslintrc` file from `core` to this package

* - Fix build, hopefully
…-team#2939)

- Regenerated the `package-lock.json` file with node-16
- Added the `cs-check`, `cs-format` and `lint` scripts along with `lint-staged` to the `package.json` file
- Ran `cs-format` over the `src` and `test` directories to fix the build
- Regenerated the `package-lock.json` file with node-16
  - Also added packages to support linting
  - Explicity added the latest `prettier` because it in implicitly picking up the wrong one
- Added the `cs-check`, `cs-format` and `lint` scripts along with `lint-staged` to the `package.json` file
- Ran `eslint --fix` and `cs-format` over the `src` and `test` directories to fix the build
- Added a slight adaptation of the `.eslintrc` file from `core` to this package
- Added `.npmrc` to enable `legacy-peer-deps` to allow things to work with node 16
- Deleted `.prettierrc` since the override is no longer needed
)

* Added support for node 16, formatting and linting
- Regenerated the `package-lock.json` file with node-16
- Added the `cs-check`, `cs-format` and `lint` scripts along with `lint-staged` to the `package.json` file
  - Added `@babel/eslint-parser` and removed `babel-parser`
- Ran `cs-format` over the `src` and `test` directories to fix the build
- Updated `.eslintrc` to switch to using the `@babel/eslint-parser` with the necessary `parserOptions`

* - Fix `package.json` formatting
* Updated the playground to allow a validator selection
- Defaults to the `ajv6` validator
- Updated `package*.json` to add `@rjsf/utils` and `@rjsf/validator-ajv6`
  - Also removed a bunch of unnecessary packages
  - Bumped a bunch of other packages to the latest minor and patch version
  - Bumped a few select packages to the latest major version
- Updated `.eslintrc` to switch from `babel-eslint` to `@babel/eslint-parser`
- Updated the `index.js` file to add a `validators` object containing the `AJV6` validator choice, passing it into `Playground`
- Updated the `app.js` file to get `shouldRender()` from `@rjsf/utils` instead of copying it from core
  - Also extracted `validators` from the props for `Playground`, storing `validator` in the state, initially set to `AJV6`
  - Added a `ValidatorSelector` component that is used to update the selected `validator` in state
  - Rendered a `ValidagtorSelector` just before the `CopyLink` component
  - Passed `validators[validator]` as the `validator` prop on `FormComponent`

* - Ran `cs-format` to fix formatting issues and fix the build
* Split out material-ui v5 theme as @rjsf/mui
- Copied the `material-ui` directory and removed the `@material-ui` dependencies
- Deleted the `MuiComponentContext`, `MuiForm5`, `Theme5` and `ThemeCommon` directories (moving the contents of `ThemeCommon/index.js` directly into `Theme`)
- Deleted the `MaterialUIContext` and `MaterialUIContextProps` files and everything in `Theme.tsx` that related to them
- Replaced all fetching of the Material UI components from the `useMuiComponent()` hook with actual imports from `@mui/material` and `@mui/icons-material`
- Regenerated the `package-lock.json` file with node-16
- Added the `cs-check`, `cs-format` and `lint` scripts along with `lint-staged` to the `package.json` file
- Copied the `.eslintrc` file from `core`
  - This involved adding `@typescript-eslint`, `eslint` and `eslint-plugin-*`
- Ran `eslint --fix` and `cs-format` over the `src` and `test` directories to fix the build

* - Fix build by fixing a few little things

* - Fixed playground imports to read from new repo
- Deleted the `MuiComponentContext`, `MuiForm5`, `Theme5` and `ThemeCommon` directories (moving the contents of `ThemeCommon/index.js` directly into `Theme`)
- Deleted the `MaterialUIContext` and `MaterialUIContextProps` files and everything in `Theme.tsx` that related to them
- Replaced all fetching of the Material UI components from the `useMuiComponent()` hook with actual imports from `@material-ui/core` and `@material-ui/icons`
- Deleted the `tests/mui-5` directory and fixed up the tests to work with the simple `Form`
- Regenerated the `package-lock.json` file with node-16
- Added the `cs-check`, `cs-format` and `lint` scripts along with `lint-staged` to the `package.json` file
- Copied the `.eslintrc` file from `core`
  - This involved adding `@typescript-eslint`, `eslint` and `eslint-plugin-*`
- Ran `eslint --fix` and `cs-format` over the `src` and `test` directories to fix the build
…cli (rjsf-team#2951)

* Get node 16 build working and centralize lint configs
- Added `.eslintrc-javascript` for the common configs needed for `antd`, `playground` and `semantic-ui`
- Added `.eslintrc-typescript` for the common configs needed for the rest of the packages
- Updated `.github/workflows/ci.yml` to add node 16 and to build the playground using it instead of 14
- Updated `.gitignore` to add the few items from the `.gitignore` files in sub-packages
  - Removed the `.gitignore` in the sub-packages, along with the two `.editorconfig` files
- Updated all of the `.eslintrc` files in the packages to extend the appropriate `.eslintrc-*script` file
  - Left the `plugins` array definitions in each `.eslintrc` file
    - Avoids an issue where eslint found the base and sub-package implementation of the plugins and complained when they were in the base
- Updated the main `package*.json` to add the packages needed for linting so that they can be removed in the sub-packages
- Updated each sub-package `package*.json` files to remove all but the `eslint` package (leaving it locally so that it can be run in the subdirectory)
  - Also bumped any out-of-date packages related to `babel` or `eslint`

* - Replaced `tsdx` with its most current forked cousin `dts-cli`
  - This removed the need for the `.npmrc` file in `chakra-ui`

* - Re-ran `npm run cs-format` due to prettier upgrades provided by `dts-cli`
- Also fixed some typescript issues in `fluent-ui` related to object spreading by casting `options.props as object`

* - Fixed tests due to change to `dts-cli`
  - Added `jest-environment-jsdom` and `ts-jest` that matches the jest version `dts-cli` uses in the main `package.json`
  - Updated `package.json`s to remove incompatible jest related packages
  - Updated and/or moved `jest.config.js` files to add `testEnvironment` and `testEnvironmentOptions` for `jsdom`
  - Updated `chakra-ui` and `mui` to add missing libraries for emotion and jest
  - Redid the `mui` snapshots after changes

* - Rollback `semantic-ui` so that it still uses `tsdx` due to test failures using `dts-cli`

* - Bumped `eslint` to 8.20
- Fixed react 16.14 adding >=17 in peer dependencies
  - Didn't bump to react 17 officially to avoid peer dependencies issues with `semantic-ui` which is stuck on 16
- Bumped nanoid to the latest minor version
- In `material-ui`, fixed react 16.14 in peer dependencies
- In `mui`, bumped `@mui/material` to the latest
- Removed `react-dom` and `@types/react` from the peer dependencies
- Bumped eslint to latest release
- Removed the types for jest as it was unnecessary
- Bumped to latest minor version for `fluent-ui`
- Bumped react to 17, fixing react 16.14 in peer dependencies
- Removed unnecessary types for jest
- Updated `SelectWidget` to properly use the right `defaultSelectedKey[s]` prop based on multiple flag
- Updated test snapshots due to dependency bumps
- Bumped react to 17, fixing react 16.14 in peer dependencies
- Removed `react-dom` because it wasn't needed
- Bumped nanoid to latest
- Bumped react to 17, fixing react 16.14 in peer dependencies
- Can't bump to bootstrap-2, so bumped to latest 1.x version
- Bumped react to 17, fixing react 16.14 in peer dependencies
- Bumped `react-icons` to latest
- Updated test snapshots due to changes from bumps
- Can't upgrade to chakra-ui 2.0 because it requires react 18
- Locked peerDependencies for react to ^16.14.0 or >=17
- Bumped minor versions of `react-select`, `chakra-react-select` and `framer-motion`
- Updated test snapshot as a result
* Upgraded to latest antd code
- Added an additional test for the custom `DatePicker`
- Fixed the `tests` for checkboxes in array that broke with upgrade by implementing a required ref
- Updated all the test snapshots due to upgrade changes

* - Fix build by running `cs-format`

* - Bumped react to 17, fixing react 16.14 in peer dependencies
* Switched playground to webpack 5 and other small fixes
- Updated `.github/workflows/release.yml` to use node 16
- Updated the main `package.json` to remove `webpack` and `webpack-cli` as they are only needed by `playground`
- Updated all of the `package.json` files for the themes to fix the `build` script to change `--format cjs,es,umd` to `--format cjs,esm,umd`
  - This is because `dts-cli` changed `es` to `esm`
  - Also updated `material-ui` to add that missing flag to `build`
- Updated `.babelrc` to get it working with webpack 5
- Updated `package.json` for playground to update (or remove) `webpack` and all of its plugins and utilities
  - Explicitly added `ajv8` since `webpack-dev-server` uses it and the `validator-ajv6` has an earlier version
- Updated the `webpack.config.*.js` files to support webpack 5
- Updated the `index.js` for playground to organize the themes in alphabetical order (after default)

* - Bumped `antd` libraries to latest

* - Updated theme libraries to match the ones in the updated theme `package.json` files
- After merging all the package.json cleanups, some of the package-lock.json files were a bit out of date, updating them
* Updated documentation for the v5 release
- Updated `/latest/` with `/stable` for all `.md` files, mirroring changes made on master
- Changed all uses of `<Form schema={schema} />` in existing documentation to add the required `validator` from `@rjsf/validator-ajv6`
- Updated the `validation.md` docs to cover v5 changes and additions
- Added a new `utility-function.md` to document the `@rjsf/utils` function, constants and types
- Deleted the `customizing-material-ui.md` file since we split apart the two theme versions
- Added the version 5 migration document
- Updated `@rjsf/utils` to add or improve documentation
  - Also refactored out the `TemplateTypes` interfaces to help support future work related to expanding templates
  - Added a utility type, `MakeUIType` and refactored out `UIOptionsBaseType` in order to dry out the `UiOptionsType` and `UiSchema` types
- Updated `Form` in `@rjsf/core` to move the `IChangeEvent` type from `utils` extending it from `FormState`
  - The props `validate` was renamed to `customValidate`
  - Also, updated `FormProps` to extend the new `TemplatesType` interface
- Updated `withTheme` to add the missing generics onto `Form`

* - Added placeholders for `core`'s missing documentation on the Typescript files

* - Completed the documentation of all the Typescript based files in `core`
- Responded to reviewer feedback
- Added a few more constants in `@rjsf/utils`, using them as appropriate in utils and core
jimmycallin and others added 16 commits August 26, 2022 18:52
* Set up linting for react hooks

* revert formatting

* fix linting issues in themes

* more linting issues
)

- Updated the `WrapIfAdditional` component to add `classNames` to the outer wrapper in a manner consistent with the `core` theme, for the following themes:
  - bootstrap-4, chakra-ui, material-ui, mui and semantic-ui
- Updated the snapshots to add the missing `classNames` classes
- Replicated the fix made in rjsf-team#2199 since it is a breaking change and we are doing a bunch of them
- Also updated the `CHANGELOG.md`
…3044)

- Updated `package*.json` to add `@rollup/plugin-replace`
- Added a `dts.config.js` file that caused `antd/lib` and `rc-picker/lib` to be replaced with `antd/es` and `rc-picker/es`
- Updated the `CHANGELOG.md` file for the fix
…jsf-team#3036)

* Fix hidden widget in several themes and SelectWidget in bootstrap-4
- Updated the `FieldTemplate` in `chakra-ui`, `material-ui`, `mui` and `semantic-ui` to properly implement the hidden field
- Updated `SelectWidget` in `bootstrap-4` to fix missing `htmlFor` and the `disabled` state when `readonly`
- Updated snapshots to verify fixes
- Also removed the `test:update` script from `core`, `utils` and `validator-ajv6` because they are useless

* - Responded to reviewer feedback
* Properly pass formContext to SchemaField
- Updated `ArrayField`, `MultiSchemaField`, `ObjectField` and `SchemaField` to pass `formContext` down the hierarchy properly
- Updated tests to validate `formContext` is properly passed to `SchemaField`
- Updated the `CHANGELOG.md` file with the fix mentioned

* Update packages/core/test/allOf_test.js
…f v5 (rjsf-team#3047)

* Fixed rjsf-team#1596 by adapting the fix from rjsf-team#2002 into rjsf v5
- Added a new `mergeValidationData()` method in `@rjsf/utils` to handle the appending of errors onto the end of the validationData from an additional error schema
  - Added this to the `schema` directory `index.ts` along with exposing it on the `SchemaUtils` type and implementation
  - Also fixed the type of `toErrorList()` in `ValidatorType` to change from `fieldName: string` to `fieldPath: string[]`
  - Added reusable `mergeValidationDataTest.ts`, calling it in the utils
- Update the `@rjsf/validator-ajv6` to pick up the breaking change from rjsf-team#2002 around `AJV6Validator.toErrorList()`
  - Also modified the `validateFormData()` function to return the result of `mergeValidationData()` when the user has a custom validator
  - Updated tests for the new structure of the `toErrorList()` data
  - Also updated the `schema.tests` to add the new `mergeValidationDataTest()`
- Updated `Form` to use the `mergeValidationData()` function in the few places where `extraErrors` was being merged into the schema validation
  - Updated tests for the new structor of the `toErrorList()` data
- Updated the `CHANGELOG.md` to describe this fix
- Updated the `5.x upgrade guide.md` to describe all the new utility functions added and describe util.js and validator.js breaking changes
- Updated the `validation.md` documentation for the `ErrorListTemplate` change along with making the `RJSFValidationError` interface describe the optional properties

* - Responded to reviewer feedback... also, removed the `:` after the property in the `stack` to match AJV stack, adding `message` to also match AJV
- Added migration guide changes
* Restored uiSchema.classNames with deprecation warning
- Updated `SchemaField` to restore support for `uiSchema.classNames` with big fat deprecation warning
- Updated the existing `classNames` test to verify restored code and deprecation warning
- NOTE: Will fix up the documentation in the other PR

* - Responded to reviewer feedback

* - Adjusted warning message

* - Responded to reviewer feedback and updated migration guide
…sf-team#3052)

- Reimplement two fixes related to `onChange` in the new `Form.tsx`
  - rjsf-team#1755 fixes the calling of the proper `onChange` during props update
  - rjsf-team#2460 fixes race condition on calling `onChange` after setState.
* Update documentation for template consolidation work
- Updated the 5.x upgrade guide for the work done around template consolidation
- Updated the advanced customization guides for the work done around template consolidation (slightly incomplete)
- Updated the Form properties for the work done around template consolidation
- Updated the UiSchema docs for the work done around template consolidation
- Updated the Utililty function documentation for the work done around template consolidation
- Updated the array documentation for work done around template consolidation

* - Additional documentation

* - More changes for CHANGELOG.md as I review issues

* - Made the `classNames` change a deprecation instead of a break
- Restored description of `RJSFSchema`

* - Additional cleanup of documentation after closer self-review
- Changed the color for the add button from `secondary` (i.e. red) to `primary` (i.e. dark gray) in both themes
- Changed the `RemoveButton` to have color `secondary` and to use the `medium` font size to avoid two errors
- Updated the snapshots accordingly
…team#3053)

* Updated dependencies to latest in preparation for beta release
- Also removed an extraneous console.log() from test

* - Added cast to fix new Typescript error caused by the Typescript update
…e the `type` of the HTML button is submit, consistently

- Updated the snapshots accordingly
@heath-freenome
Copy link
Member Author

@nickgros @jacqueswho @jimmycallin @epicfaace I could use an approval on this so that I can merge

@heath-freenome heath-freenome merged commit 899710d into rjsf-team:master Aug 27, 2022
@heath-freenome heath-freenome deleted the rjsf-v5 branch August 27, 2022 21:36
@heath-freenome heath-freenome restored the rjsf-v5 branch January 25, 2023 01:45
@heath-freenome heath-freenome deleted the rjsf-v5 branch January 25, 2023 01:46
@heath-freenome heath-freenome restored the rjsf-v5 branch January 25, 2023 01:47
@heath-freenome heath-freenome deleted the rjsf-v5 branch January 25, 2023 01:51
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.

9 participants