ajv-validator / ajv-validator/ajv-keywords
regexp error doesn't give as much detail as pattern failure
- Vorherrschende Sprache
- TypeScript
- Sterne
- 257
- Forks
- 51
- PR-Merge-Kennzahlen
- Keine gemergten PRs in 30 T.
Beschreibung
When I use "pattern" as one of my schema verification properties and AJV finds an error based on the pattern, it'll return an error like:
```
{ keyword: 'pattern',
dataPath: '.title',
schemaPath: '#/properties/title/allOf/0/pattern',
params: { pattern: '^((?!abc).)*$' },
message: 'should match pattern "^((?!abc).)*$"' }
```
Knowing the information about the pattern that is failing is extremely useful to me, yet when i switch from "pattern" to "regexp" via AJV-Keywords, the error returned isn't quite as useful:
```
{ keyword: 'regexp',
dataPath: '.tracks[0].label_copy',
schemaPath: '#/properties/label_copy/allOf/0/regexp',
params: { keyword: 'regexp' },
message: 'should pass "regexp" keyword validation' }
```
not telling me which regexp has failed (e.g. `^((?!abc).)*$/i`), I know that I can derive this from `schemaPath`, but having it in the message and/or the params would be incredibly useful.
Beitragsleitfaden
Für dieses Repository ist kein Beitragsleitfaden indexiert
Bewertung
Dieses Issue wurde noch nicht bewertet.