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

Enable Arrays to be marked as required, and fixes for strings marked as required #442

Merged
merged 15 commits into from
Jan 20, 2017
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -547,7 +547,7 @@ const uiSchema = {
};
```

Unlike other types, array's do not support the `required` property. You can however instead specify the minimum number of items the user must select with the `minItems` property.
Care should be taken when using the `required` property with arrays. An empty array is sufficient to pass that validation check. If you wish to ensure the user populates the array, you can specify the minimum number of items the user must select with the `minItems` property.
Copy link
Collaborator

Choose a reason for hiding this comment

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

This is perfect 👍

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Excellent :)
I'll have to get to the tests over the weekend. It's a part of the code base I haven't been into yet.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Unfortunately there wasn't a text area widget section that I could see so I created one .... but it isn't right. I will have to look at it over the weekend.

What's checked in is passing, but it's not using the widget.

I've tried the change:

const uiSchema = {"ui:widget": "textarea"};

it("should handle an empty string change event", () => {
  const {comp, node} = createFormComponent({schema: {
    type: "string",
  }, uiSchema});

... which seems to me like it should work but that fails for reasons that currently escape me. I'll need to look at it over the weekend. Got to head off now though!


Example:

Expand Down