The above is the JSON schema that can be used to validate a map of map of string to string
Example of such a payload
{
"key1":
{
"key11": "value11",
"key12": "value12"
}
}
Schema needs to validate that it is an object. To do that we specify
"type": "object"
Schema now needs to validate the key and value are strings. additionalProperties
can be used to specify that
"additionalProperties":
{
"type": "string"
}
So we create a definition called MapStringToString
{
"$defs":
{
"MapString":
{
"type": "object",
"additionalProperties":
{
"type": "string"
}
}
}
}
Using the same strategy above we define an object whose additional properties specify that values can only be MapStringToString
that was defined earlier