Replace lib/refs/json-schema-draft-04.json with a copy of the official one
And revert the previous README changemaster
parent
3df9b7302f
commit
8f24e34158
15
README.md
15
README.md
|
@ -34,21 +34,6 @@ var ajv = new Ajv({schemaId: 'id'});
|
|||
ajv.addMetaSchema(require('ajv/lib/refs/json-schema-draft-04.json'));
|
||||
```
|
||||
|
||||
In case the above meta schema gives you validation error on `id` or `$schema` see [issue](https://github.com/epoberezkin/ajv/issues/904) you can load the official meta schema json instead. Example with `axios` (feel free to replace `axios` with the your preferred http request package):
|
||||
|
||||
```javascript
|
||||
// inside an async function.
|
||||
const axios = require('axios');
|
||||
const util = require('util');
|
||||
|
||||
const response = await axios.get('http://json-schema.org/draft-04/schema#');
|
||||
if (response.status != 200) {
|
||||
throw new Error(util.format('could not load draft-04 schema. status=%s', response.status));
|
||||
}
|
||||
|
||||
ajv.addMetaSchema(response.data);
|
||||
```
|
||||
|
||||
|
||||
## Contents
|
||||
|
||||
|
|
|
@ -28,12 +28,10 @@
|
|||
"type": "object",
|
||||
"properties": {
|
||||
"id": {
|
||||
"type": "string",
|
||||
"format": "uri"
|
||||
"type": "string"
|
||||
},
|
||||
"$schema": {
|
||||
"type": "string",
|
||||
"format": "uri"
|
||||
"type": "string"
|
||||
},
|
||||
"title": {
|
||||
"type": "string"
|
||||
|
@ -137,6 +135,7 @@
|
|||
}
|
||||
]
|
||||
},
|
||||
"format": { "type": "string" },
|
||||
"allOf": { "$ref": "#/definitions/schemaArray" },
|
||||
"anyOf": { "$ref": "#/definitions/schemaArray" },
|
||||
"oneOf": { "$ref": "#/definitions/schemaArray" },
|
||||
|
|
Loading…
Reference in New Issue