Form vocabulary special interest group #70
Replies: 15 comments 18 replies
-
Excellent! I'm really glad to see that this effort is getting underway. For me the most important principle to remember is simplicity and incrementality of use. It is super important that more complex scenarios are not implemented at the expense of the simplicity of expression of common scenarios. In particular, I'm thinking of the common trap of clever generalizations that reduce the complexity of the vocabulary at the expense of simplicity of semantic expression. |
Beta Was this translation helpful? Give feedback.
-
https://rjsf-team.github.io/react-jsonschema-form/ might contain some good ideas |
Beta Was this translation helpful? Give feedback.
-
I'm not sure if this is in the spirit of the type of feedback you're looking for, but it does deal with form validation (and validation in general). The fact that the various implementations have different levels of support for regex as noted here...
...can make certain fiddly validation difficult to do. I realize the spec already says ECMA 262, but if anything could be done in this effort to improve regular ol' regex support I think it'd be a really nice improvement in day-to-day usability! |
Beta Was this translation helpful? Give feedback.
-
I'd love a keyword that's like "default", but references an instance value. Basically, "If this instance location has a value, use that as the default." That's the main thing I've needed in my work that JSON Schema doesn't support. I implemented it by borrowing ideas from JSON Hyper-Schema, but there's nothing that works "out of the box" for it. Happy to discuss my experience/observations if people are interested in exploring that functionality. |
Beta Was this translation helpful? Give feedback.
-
Maintainer of @koumoul/vjsf here. This is very interesting ! I didn't take the time to look into json-schema custom vocabularies before that, but I think I get the point, and I am willing to participate in the effort. Vjsf relies heavily on annotations directly on the schema itself (x-* custom keywords), my understanding is that these annotations could be more formally described using one or more json-schema vocabularies. I imagine 2 vocabularies at least, one specific to vjsf for quick work and one shared where the most matured and generic stuff would go. A few things that come to my mind that need to be expressed when rendering a schema as a form:
I will follow the discussion here, and I will try to formalize some of vjsf existing semantics into a vocabulary as a starting point. |
Beta Was this translation helpful? Give feedback.
-
Please consider copying the concepts from HAL Forms (https://github.com/mamund/hal-forms) as that project has spent considerable effort figuring out many of the same problems this project might. In fact, you might be able to create a vocabulary that HAL forms adopts, similar to how OpenAPI now defers to JSON Schema instead of forking it for their own spec. |
Beta Was this translation helpful? Give feedback.
-
Thanks for all the feedback so far, it's great to hear such a wide range of views already, I really appreciate it. I've had some direct messages with suggestions which I wanted to include here for completeness: "I've always felt that essentially rather than a "form" framework, what is needed is a template framework with form descriptive capabilities. I found a lot of the issues my team had were in getting random bits of content required within the form into any framework specifically designed for forms alone. Like you often see in commercial forms things like banners, info sections and texts. react-jsonschema-form for example doesn't make that really possible without making your schema specific to your output instead of the data." "My main issues were how to handle the generation of validation rules, I concluded that there could be a need to have an intermediate representation (IR) and that it may be worth standardising what that format would take and how it should handle jsonschema rules which don't often match up. "I was working to generate complex forms in a corporate and I realised the way they did validations was having a completely separate rule set that defined which fields to watch and then ran validations off that, I felt the IR could do something similar." |
Beta Was this translation helpful? Give feedback.
-
And also to note, there is now a #vocab-forms channel over on the JSON Schema Slack for more direct discussion, please do go ahead and use that if you prefer. (Thanks @Relequestual !) |
Beta Was this translation helpful? Give feedback.
-
Also, the folks at @department-of-veterans-affairs (such as @jbalboni) might be interested in this discussion. @dmethvin-gov had a good thread a while back (usds/us-forms-system#141) about the problems with uiSchema. |
Beta Was this translation helpful? Give feedback.
-
There's some good prior art at https://github.com/formio/formio.js, which is at the heart of the commercial form.io product. You can see that whole thing working here, it's pretty impressive: https://formio.github.io/formio.js/app/sandbox |
Beta Was this translation helpful? Give feedback.
-
Hi! I'm the project lead of JSON Forms. I would be interested in the scope and goal of this initiative. Especially whether the eventual vocabulary will describe forms in great detail or restrict itself to solve the common problems of form generators / renderers. I'll just bring up some topics which might be interesting. LayoutOne question is if and how the general layout of the form can be specified or whether it has to follow the structure of the data. In JSON Forms we use a UI Schema concept to fully decouple the UI from the data schema. The UI Schema describes the layout and points to the JSON Schema for more information where necessary, e.g. Example: {
"type": "VerticalLayout",
"elements": [
{
"type": "Control",
"scope": "#/properties/name",
}
]
} Textual descriptions and InternationalizationJSON Schema offers
For internationalization purposes often the respective JSON Schema is exchanged with a localized one. This is rather inefficient and requires some special preprocessing. Another approach is to store localization keys directly in the JSON Schema
Dependent valuesOften there are special requirements which can't be properly expressed via JSON Schema. For example when a JSON Schema contains an array of persons and there is also an "enum" which shall exactly represent one of the person instances. Or when it shall be validated that a certain number is larger than another number. Some values might also be derived from one or more other values. Visibility and RulesJSON Schema already supports Often parts of the form only shall become visible or enabled (i.e. not ValidationJSON Schema validation can be pretty complex. As a consequence often the whole data object needs to be validated on every change although many schemas only have some "required" and "pattern" validations. Would be interesting to allow for some restricted mode with local-only validation. This would then allow validation libraries like AJV to offer much more efficient validation modes. Combinators and conditional schemasWhile For example Default values,
|
Beta Was this translation helpful? Give feedback.
-
Hi Folks, 👀 watching this with keen interest! |
Beta Was this translation helpful? Give feedback.
-
It's great to get a wide range of examples from a multitude of libraries so early on - thanks everyone for your input so far. In terms of the scope of this initiative, that is a very good question, and exactly what this information-gathering phase is about. I can see that there might be a number of somewhat competing sets of requirements, and as they become clearer, it will be easier to see what possible scopes there are and how they could be implemented. I feel it would be useful to also clarify how I see my role in all this - I have come to this initiative and JSON Schema in general having done quite a lot of research on JSON Schema form libraries while creating a new UI project - and it became clear in that process that there are areas which are unclear, or create work which has to be duplicated, when using a JSON Schema to create and validate a form. My intention is to facilitate discussion of the issues and potential solutions, and do the 'admin' of shepherding this process onwards. And as I become more familiar with the problem domain, get more involved in the actual iteration on possible solutions. But a lot of the actual detail of the problems are new to me - I only had an idea that they existed, which is why this clarity of feedback is very useful. What I would suggest now is a final call for further input - anything that has been really holding you up or is always a pain to implement - then please put it down here! Then I propose to create a collaborative document, ex: a Google Doc, where I'll collate all the suggestions so far. Then those suggestions can be commented on and refined in-place, and we can move to a situation where we have a clearer set of (possibly competing) requirements. Thereafter, it will be hopefully more possible to identify a course, or set of courses, we can follow to refine those suggestions into some draft spec(s). If anyone knows of any formalised process we can follow that would help here (I'm thinking RFC style, but don't want to introduce more bureaucratic overhead than is necessary at this stage) I'd be very interested to hear about it. Thanks again for all the input, really appreciated! |
Beta Was this translation helpful? Give feedback.
-
It's been a while, but I've collated all the responses here into a document. I've paraphrased and condensed where possibly, appologies if I've mangled your meaning - please submit any corrections in the comments. The document is open to suggestions so please do add or alter anything you think needs improvement. |
Beta Was this translation helpful? Give feedback.
-
Hi All, "Support for JSONSchema '"type" as "array", when we have a custom format added to it through code, and the field values are recieved through an async service." Right now, if I have a schema like this: JSONSchema: { The format is getting added through a separate patch file like this: import { JSONSchema7 } from 'json-schema'; import { JsonSchemaPatches } from '@evutils/formly-utils'; export const updateSchemaFields: JsonSchemaPatches = { function updateChannelFieldConfig(json: JSONSchema7): JSONSchema7 { **The values for this channel-field is coming from the service, which is later added, when available (async). It doesn't work and throws random error. How are we supposed to work with a schema field having 'format',whose type is "array", but values are not instantly available??** |
Beta Was this translation helpful? Give feedback.
-
Hi!
Do you use JSON Schema to make forms?
Do you run into issues where the schema is cumbersome or not quite suited to your use case?
Do you find yourself working round the schema (perhaps with a side schema of your own) and wish there was more flexibilty and customisation in the core?
We are creating a Special Interest Group around the creation of a custom vocabulary - supported and guided by JSON Schema org - specifically for the generation and validation of forms.
I am hoping to gather here, via comment responses, a laundry-list of all the common (and not so common) limitations and difficulties that people run into when using JSON Schema to generate and validate forms, how you're working round it, and how you'd like it to be better - if you could extend the schema to suit your use cases.
Please do comment below, +1 things you've also experienced, and we can start gathering the raw materials that will go into building a custom JSON Schema form vocabulary.
I'm very happy to take calls or chat direct about it on slack or over email - you can find me on the JSON Schema slack community, or as @yaffol on twitter.
Thank you for your input!
Beta Was this translation helpful? Give feedback.
All reactions