RicoSuter/VisualJsonEditor

additionalProperties do not work

Open

#28 ouverte le 24 avr. 2019

Voir sur GitHub
 (3 commentaires) (0 réactions) (0 assignés)C# (92 forks)github user discovery
enhancementhelp wanted

Métriques du dépôt

Stars
 (371 stars)
Métriques de merge PR
 (Aucune PR mergée en 30 j)

Description

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...

Guide contributeur