ajv-validator / ajv-validator/ajv-cli

how to compile/validate group of json-schema files that might reference each other in v4+

Offen
#172 15 Kommentare 10 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen
enhancement
Vorherrschende Sprache
TypeScript
Sterne
316
Forks
77
PR-Merge-Kennzahlen
Keine gemergten PRs in 30 T.

Beschreibung

Scenario: Directory with several JSON-schema files, some of which might `$ref`erence the others. Each schema file defines a unique `$id` property.
I want to compile/validate them all at once

This command worked in ajv-cli v3.x:
`ajv -s 'src/models/*.json' -r 'src/models/*.json'`

But with 4.x and 5.0, I get errors like this:
`error: schema with key or id "https://mycompany.com/this/schema/model.json" already exists`

But the only file that has that id is the file itself in that directory. It would seem that the -r flag is not excluding the file's self when checking for duplicate ids in that referenced list.

How can I accomplish validating a group of schemas like this with the newer version?

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.