jsonforms icon indicating copy to clipboard operation
jsonforms copied to clipboard

Support for propertyNames key/value-objects etc

Open runar-indico opened this issue 4 years ago • 1 comments

I am trying to set up a form from an object that is of type Record<string, string[]>. I'm not sure if this is already supported.

I've tried this schema (showing only the relevant part):

{
	"clients": {
		"additionalProperties": {
			"additionalItems": true,
			"description": "One or more valid password that can be used for client-authentication",
			"items": {
				"type": "string"
			},
			"minItems": 1,
			"title": "The clientId schema",
			"type": "array",
			"uniqueItems": true
		},
		"description": "The clients will authenticate via Basic Auth",
		"examples": [
			{
				"clientId": [
					"password1",
					"password2"
				]
			}
		],
		"propertyNames": {
			"maxLength": 100,
			"minLength": 3
		},
		"title": "As an alternative to other authentication, a simple map of client with clientSecrets can be supplied",
		"type": "object"
	}
}

Perhaps this only needs a custom renderer? I'm thinking it should act sort of like the Material-renderer does already with arrays, only that one has to provide the propertyName as well.

runar-indico avatar Jun 19 '21 12:06 runar-indico

Hi @runar-indico, we don't support "dynamic" schemas out of the box, however you can definitely write a custom renderer which can handle this use case.

sdirix avatar Jun 24 '21 07:06 sdirix