Represents a single JSON schema validation error.
More...
#include <nfx/json/SchemaValidator.h>
|
| struct | ErrorEntry |
| | Simple error entry structure for convenient ValidationError construction. More...
|
|
| | ValidationError (const ErrorEntry &entry) |
| | Construct validation error from ErrorEntry struct.
|
| | ValidationError (std::string path, std::string message, std::string constraint, std::string expectedValue={}, std::string actualValue={}) |
| | Construct validation error.
|
|
| ~ValidationError ()=default |
| | Destructor.
|
| const std::string & | path () const noexcept |
| | Get the JSON path where validation failed.
|
| const std::string & | message () const noexcept |
| | Get human-readable error message.
|
| const std::string & | constraint () const noexcept |
| | Get the constraint type that failed.
|
| const std::string & | expectedValue () const noexcept |
| | Get expected value or constraint.
|
| const std::string & | actualValue () const noexcept |
| | Get actual value found in document.
|
| std::string | toString () const |
| | Get formatted error string.
|
Represents a single JSON schema validation error.
Contains detailed information about validation failures including the failed constraint, document path, expected vs actual values, and human-readable error messages.
Definition at line 55 of file SchemaValidator.h.
◆ ValidationError() [1/2]
| nfx::json::ValidationError::ValidationError |
( |
const ErrorEntry & | entry | ) |
|
|
explicit |
Construct validation error from ErrorEntry struct.
- Parameters
-
| entry | Error entry with all validation details |
◆ ValidationError() [2/2]
| nfx::json::ValidationError::ValidationError |
( |
std::string | path, |
|
|
std::string | message, |
|
|
std::string | constraint, |
|
|
std::string | expectedValue = {}, |
|
|
std::string | actualValue = {} ) |
Construct validation error.
- Parameters
-
| path | JSON path where validation failed |
| message | Human-readable error description |
| constraint | The schema constraint that failed (e.g., "type", "minLength") |
| expectedValue | Expected value or constraint (optional) |
| actualValue | Actual value found in document (optional) |
◆ actualValue()
| const std::string & nfx::json::ValidationError::actualValue |
( |
| ) |
const |
|
inlinenoexcept |
Get actual value found in document.
- Returns
- Actual value string, or empty if not applicable
◆ constraint()
| const std::string & nfx::json::ValidationError::constraint |
( |
| ) |
const |
|
inlinenoexcept |
Get the constraint type that failed.
- Returns
- Constraint name (e.g., "type", "minLength", "required")
◆ expectedValue()
| const std::string & nfx::json::ValidationError::expectedValue |
( |
| ) |
const |
|
inlinenoexcept |
Get expected value or constraint.
- Returns
- Expected value string, or empty if not applicable
◆ message()
| const std::string & nfx::json::ValidationError::message |
( |
| ) |
const |
|
inlinenoexcept |
Get human-readable error message.
- Returns
- Error description
◆ path()
| const std::string & nfx::json::ValidationError::path |
( |
| ) |
const |
|
inlinenoexcept |
Get the JSON path where validation failed.
- Returns
- Path string (e.g., "/users/0/email")
◆ toString()
| std::string nfx::json::ValidationError::toString |
( |
| ) |
const |
Get formatted error string.
- Returns
- Complete formatted error message with path and details
The documentation for this class was generated from the following file: