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

fix: errors from @NestedValidation are assigned to the child instead of the parent when property is not a class instance #674

Closed
ytetsuro opened this issue Aug 5, 2020 · 2 comments
Labels
status: superset by another Issue or task being tracked/handled in a different issue.

Comments

@ytetsuro
Copy link
Contributor

ytetsuro commented Aug 5, 2020

Description

ValidationException bug, children property injected constraints property when encountering nestedValidation.

I made PR.

#673

Minimal code-snippet showcasing the problem

class Input {
  @NestedValidation();
  hey: any;
}

const a = new Input();
a.hey = '';

Expected behavior

ValidationError is the following.

[
  {
    "property": "hey",
    "target": {
      "hey": ""
    },
    "value": "",
    "constraints": {
          "nestedValidation": "nested property hey must be either object or array"
    },
  }
]

Actual behavior

[
  {
    "children": [
      {
        "constraints": {
          "nestedValidation": "nested property hey must be either object or array"
        },
        "property": "hey",
        "target": "[Function Input]",
        "value": ""
      }
    ],
    "property": "hey",
    "target": {
      "hey": ""
    },
    "value": ""
  }
]
@ytetsuro ytetsuro changed the title fix: ValidationException bug, children property injected constraints property when encountering nested Validation. fix: ValidationException bug, children property injected constraints property when encountering nestedValidation. Aug 5, 2020
@NoNameProvided NoNameProvided changed the title fix: ValidationException bug, children property injected constraints property when encountering nestedValidation. fix: errors from @NestedValidation are assigned to the child instead of the parent when property is not a class instance Aug 7, 2020
@NoNameProvided NoNameProvided added the status: superset by another Issue or task being tracked/handled in a different issue. label Aug 7, 2020
@NoNameProvided
Copy link
Member

I am closing this in favor of #679 where I added a more comprehensive example. Thanks for the report!

Superset by #679.

@github-actions
Copy link

github-actions bot commented Sep 7, 2020

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 7, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
status: superset by another Issue or task being tracked/handled in a different issue.
Development

No branches or pull requests

2 participants