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

fix: Allow formData to be optional everywhere #3395

Merged
merged 1 commit into from
Jan 24, 2023

Conversation

heath-freenome
Copy link
Member

Reasons for making this change

Fixes #3305 by ensuring that formData can be optional everywhere

There were some types which were requiring formData to be required even though it really can be optional everywhere

  • In @rjsf/utils, updated the formData prop in all types where it was required to make it optional
    • Also updated all function arguments where it was required to make formData optional
  • In @rjsf/validator-ajv6 and @rjsf/validator-ajv8, updated places where formData was required as a function parameter to make it optional instead
  • In @rjsf/core, updated places where formData was required as a function parameter to make it optional instead
  • In utility-functions.md, updated the documentation of optional parameters without default values to ensure they included | undefined in the type of the parameter
  • In 5.x upgrade guide.md, updated the note about improved typescript typing in @rjsf/utils to indicate that it may require updating typing in the user's implementations
  • 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 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

Fixes rjsf-team#3305 by ensuring that `formData` can be optional everywhere

There were some types which were requiring `formData` to be required even though it really can be optional everywhere
- In `@rjsf/utils`, updated the `formData` prop in all types where it was required to make it optional
  - Also updated all function arguments where it was required to make `formData` optional
- In `@rjsf/validator-ajv6` and `@rjsf/validator-ajv8`, updated places where `formData` was required as a function parameter to make it optional instead
- In `@rjsf/core`, updated places where `formData` was required as a function parameter to make it optional instead
- In `utility-functions.md`, updated the documentation of optional parameters without default values to ensure they included `| undefined` in the type of the parameter
- In `5.x upgrade guide.md`, updated the note about improved typescript typing in `@rjsf/utils` to indicate that it may require updating typing in the user's implementations
- Updated the `CHANGELOG.md` accordingly
@heath-freenome heath-freenome merged commit 5555123 into rjsf-team:main Jan 24, 2023
@heath-freenome heath-freenome deleted the fix-3305 branch January 24, 2023 15:34
shijistar pushed a commit to shijistar/react-jsonschema-form that referenced this pull request Jun 8, 2023
Fixes rjsf-team#3305 by ensuring that `formData` can be optional everywhere

There were some types which were requiring `formData` to be required even though it really can be optional everywhere
- In `@rjsf/utils`, updated the `formData` prop in all types where it was required to make it optional
  - Also updated all function arguments where it was required to make `formData` optional
- In `@rjsf/validator-ajv6` and `@rjsf/validator-ajv8`, updated places where `formData` was required as a function parameter to make it optional instead
- In `@rjsf/core`, updated places where `formData` was required as a function parameter to make it optional instead
- In `utility-functions.md`, updated the documentation of optional parameters without default values to ensure they included `| undefined` in the type of the parameter
- In `5.x upgrade guide.md`, updated the note about improved typescript typing in `@rjsf/utils` to indicate that it may require updating typing in the user's implementations
- Updated the `CHANGELOG.md` accordingly
shijistar pushed a commit to shijistar/react-jsonschema-form that referenced this pull request Jun 8, 2023
Fixes rjsf-team#3305 by ensuring that `formData` can be optional everywhere

There were some types which were requiring `formData` to be required even though it really can be optional everywhere
- In `@rjsf/utils`, updated the `formData` prop in all types where it was required to make it optional
  - Also updated all function arguments where it was required to make `formData` optional
- In `@rjsf/validator-ajv6` and `@rjsf/validator-ajv8`, updated places where `formData` was required as a function parameter to make it optional instead
- In `@rjsf/core`, updated places where `formData` was required as a function parameter to make it optional instead
- In `utility-functions.md`, updated the documentation of optional parameters without default values to ensure they included `| undefined` in the type of the parameter
- In `5.x upgrade guide.md`, updated the note about improved typescript typing in `@rjsf/utils` to indicate that it may require updating typing in the user's implementations
- Updated the `CHANGELOG.md` accordingly
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.

formData definition in types should support undefined as a valid value
2 participants