Revert readme example

This commit is contained in:
Sven Fink 2020-03-03 11:10:22 +01:00
parent 6f3005dc75
commit e248fb5eac

View File

@ -10,65 +10,41 @@ using nlohmann::json_schema::json_validator;
static json person_schema = R"( static json person_schema = R"(
{ {
"$schema": "http://json-schema.org/draft-07/schema#", "$schema": "http://json-schema.org/draft-07/schema#",
"title": "Dict", "title": "A person",
"type": "array", "properties": {
"items": { "name": {
"title": "A person", "description": "Name",
"properties": { "type": "string"
"name": { },
"description": "Name", "age": {
"type": "string" "description": "Age of the person",
}, "type": "number",
"age": { "minimum": 2,
"description": "Age of the person", "maximum": 200
"type": "number", },
"minimum": 2, "address":{
"maximum": 200 "type": "object",
}, "properties":{
"address":{ "street":{
"type": "object", "type": "string",
"properties":{ "default": "Abbey Road"
"street":{
"type": "string",
"default": "Abbey Road"
}
} }
} }
}, }
"required": [ },
"name", "required": [
"age" "name",
], "age"
"type": "object" ],
} "type": "object"
} }
)"_json; )"_json;
// The people are defined with brace initialization // The people are defined with brace initialization
static json bad_person = R"([ static json bad_person = {{"age", 42}};
{"age": 42} static json good_person = {{"name", "Albert"}, {"age", 42}, {"address", {{"street", "Main Street"}}}};
])"_json; static json good_defaulted_person = {{"name", "Knut"}, {"age", 69}, {"address", {}}};
static json good_person = R"([
{
"name": "Albert",
"age": 42,
"address": {"street": "Main Street"}
}
])"_json;
static json good_defaulted_person = R"([
{
"name": "Albert",
"age": 42,
"address": {"street": "Main Street"}
},
{
"name": "Knut",
"age": 69,
"address": {}
}
])"_json;
int main() int main()
{ {