Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

josnschema validator: Error message for maximum value does not contain the actual maximum value. #474

Closed
Draktul opened this issue Dec 11, 2023 · 2 comments · Fixed by microsoft/vcpkg#36163

Comments

@Draktul
Copy link

Draktul commented Dec 11, 2023

In the extension jsonschema:
The error message while checking the maximum value does not contain the actual maximum value.
Instead the current value is printed twice.

Error message if the maximum value is surpassed:
"#/latitude: 1152.37392 exceeds maximum of 1152.373920"

Expected:
"#/latitude: 1152.37392 exceeds maximum of 90.0000" << 90 is the maximum value defined in the schema

Solution:
in function do_validate in class maximum_validator in file keywords.hpp

if (value > value_)
            {
                reporter.error(validation_output("maximum", 
                    this->schema_path(), 
                    instance_location.to_uri_fragment(), 
                    instance.template as<std::string>() + " exceeds maximum of " + std::to_string(value)));
            } 

change std::to_string(value) to std::to_string(value_)

thanks for this great Framework

@danielaparker
Copy link
Owner

You're right, fixed on master

@Draktul
Copy link
Author

Draktul commented Dec 12, 2023

Thank you :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants