I use is-my-json-valid plugin for nodeJS and I wonder if there any pattern to validate if integer is same integer and string is the same string.
So far I found the way to do that as:
Input JSON:
const body = {
exactInteger: 20, exactString: "snaggs" };
{
"type" : "object",
"properties" : {
"exactInteger" : {"type" : "integer", "minimum" : 20, "maximum" : 20, "required": true},
"exactString" : {"type" : "string", "pattern": "^snaggs$", "required": true}
}
}
but it looks complicated, any other way?
via snaggs
No comments:
Post a Comment