-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
Prototype component demonstrating support for OneOf #302
Conversation
Sorry to be so late to give a proper look at this. I've just checked the branch out, it's awesome 👍 I'm not so sure about the UX to select one of the possible schemas, but couldn't find anything better than the dropdown you came with. Maybe we should rework the wording? Add widget doesn't sound explicit enough, especially for non-technical people. Any input welcome here. Also, do you think you could work on moving the custom widget logic to core, and add tests and docs? That would be just great :) |
Any progress on this? |
Hello, it's a bit difficult for me as I am starting in this technology... |
@johanjvrens Do you want to give it a try? |
We're also doing some work on supporting oneOf, as we have a back-end which is auto generating JSON schema which we have to render in a form. The BE (Java) JSON Schema library creates oneOf elements without a type, which is perfectly valid according to http://jsonschemalint.com/#/version/draft-04/markup/json, but blows up in RJSF. Or it also might generate a oneOf as type 'object', but with no properties, and that also blows up in RJSF, but is also valid according to the linter site. |
Good to hear people are looking at this! Not that it's necessarily the right way of doing things, or particularly great code, but if you guys need some ideas, you can have a look at #417, my pull request which adds support for anyOf. It makes use of the So I have also looked at oneOf a bit, and one of the challenges faced was where to put the logic. I was thinking it needs to go either in |
@jManji We're using OneOf as a way to express conditional forms, i.e. depending on a radio button value, show a different set of form elements below. I was trying to do this with customised components to render the OneOf, but felt that I was painting myself into a corner, and was still facing some big problems to which I could only see hacky solutions, so I threw it all away and am using a schema transforming approach instead, which feels cleaner, if still not exactly beautiful, and doesn't require any changes to RJSF. I believe there's an example of schema transformation for conditional forms in here somewhere. |
@spacebaboon If I understand this right, you are changing the schema input "on-the-fly", depending on the value of the drop-down. That's probably the quickest and less intrusive (as you said) way of doing this. I might be interested in using this, if you can share the code in any way. |
Is anyone working on it currently? @mplis-jetsetter @n1k0 |
I don't. I also agree that the schema-transformation approach addresses the need quite nicely, so I'm not even sure we'll ever want to add support for this jsonschema rule in this lib. |
@spacebaboon would you be so kind to share your approach (schema transforming approach)? Do you use |
@n1k0 According to your last comment you said that you are not sure if you want to support that Now my question is if you would accept a PR which implements that. I am working on a project, where it looks to me like this is the last missing part, and I think we would be able to contribute it (would have to clarify that first, but I want to make sure you would accept a PR in the first place). |
@n1k0 @danrot Has anyone worked on getting the |
Hi, at the present time RJSF doesn't support |
@sidthekid134 No, I haven't got any response, and since this apart other minor problems was critical for us, we decided to implement somehing on our own instead of using this library. |
Closing this PR as oneOf support was added in #1133. |
No description provided.