vazco / uniforms

A React library for building forms from any schema.
https://uniforms.tools
MIT License
1.94k stars 239 forks source link

Bad documentation #1224

Closed stuk88 closed 1 year ago

stuk88 commented 1 year ago

First of all, I'd like to say thank you for developing this great library! It works great and super easy to control once you understand the schema.

But. I want to add that the doc in the website and in here, are lacking.

In the schema-json - it should write in the website in the Bridges, that it does not support Date, List, or any other complex form fields.

In Simple Schema - it should write the schema that is displayed in the playground, and add a link to here:

https://codesandbox.io/s/priceless-bush-f6l5kt?file=/schema/all-fields-schema.tsx https://github.com/longshotlabs/simpl-schema#schema-rules

That way it's easier to understand the schema and its capabilities.

radekmie commented 1 year ago

Hi @stuk88. As you've pointed out a few things in one issue, let me reply to them one by one.

In the schema-json - it should write in the website in the Bridges, that it does not support Date, List, or any other complex form fields.

JSONSchemaBridge supports both dates and arrays, as well as nested objects (I hope that's what you meant by "other complex form fields"). Both arrays and objects work out of the box (playground link).

Dates require a little more work, as one, these have to be configured in Ajv (I recommend ajv-formats) and then transformed from Date objects, that uniforms operate on, into strings, that Ajv operates on. That can happen in the modelTransform function (only for the validation) or even in the validator itself. Here's a playground link that does exactly that.

In Simple Schema - it should write the schema that is displayed in the playground, and add a link to here: [...]

I don't understand this point, sorry. We have a strong assumption, that if one decides to use schema X, they know how to use it, or know where to find the documentation about it. However, I agree that we could link their docs to ease the usage.

radekmie commented 1 year ago

As there's no follow up, I'll close this one. Feel free to comment, though!