RicoSuter/VisualJsonEditor

additionalProperties do not work

Open

#28 aberto em 24 de abr. de 2019

Ver no GitHub
 (3 comments) (0 reactions) (0 assignees)C# (92 forks)github user discovery
enhancementhelp wanted

Métricas do repositório

Stars
 (371 stars)
Métricas de merge de PR
 (Nenhuma PRs mesclada em 30d)

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

Guia do colaborador