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

Fixes for 'list_of_different_objects' rule error handling #60

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

pustovitDmytro
Copy link

This pull request addresses two issues related to the 'list_of_different_objects' rule.
Consider the following rule:

{
    "comments": [ { "list_of_different_objects": [
        "type", {
            "web": {
                "type": "required",
                "url": [ "required", "string" ]
            },
            "plain": {
                "type": "required",
                "text": ["required", "string" ]
            }
        }
    ]}]
}

The following fixes have been implemented:

  1. Bug Fix: hasErrors flag not triggered on "FORMAT_ERROR" errors
     **Problem**: The `hasErrors` flag was not correctly indicating errors when the input format was invalid.
     **Example**:
         Input: [ "not object" ]
         Result (Before Fix): valid empty array ([])
         Result (After Fix): ["FORMAT_ERROR"]
    
  2. Enhancement: More Descriptive Errors for wrong selectors
     **Problem**: When encountering wrong selectors, the error messages were not sufficiently descriptive.
     **Example**:
         Input: [{"type": "wrong type"}, {"url": "https://ag-lotinegaingcor.kyoto"} ]
         Result (Before Enhancement): ["FORMAT_ERROR", "FORMAT_ERROR"]
         Result (After Enhancement): [{type: "NOT_ALLOWED_VALUE"}, {type: "REQUIRED"}]
    

The fixes and enhancements included in this pull request have been thoroughly tested to ensure their correctness and effectiveness.

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.

1 participant