json-schema-to-elm icon indicating copy to clipboard operation
json-schema-to-elm copied to clipboard

Support patternProperties

Open reitzig opened this issue 8 years ago • 0 comments

As far as I can tell, there is currently no support for patternProperties, arguably one of the more useful features of JSON schema.

Here is how I'd imagine to map things. Say we have two different patterns:

{
	"title": "main",

	"patternProperties": {
		"regexp1": {
			"title": "title1",
			...
		},
		"regexp2": {
			"title": "title2"
			...
		}
	}
}

This would translate to something like this:

type alias Main = 
	{ title1 : Dict String a
	, title2  : Dict String b
	}

Here, the string keys would be the JSON key (matching the respective regexp), and a resp. b would be the types defined by the resp. ....

reitzig avatar Sep 18 '17 07:09 reitzig