Skip to content

Conversation

heath-freenome
Copy link
Member

@heath-freenome heath-freenome commented Sep 14, 2025

Reasons for making this change

Fixed #1581 by fixing getDefaultFormState() to support null defaults for object and array types

  • Updated getDefaultFormState() to add computeDefaultBasedOnSchemaTypeAndDefaults() to detect when ["null", "object"|"array"], default as null and the computed default was empty
    • Updated the tests for getDefaultFormState() to tests all of the computeDefaultBasedOnSchemaTypeAndDefaults()
  • 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

Fixed rjsf-team#1581 by fixing `getDefaultFormState()` to support `null` defaults for `object` and `array` types
- Updated `getDefaultFormState()` to add `computeDefaultBasedOnSchemaTypeAndDefaults()` to detect when `["null", "object"|"array"]`, default as `null` and the computed default was empty
  - Updated the tests for `getDefaultFormState()` to tests all of the `computeDefaultBasedOnSchemaTypeAndDefaults()`
- Updated `CHANGELOG.md` accordingly
@heath-freenome heath-freenome merged commit ca2ddc2 into rjsf-team:main Sep 16, 2025
4 checks passed
@heath-freenome heath-freenome deleted the fix-1581 branch September 16, 2025 16:33
x0k added a commit to x0k/svelte-jsonschema-form that referenced this pull request Sep 16, 2025
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.

Default 'null' value is not applied to a field with type ["null", "object"]

2 participants