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 corner case of empty items array #871

Merged
merged 2 commits into from
Jan 18, 2019

Conversation

jbalboni
Copy link
Contributor

@jbalboni jbalboni commented Mar 23, 2018

Reasons for making this change

When upgrading from an old version I found that our code was creating array schemas in the shape shown in the test case, which was resulting in the getDefaultFormState function creating form data that had an array of undefineds, instead of using additionalItems as the item schema. This meant that required fields in the array item schema weren't triggering validation errors.

Checklist

  • I'm adding or updating code
    • I've added and/or updated tests
    • I've updated docs if needed
    • I've run npm run cs-format on my branch to conform my code to prettier coding style

@@ -241,6 +241,26 @@ describe("utils", () => {
foo: 42,
});
});

it("should fill array with additional items schema when items is empty", () => {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is not a great test description, but I'm not sure what a better one would be.

Copy link
Collaborator

Choose a reason for hiding this comment

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

I think it is quite ok, it describes what it is testing.

@edi9999
Copy link
Collaborator

edi9999 commented Apr 5, 2018

To me this looks good, I suggest to merge this soon.

@epicfaace
Copy link
Member

@glasserc Can you merge this?

@glasserc glasserc merged commit f72be02 into rjsf-team:master Jan 18, 2019
@glasserc
Copy link
Contributor

Sorry for the delay! Thanks!

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.

4 participants