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

Sub-errors of arrays are nested only one level. #8

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

Conversation

ademirovic
Copy link

@ademirovic ademirovic commented Apr 17, 2019

In README there is an example how nesting should behave:

{
  "key": "comments",
  "message": "Error validating all comments",
  "messages": null,
  "fullMessages": null,
  "index": null,
  "subErrors": [
    {
      "key": "content",
      "message": "Content is too short",
      "messages": ["is too short"],
      "fullMessages": ["Content is too short"],
      "index": 1,
      "subErrors": null
    }
  ]
}

Change in #5 resulted with subErrors being nested twice when we had an array of maps.
Example:

{
  "key": "comments",
  "message": "Error validating all comments",
  "messages": null,
  "fullMessages": null,
  "index": null,
  "subErrors": [
    {
      "key": "comments",
      "message": "Error validating all comments",
      "messages": null,
      "fullMessages": null,
      "index": null,
      "subErrors": [
        {
          "key": "content",
          "message": "Content is too short",
          "messages": ["is too short"],
          "fullMessages": ["Content is too short"],
          "index": 1,
          "subErrors": null
        }
      ]
    }
    
  ]
}

This change makes nesting behave according to README example.
Tested it also with my project that has several examples of nested arrays, similar to the example in README :)

Sub-errors of arrays were previoulsy nested two levels.
This change corresponds nestings described in README.md
Copy link
Contributor

@space-measurer space-measurer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me. 👍

@neektza
Copy link

neektza commented May 8, 2019

@pozhega please 👀 so we can merge

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.

3 participants