Format keyword validation for ipv4/ipv6
The json schema type string supports different format using the keyword format. https://json-schema.org/understanding-json-schema/reference/string.html#format
I see that the current code only defines few formats and may be related validators for those: https://github.com/networknt/json-schema-validator/blob/master/src/main/java/com/networknt/schema/FormatKeyword.java
I dont see ip address related formats supported here like ipv4 and ipv6.
I suppose if the schema uses these formats the validator will not validate those since its not defined format keyword? Is there any plan to support existing and new formats with 2019-09 draft) in near future or if i missed anyu existing support already present, can someone point me to those?
@stevehu
This is the class to do the IP address validation.
https://github.com/networknt/json-schema-validator/blob/master/src/main/java/com/networknt/schema/format/InetAddressValidator.java
Thanks @stevehu I tried some UTs with format "ip-address" ipv4/ipv6 and all of them work. I was checking the FormatKeyword class to see these formats defined but couldnt find it there like other formats.
I also have quick question on 2019-09 draft. I see that the "format" keyword has some proposed changes in this spec as below in terms of default validation off and to be turned on through implementations. https://json-schema.org/draft/2019-09/release-notes.html
Do we have any specific things to consider when we move from draft 7 to 2019-09 related to format in terms of schema validator implementations or it should work as is?
From the implementation point of view, there is no big difference between v7 and v2019-09 except some new keywords introduced and some change the definition a little bit. Although there are more formats available in 2019-09, we are not implementing them all as most people are not using them. When users start using them, we can add the implementation along the way.