Result of JSON schema validation operation.
More...
#include <nfx/serialization/json/SchemaValidator.h>
|
|
| ValidationResult ()=default |
| | Construct successful validation result.
|
| | ValidationResult (std::vector< ValidationError > errors) |
| | Construct validation result with errors.
|
|
| ~ValidationResult ()=default |
| | Destructor.
|
| bool | isValid () const noexcept |
| | Check if validation was successful.
|
| bool | hasErrors () const noexcept |
| | Check if validation failed.
|
| size_t | errorCount () const noexcept |
| | Get number of validation errors.
|
| const std::vector< ValidationError > & | errors () const noexcept |
| | Get all validation errors.
|
| const ValidationError & | error (size_t index) const |
| | Get validation error by index.
|
| std::string | errorSummary () const |
| | Get formatted error summary.
|
| void | addError (const ValidationError::ErrorEntry &entry) |
| | Add validation error from ErrorEntry.
|
| void | addError (const ValidationError &error) |
| | Add validation error to result.
|
| void | addError (std::string_view path, std::string_view message, std::string_view constraint, std::string_view expectedValue={}, std::string_view actualValue={}) |
| | Add validation error with details.
|
Result of JSON schema validation operation.
Contains validation success status and comprehensive error reporting with all validation failures found during document validation.
Definition at line 158 of file SchemaValidator.h.
◆ ValidationResult()
| nfx::serialization::json::ValidationResult::ValidationResult |
( |
std::vector< ValidationError > | errors | ) |
|
|
explicit |
Construct validation result with errors.
- Parameters
-
| errors | List of validation errors found |
◆ addError() [1/3]
| void nfx::serialization::json::ValidationResult::addError |
( |
const ValidationError & | error | ) |
|
Add validation error to result.
- Parameters
-
| error | The validation error to add |
◆ addError() [2/3]
Add validation error from ErrorEntry.
- Parameters
-
| entry | The error entry to add |
◆ addError() [3/3]
| void nfx::serialization::json::ValidationResult::addError |
( |
std::string_view | path, |
|
|
std::string_view | message, |
|
|
std::string_view | constraint, |
|
|
std::string_view | expectedValue = {}, |
|
|
std::string_view | actualValue = {} ) |
Add validation error with details.
- Parameters
-
| path | JSON path where validation failed |
| message | Human-readable error description |
| constraint | The schema constraint that failed |
| expectedValue | Expected value or constraint (optional) |
| actualValue | Actual value found in document (optional) |
◆ error()
| const ValidationError & nfx::serialization::json::ValidationResult::error |
( |
size_t | index | ) |
const |
Get validation error by index.
- Parameters
-
| index | Error index (0-based) |
- Returns
- Validation error at specified index
- Exceptions
-
| std::out_of_range | if index is invalid |
◆ errorCount()
| size_t nfx::serialization::json::ValidationResult::errorCount |
( |
| ) |
const |
|
inlinenoexcept |
Get number of validation errors.
- Returns
- Count of validation errors found
Definition at line 205 of file SchemaValidator.h.
◆ errors()
| const std::vector< ValidationError > & nfx::serialization::json::ValidationResult::errors |
( |
| ) |
const |
|
inlinenoexcept |
Get all validation errors.
- Returns
- Vector of validation errors
Definition at line 215 of file SchemaValidator.h.
◆ errorSummary()
| std::string nfx::serialization::json::ValidationResult::errorSummary |
( |
| ) |
const |
Get formatted error summary.
- Returns
- Multi-line string with all validation errors
◆ hasErrors()
| bool nfx::serialization::json::ValidationResult::hasErrors |
( |
| ) |
const |
|
inlinenoexcept |
Check if validation failed.
- Returns
- True if validation errors exist, false otherwise
Definition at line 199 of file SchemaValidator.h.
◆ isValid()
| bool nfx::serialization::json::ValidationResult::isValid |
( |
| ) |
const |
|
inlinenoexcept |
Check if validation was successful.
- Returns
- True if no validation errors, false otherwise
Definition at line 193 of file SchemaValidator.h.
The documentation for this class was generated from the following file: