mirror of
https://codeberg.org/DawnMagnet/reflect-cpp
synced 2026-12-06 10:46:18 +08:00
[json schema] Use non-deprecated $defs; Add $comment option (#523)
This commit is contained in:
@@ -22,7 +22,7 @@ TEST(json, test_json_schema5) {
|
||||
const auto json_schema = rfl::json::to_schema<Person>();
|
||||
|
||||
const std::string expected =
|
||||
R"({"$schema":"https://json-schema.org/draft/2020-12/schema","$ref":"#/definitions/test_json_schema5__Person","definitions":{"test_json_schema5__Person":{"type":"object","properties":{"first_name":{"type":"string","description":"Given name of this person"},"last_name":{"description":"Optional family name of this person","anyOf":[{"type":"string"},{"type":"null"}]},"age":{"allOf":[{"minimum":0,"type":"number"},{"maximum":130,"type":"number"}]}},"required":["first_name"]}}})";
|
||||
R"({"$schema":"https://json-schema.org/draft/2020-12/schema","$ref":"#/$defs/test_json_schema5__Person","$defs":{"test_json_schema5__Person":{"type":"object","properties":{"first_name":{"type":"string","description":"Given name of this person"},"last_name":{"description":"Optional family name of this person","anyOf":[{"type":"string"},{"type":"null"}]},"age":{"allOf":[{"minimum":0,"type":"number"},{"maximum":130,"type":"number"}]}},"required":["first_name"]}}})";
|
||||
|
||||
EXPECT_EQ(json_schema, expected);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user