-
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
Add support for type: with multiple options #282
Comments
I don't think this library supports |
I just think that this library should also conform JsonSchema v4 specification also :D . Since I will have to stuck using Json.NET Schema to generate Schema for creating forms. I can try modify the source code so "type" can be used as an array. |
TBH the hard part is not supporting the null schema type programmatically but rather exposing a decent UI/UX for dealing with it. That would mean adding a control for stating if a given field should be set to null or something else. |
@nmt1994 this isn't just a JsonSchema validator though, it's a UI generator too. Not every aspect of the JsonSchema spec translates nicely to a UI element. Like @n1k0 said, how would you design a UI to show that an input can either be an array or null? And why would that be useful? And what about the general case where |
@n1k0 : Thanks a lot for your reply . I just re-read through the JSON Schema validation and it seems that it doesn't provide much examples that would cover cases such as @mplis-jetsetter mentioned above. Regarding UI/UX related , I don't have any good idea for now . Maybe validating the type before generate any UI ( i.e : type cannot have string & array simultaneously ) |
Is this addressed now that we've merged #442? Now, "optional" strings are dropped from |
@glasserc : Hello :) I will take a look if this problem is fixed with your mentioned pull request :) |
FYI: A similar library to this one solves this problem by providing the user with a "type" select next to the field label (demo here). It also supports not defining "type" which then allows the user to enter arbitrary JSON using it's UI. Personally I would love to see a similar feature in react-jsonschema-form. |
This is not actually correct. A type array which has |
If there's any measure of conformance, I strongly recommend measuring against draft-06 or later, not draft-04. Draft-06 is the first modern draft (since the spec process re-started), and we are de-emphasizing tools that only support draft-04 on the json-schema.org implementation list. Many draft-04-only tools are moribund, and we are particularly de-emphasizing those (obviously this project is not moribund). Draft compliance is a little different for generators, since as noted not all keywords make sense anyway. But if the keywords you support work in the way that draft-06 or later require (e.g. |
This was partially (supporting a type + a "null" type) added by #1213 |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Please leave a comment if this is still an issue for you. Thank you. |
Would be interested in updated plans (if any) for this. |
Prerequisites
Description
I am using Json.NET Schema to return a Json Schema with this type of properties
According to Json Schema specification, type array which has null will also represent Optional input.
If change to
or
Everything would work fine
Expected behavior
Actual behavior
Version
I am running this on Playground Page directly
The text was updated successfully, but these errors were encountered: