Comments (9)
I'll let @n1k0 ponder, he's our local json-schema expert (if you ask him, he'll say he's not, but that's lies)
from react-jsonschema-form.
@almet Haha, hmpf, thanks I guess.
Yes, we need to deal with a specific kind of array widget when the schema is constrained with an enum of strings (possibly numbers, integers, datetimes too) so we can render a select field (or a list of checkbox btw) instead of the regular ArrayField
.
The only thing is that with such a schema, one might want to allow multiple occurrences of an allowed enum
value in the resulting array, eg. ["foo", "bar", "foo"]
. Reading this thread from 2009 about just this is slightly worrying though, as I couldn't find any followup to this specific problem. Hope it's just me who can't search for things.
Also, re enumNames
support, there's #25 issue filed already.
from react-jsonschema-form.
Actually while googling for solutions I've just stumbled upon the Choices v5 proposal, which is probably something we'll want to support if it makes it to the spec eventually.
from react-jsonschema-form.
And so for ensuring a multiple choices field can't be mistaken for a multiple occurrences of choices field, there's is that UniqueItems proposal.
Edit: uniqueItems
seems already used in http://json-schema.org/example1.html. We can probably safely bet on it being widely supported, though we should definitely check with the validation lib we use.
from react-jsonschema-form.
Okay, so to sum up I can start working on supporting schemas like this :
myField: { type: 'array', title: 'My field', items: { enum: [ 'foo', 'bar', ], type: 'string' }, uniqueItems: true, }
resulting on a multiple select (and maybe alternatively a list of checkboxes). Is that it ?
from react-jsonschema-form.
Is that it ?
That's a good summary of it, yes. Thanks you so much on planning to help and contribute!
from react-jsonschema-form.
I just finished the work on this issue. However, I can not push my branch upstream to make my pull request. Could you give me the rigths on the repo or do you prefer that I make my pull request from a fork ?
from react-jsonschema-form.
Yes please do it from a fork, you could also give us some contributors roles on your fork if you want us to collaborate on your branch.
from react-jsonschema-form.
Fixed by #42.
from react-jsonschema-form.
Related Issues (20)
- Usage Example is missing Form import
- Widgets unusable under Antd v5 using a dark theme (wrong ConfigProvider context passed down) HOT 3
- How to figure out the changed `formData` object property from inside `onChange` callback? HOT 4
- Warning: React does not recognize the `errorSchema` and Invalid DOM property `autocomplete`. HOT 1
- DOCUMENTATION Issue: Wrong method signature? HOT 1
- Schema defines standalone checkbox as mandatory, but asterisk is not rendered. HOT 2
- I would like to make a default change to the look of all input fields HOT 5
- Adding required field in nested if/then/else not working correctly HOT 2
- FormData is not received based on schema properties HOT 1
- Select bug when multiple oneOf are nested HOT 2
- How can I cite this? HOT 6
- RJSF anyOf customization HOT 3
- Validation error when multiple $ref references point to a single definition HOT 3
- not working about validation HOT 3
- Passing ui options down to array items HOT 3
- MUI number input label UI issue with non-numeric input HOT 1
- Publish v6 release candidate with support for Bootstrap 5 HOT 1
- Can not replace "integer" widget HOT 4
- Omit Extra Data not behaving as expected on submit for allOf (if then) schemas along with additionalProperties set to false blocking form submission HOT 1
- `anyOf` form validation error messages confusing when `anyOf` items contain properties found in other items HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from react-jsonschema-form.