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

Can't validate ip address with JSON Schema format keyword. #100

Closed
PMExtra opened this issue May 10, 2021 · 3 comments · Fixed by #118
Closed

Can't validate ip address with JSON Schema format keyword. #100

PMExtra opened this issue May 10, 2021 · 3 comments · Fixed by #118
Assignees
Labels
feature-request Request for new features or functionality help wanted Issues identified as good community contribution opportunities
Milestone

Comments

@PMExtra
Copy link

PMExtra commented May 10, 2021

  • VS Code Version: 1.56.0
  • OS Version: Windows_NT x64 10.0.19041

Steps to Reproduce:

  1. Create a schema file:
{
  "properties": {
    "address": {
      "type": "string",
      "format": "ipv4"
    }
  }
}
  1. Create a json file:
{
  "$schema": "path/to/the/above/schema",
  "address": "anything except a valid ipv4 address"
}

Expected result:

The address property should make a String is not a valid ipv4 address warning. Just like { "format": "email" } do.

Reference:
https://json-schema.org/understanding-json-schema/reference/string.html#ip-addresses

Does this issue occur when all extensions are disabled?: Yes

@PMExtra
Copy link
Author

PMExtra commented May 10, 2021

ipv6 does not work too.

@aeschli aeschli transferred this issue from microsoft/vscode May 11, 2021
@KapitanOczywisty
Copy link
Contributor

We could probably use formats from ajv. FWIW, there is quite a few missing formats in vscode, which are present in JSON specification.

@aeschli
Copy link
Contributor

aeschli commented May 11, 2021

Sounds good, PR is welcome that adds the missing regexes (please avoid new module dependencies)

@aeschli aeschli added feature-request Request for new features or functionality help wanted Issues identified as good community contribution opportunities labels Oct 25, 2021
@aeschli aeschli added this to the Backlog milestone Oct 25, 2021
gjsjohnmurray added a commit to gjsjohnmurray/vscode-json-languageservice that referenced this issue Nov 25, 2021
aeschli added a commit that referenced this issue Nov 29, 2021
validate hostname, ipv4 and ipv6 formats (#100)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature-request Request for new features or functionality help wanted Issues identified as good community contribution opportunities
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants