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

Validation of uri-reference format does not seem to work well #214

Open
wasphub opened this issue Nov 15, 2023 · 0 comments
Open

Validation of uri-reference format does not seem to work well #214

wasphub opened this issue Nov 15, 2023 · 0 comments

Comments

@wasphub
Copy link

wasphub commented Nov 15, 2023

We have a JSON schema that defines a string property with format uri-reference. This value for the string passes the validation:

\\this\\is\\a\\windows\\network\\path\\file.txt

According to RFC 3986 I believe it should not pass. Other validators do not allow this value under the same JSON schema we defined.

  • Your validation is based on this regex: /^(([^:/?#]+?):)?(\/\/([^/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?/
  • The ajv validator instead does it like this: /^(?:(?:[a-z][a-z0-9+\-.]*:)?\/?\/)?(?:[^\\\s#][^\s#]*)?(?:#[^\\\s]*)?$/i

The results are different, and it seems to me that in this case ajv does better.

Should this be considered a bug?

Thank you

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant