-
Notifications
You must be signed in to change notification settings - Fork 20
Description
Problem
Reported at #73 by @juicycleff
Json Schema Form supports internal types and treats them quite differently eg. group-array. If a system requires multiple kind of components to be treated internally as group-array, this would be impossible.
Proposals
Proposal 1
Adds support for mapping external input types as group array eg.
const headlessFormOutput = createHeadlessForm(schema, {
...,
presentationMapping: {
groupArray: ["array", "conditions"],
}
})Proposal 2 (final solution)
To make sure I understood, you have a JSON Schema with a different presentation.inputType (let's say "conditions") and you want it to be treated as if it was "group-array", is that it?
Let me give another example to double-check, imagine a JSON Schema with a field of "inputType: "digits" that we want to treat as "number", like this:
Is that the type of customization you are trying to support? f so, we could reuse the existing config inputTypes and create a new attr "altName" (or any other name) to map the alternative names, like this:
const headlessFormOutput = createHeadlessForm(schema, {
inputTypes: {
"group-array": {
altName: ["array", "conditions"] // <!-- New!
},
"number": {
altName: ["digits"] // <!-- New!
},
}
})
{ "type": "object", "additionalProperties": false, "properties": { "age": { "title": "Your age", "x-jsf-presentation": { "inputType": "digits" // <-- note how it's "digits" instead of "number" } } } }