Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

uri check fails #2505

Open
ruegenbfr opened this issue Nov 8, 2024 · 0 comments
Open

uri check fails #2505

ruegenbfr opened this issue Nov 8, 2024 · 0 comments

Comments

@ruegenbfr
Copy link

ruegenbfr commented Nov 8, 2024

Ajv reports a validation error for a valid uri string.

URI: https://hi.wikipedia.org/wiki/जर्मनी
Validation error text: data must match format "uri"

I know e.g. नी is not ASCII and RFC 3086 does not define the use of other characters. Nethertheless it is a valid url and
shouldn't the strings representing an URL be u subset of the strings representing an URI?

What version of Ajv are you using? Does the issue happen if you use the latest version?
ajv version: 8.17.1 (latest version)

Ajv options object

{
  allErrors: true, 
  strictSchema: true
}

JSON Schema

{
    "type": "string",
    "format": "uri"
}

Sample data

"https://hi.wikipedia.org/wiki/जर्मनी"

Your code

import Ajv from "ajv";
const addFormats = require("ajv-formats");
const ajv = new Ajv(options);
const validResult = ajv.validate(schema, data);
const errors = ajv.errors;
const message = ajv.errorsText(ajv.errors);

Validation result, data AFTER validation, error messages

validationResult: false

errors: [{
    "instancePath": "",
    "schemaPath": "#/format",
    "keyword": "format",
    "params": {
        "format":"uri"
    },
    "message": "must match format \"uri\""
}]

message: data must match format "uri"

What results did you expect?

validationResult: true

errors: null

message: No errors
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

1 participant