ajv-validator / ajv-validator/ajv-cli
Errors validating a document (which happens to be a schema) against the core meta schema
- Langage dominant
- TypeScript
- Étoiles
- 316
- Forks
- 77
- Métriques de merge des PR
- Aucune PR mergée en 30 j
Description
I'm struggling to validate a schema I'm developing against the core meta-schema using ajv-cli 5.0.0 (according to the package.json -- I guess there's no version identifier in the cli see #198 )
Imagine I've got a really basic schema named `foo-schema.json`:
```json
{
"$schema": "http://json-schema.org/draft-07/schema#",
"description": "a foo schema",
"type": "object",
"properties": {
"bar": {
"type": "string"
},
"additionalProperties": false
}
}
```
and I wish to ensure this is a valid schema according to the `$schema` reference (in this case, the core meta schema).
Initially I was hoping I could just issue an `ajv validate -d ...` and it'd figure out what schema I was trying to use (after all, I put a `$schema` reference in the doc):
```
> ajv validate -d foo-schema.json
error: parameter -s is required
```
Therefore, I issue the following command where `schema.json` is harvested from the url `http://json-schema.org/draft-07/schema`
```
> ajv validate -s schema.json -d foo-schema.json
schema schema.json is invalid
error: schema with key or id "http://json-schema.org/draft-07/schema" already exists
```
So to fix that, I'm removing the `$schema` and `$id` elements from the downloaded `schema.json`. Now I get:
```
> ajv validate -s schema.json -d foo-schema.json
strict mode: use allowUnionTypes to allow union type keyword at "#" (strictTypes)
schema schema.json is invalid
error: unknown format "uri-reference" ignored in schema at path "#/properties/%24id"
```
Well, I'm kinda stumped now. Is there a canonical way to validate that a schema is correct according to the meta-schema?
Guide de contribution
Aucun guide de contribution indexé pour ce dépôt
Évaluation
Cette issue n'a pas encore été évaluée.