I am having a URI value where it can accept null values and string URI values only, and the URI value cannot be empty.
I tried with several implementations and it did not work.
I am using AJV validation library version number 6.12.6.
These are my try outs:
agreementURL: {
"type": ["string", "null"],
"if": {
"type": "string"
},
"then": {
"format": "uri",
}
},
in ajv schema file we can define a function according to our requirements so inorder to solve this issue , i created a function where it allows a null and string uri format .