json-schema-spec
json-schema-spec copied to clipboard
The value of the examples annotation should be an object or an array
Json schema has examples annotation, which comes handy, when I would like to run a mock server for my api.
Unfortunately the spec states, that the value of examples keyword MUST be an array:
{
"title" : "Match anything",
"description" : "This is a schema that matches anything.",
"default" : "Default value",
"examples" : [
"Anything",
4035
]
}
I suggest to enable objects as well, so each example could be referenced by name:
{
"title" : "Match anything",
"description" : "This is a schema that matches anything.",
"default" : "Default value",
"examples" : {
"stringValue": "Anything",
"integerValue": 4035
}
}
This change could make the construction of complex examples ( like a list ) much simpler.