RicoSuter/VisualJsonEditor

additionalProperties do not work

Open

#28 opened on 2019年4月24日

GitHub で見る
 (3 comments) (0 reactions) (0 assignees)C# (92 forks)github user discovery
enhancementhelp wanted

Repository metrics

Stars
 (371 stars)
PR merge metrics
 (30d に merged PR はありません)

説明

The following example (taken from https://cswr.github.io/JsonSchema/spec/objects/) does not work:

{
	"type": "object",
	"properties": {
		"first_name": {"type": "string"},
		"last_name": {"type": "string"}
	},
	"additionalProperties": {
		"type": "integer"
	}
}
{
	"first_name": "Gary",
	"last_name": "Medel",
	"age": 25
}

The file is correctly validated, but the "age" property is not shown in the editor, and neither is it possible to add new properties (allowed by the schema). Also, if I change "age" to "25" (a string), the JSON is still validated, even if it is invalid. It even validates with additionalProperties: false... In other words, it looks like the additionalProperties keyword is ignored in the schema. I have also tested patternProperties and it does not work either,

I could understand if you did not want to have additional properties in the editor (since without additionalProperties: false, one can add anything anywhere), but it would be nice if the validating worked correctly and also if the already present (and valid) keys we shown in the editor...

コントリビューターガイド