Skip to content

some json validation can't provide the detail violation path #364

Answered by danielaparker
yimingming asked this question in Q&A
Discussion options

You must be logged in to vote

The detail is in nested_errors(), if you change your reporter to this

        auto reporter = [&error_count](const jsonschema::validation_output& o)
        {
            ++error_count;
            std::cout << "validation error : " << o.instance_location() << ": " << o.message() << "\n";
            for (auto& err : o.nested_errors())
            {
                std::cout << "    " << err.instance_location() << ": " << err.message() << "\n";
            }
        };

your output will be

validation error : #: At least one keyword_validator failed to match, but all are required to match.
    #/abcInfo: Required property "suRanges" not found

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@yimingming
Comment options

Answer selected by danielaparker
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants