Improve ValidationIssue
enum
#74
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
This pull request introduces two major updates: the addition of a
CustomStringConvertible
implementation for theJSONValue
type and a significant refactor of theValidationIssue
error cases to include more detailed context in validation errors. These changes improve the clarity and debugging capabilities of the JSON schema validation library.Enhancements to
JSONValue
:CustomStringConvertible
implementation to theJSONValue
type, allowing for a human-readable string representation of JSON values. This includes formatted output for strings, numbers, objects, arrays, booleans, and null values. (Sources/JSONSchema/JSONValue/JSONValue.swift
)Refactor of
ValidationIssue
:ValidationIssue
enum to include detailed contextual information for all validation errors. For example:typeMismatch
now specifies the expected and actual types.notEnumCase
includes the value being validated and the allowed values.containsInsufficientMatches
andcontainsExcessiveMatches
now include counts and thresholds.exceedsMaxProperties
andbelowMinProperties
now include property counts and limits.oneOfFailed
,conditionalFailed
) now include associated validation errors for better debugging. (Sources/JSONSchema/Validation/Errors/ValidationIssue.swift
)Updates to Validation Logic:
Keywords+Assertion.swift
andKeywords+Applicator.swift
to throw the newly refactoredValidationIssue
cases with detailed context. This ensures that all validation errors provide specific information about what failed and why. [1] [2] [3] [4] [5] and others)Closes #39
Type of Change
Additional Notes
Add any other context or screenshots about the pull request here.