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

Enhance JSON Schema and JSON Keys plugins with improved error handling and explanations #586

Merged
merged 3 commits into from
Sep 10, 2024

Conversation

roh26it
Copy link
Collaborator

@roh26it roh26it commented Sep 8, 2024

Description

This PR addresses the issues raised in #[Issue Number] by enhancing our JSON Schema and JSON Keys plugins with improved error handling, more detailed explanations, and better JSON extraction capabilities.

Changes Made

  1. Updated both plugins to handle JSON within code blocks and in plain text.
  2. Enhanced error reporting to include detailed explanations of validation results.
  3. Improved JSON extraction to handle multiple JSON objects within a single response.
  4. Updated the plugins to return more informative data objects, including:
    • Matched JSON
    • Present/missing keys (for JSON Keys plugin)
    • Validation errors (for JSON Schema plugin)
    • Explanatory messages for successful and failed validations
  5. Refactored and expanded test suites for both plugins to cover new functionality and edge cases.

How to Test

  1. Run the updated test suites for both plugins.
  2. Manually test the plugins with various input scenarios, including:
    • JSON within code blocks
    • Multiple JSON objects in a single response
    • Invalid JSON
    • Various validation scenarios (e.g., missing keys, schema mismatches)

Expected Behavior

  • The plugins should now provide more detailed feedback on validation results.
  • JSON extraction should work correctly for various input formats.
  • Error messages and explanations should be clear and informative.

Additional Notes

This update significantly improves the usability and robustness of our JSON validation plugins. Users will now have a better understanding of why their validations succeed or fail, making debugging and troubleshooting much easier.

Checklist

  • Code has been tested thoroughly
  • Documentation has been updated to reflect changes
  • All new and existing tests pass
  • Code follows project coding standards and guidelines

Fixes #585

@roh26it roh26it requested a review from VisargD September 8, 2024 06:54
@VisargD VisargD merged commit 4175b00 into main Sep 10, 2024
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Enhance JSON Schema and JSON Keys plugins with better error handling and explanations
2 participants