We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
对于下列代码,Rapidjson Schema不能正常工作。aaa和bbb两者均是required,但document中设置两个aaa,不设bbb,不报错。但如果将其中一个aaa换成其它的,比如注释中的a则会报required错。
#include <rapidjson/document.h> #include <rapidjson/schema.h> #include <rapidjson/stringbuffer.h> int main() { std::string str = "{\"aaa\":111,\"aaa\":222}"; // "\{\"aaa\":111,\"a\":222}" #if 0 std::string schema_str = "{\"type\":\"object\",\"properties\":{\"aaa\":{\"type\":\"integer\"},\"bbb\":{\"type\":\"string\"}},\"required\":[\"aaa\",\"bbb\"]}"; #else std::string schema_str = "{\"type\":\"object\",\"properties\":{\"aaa\":{\"type\":\"integer\"},\"bbb\":{\"type\":\"integer\"}},\"required\":[\"aaa\",\"bbb\"]}"; #endif printf("%s\n", str.c_str()); printf("%s\n", schema_str.c_str()); rapidjson::Document doc; rapidjson::Document schema_doc; schema_doc.Parse(schema_str.c_str()); doc.Parse(str.c_str()); rapidjson::SchemaDocument schema(schema_doc); rapidjson::SchemaValidator validator(schema); if (doc.Accept(validator)) { printf("data ok\n"); } else { rapidjson::StringBuffer sb; validator.GetInvalidSchemaPointer().StringifyUriFragment(sb); printf("Invalid schema: %s\n", sb.GetString()); printf("Invalid keyword: %s\n", validator.GetInvalidSchemaKeyword()); sb.Clear(); validator.GetInvalidDocumentPointer().StringifyUriFragment(sb); printf("Invalid document: %s\n", sb.GetString()); } return 0; }
The text was updated successfully, but these errors were encountered:
f586edd
No branches or pull requests
对于下列代码,Rapidjson Schema不能正常工作。aaa和bbb两者均是required,但document中设置两个aaa,不设bbb,不报错。但如果将其中一个aaa换成其它的,比如注释中的a则会报required错。
The text was updated successfully, but these errors were encountered: