ajv-validator / ajv-validator/ajv-keywords

deepProperties support for relative and absolute pointers

Offen
#29 3 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen
enhancement
Vorherrschende Sprache
TypeScript
Sterne
257
Forks
51
PR-Merge-Kennzahlen
Keine gemergten PRs in 30 T.

Beschreibung

Hello,

From the readme for deepProperties:
This keyword allows to validate deep properties (identified by JSON pointers).

I have a need to validate 'cousin' properties inside an array. I've tried this:

```
let schema = {
deepProperties : { "/parent/child1/grandchild1" : {
deepProperties : { "2/child2/grandchild2" : { const : true }}
}}
};

let data = {
parent : {
child1 : {
grandchild1: true
},
child2 : {
grandchild2: false
}
}
};
```

And got: keyword schema is invalid: data should match format "json-pointer", data property name '2/child2/grandchild2' is invalid.

Tracing a bit - it looks like the validation code from ajv/lib doesn't support relative pointers.
I can build another custom keyword to wrap deepProperties I think, but wanted to report this either for fixing or for clarifying.

Thanks!

Koby

Beitragsleitfaden

Für dieses Repository ist kein Beitragsleitfaden indexiert

Bewertung

Dieses Issue wurde noch nicht bewertet.

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.