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

ajv throws error when using ipv4 #1382

Closed
juzhiyuan opened this issue Jan 6, 2021 · 1 comment
Closed

ajv throws error when using ipv4 #1382

juzhiyuan opened this issue Jan 6, 2021 · 1 comment
Labels

Comments

@juzhiyuan
Copy link

What version of Ajv are you using? Does the issue happen if you use the latest version?

7.0.3

JSON Schema

{"oneOf":[{"additionalProperties":false,"properties":{"whitelist":{"items":{"anyOf":[{"format":"ipv4","title":"IPv4","type":"string"},{"pattern":"^([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\\.([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\\.([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\\.([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])/([12]?[0-9]|3[0-2])$","title":"IPv4/CIDR","type":"string"},{"format":"ipv6","title":"IPv6","type":"string"},{"pattern":"^([a-fA-F0-9]{0,4}:){1,8}(:[a-fA-F0-9]{0,4}){0,8}([a-fA-F0-9]{0,4})?/[0-9]{1,3}$","title":"IPv6/CIDR","type":"string"}]},"minItems":1,"type":"array"}},"required":["whitelist"],"title":"whitelist"},{"additionalProperties":false,"properties":{"blacklist":{"items":{"anyOf":[{"format":"ipv4","title":"IPv4","type":"string"},{"pattern":"^([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\\.([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\\.([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\\.([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])/([12]?[0-9]|3[0-2])$","title":"IPv4/CIDR","type":"string"},{"format":"ipv6","title":"IPv6","type":"string"},{"pattern":"^([a-fA-F0-9]{0,4}:){1,8}(:[a-fA-F0-9]{0,4}){0,8}([a-fA-F0-9]{0,4})?/[0-9]{1,3}$","title":"IPv6/CIDR","type":"string"}]},"minItems":1,"type":"array"}},"required":["blacklist"],"title":"blacklist"}],"properties":{"disable":{"type":"boolean"}},"type":"object"}

Sample data

{"whitelist": ["10.255.254.0/24", "192.168.0.0/16"]}

Your code

Please see https://runkit.com/embed/xmhoyvdnlp2i
What results did you expect?

Are you going to resolve the issue?

@epoberezkin
Copy link
Member

All format definitions have been split to a separate package - ajv-formats - they have to be added to the instance if you use them. See release notes for v7 for other changes as well.

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

No branches or pull requests

2 participants