vscode-yaml
vscode-yaml copied to clipboard
Incorrect type. Expected "ipv4"
Describe the bug
Hello,
I have an issue with VSC not recognizing the IPv4 addresses in my YAML file when using a custom schema.
The custom schema is the following:
{
"type": "object",
"properties": {
"net": {
"type": "ipv4"
},
"mask": {
"type": "ipv4"
}
},
"required": [
"net",
"mask"
],
"additionalProperties": false
}
When I apply this schema to the following YAML:
net: 192.168.1.0
mask: 255.255.255.0
It does not validate the IPv4 addresses and gives out the following error:
Incorrect type. Expected "ipv4".
Environment
- [X] Windows (with project running in WSL)
- [ ] Mac
- [ ] Linux
- [ ] other (please specify)
Ok, I found my mistake.
If someone is facing the same issue someday, the correct usage of IPv4 in the schema is:
{
"type": "object",
"properties": {
"net": {
"type": "string",
"format": "ipv4"
},
"mask": {
"type": "string",
"format": "ipv4"
}
},
"required": [
"net",
"mask"
],
"additionalProperties": false
}
Sorry for the noise.