ajv-validator / ajv-validator/ajv-formats
format: uri failing validation with draft-04 schemas
- Linguagem predominante
- TypeScript
- Estrelas
- 228
- Forks
- 42
- Métricas de merge de PRs
- Nenhum PR com merge em 30d
Descrição
Hello
I'm trying to validate a draft-04 schema with `format: uri` but my example data is failing for `format should match uri`
```json
"dependencies": {
"ajv": "^8.11.0",
"ajv-draft-04": "^1.0.0",
"ajv-formats":"^2.1.1",
```
```js
const Ajv = require("ajv-draft-04");
const addFormats = require('ajv-formats')
let _ajvOptions = {
strict: false,
verbose: true,
allErrors: true
};
let results;
let data = {...}
let schema = {...}
try {
let ajv = new Ajv(_ajvOptions);
addFormats(ajv)
let _draft4Validator = ajv.compile(schema);
}
let valid = _draft4Validator(data);
console.log(
(results = {
valid: valid,
error: _draft4Validator.errors,
})
);
} catch (err) {
console.error(
(results = {
valid: false,
error: err,
})
);
}
```
It was brought to my attention the ajv-formats package doesn't have a way to interpret which draft should be followed and thus the behavior changes of `uri` between draft-04 and draft-06+ are not accounted for.
Is there a good work around to this issue?
Guia de contribuição
Nenhum guia de contribuição indexado para este repositório
Avaliação
Esta issue ainda não foi avaliada.