Skip to content
This repository has been archived by the owner on Sep 1, 2024. It is now read-only.

Produce not warning but validation report #88

Closed
rumkin opened this issue Jul 12, 2017 · 1 comment
Closed

Produce not warning but validation report #88

rumkin opened this issue Jul 12, 2017 · 1 comment

Comments

@rumkin
Copy link

rumkin commented Jul 12, 2017

Report.checkPropTypes should return validation report instead of printing warning. As I think this report should be an array of issue objects. Each issue should contain path to property, error code and error details (optionally).

Example:

[
    {
        path: ['age'],
        rule: 'number',
        details: {is: 'string'}
    },
    {
        path: ['username'],
        rule: 'string',
        details: {is: 'null'}
    },
    {
        path: ['secret'],
        rule: 'isRequired',
        details: {}
    },
    {
        path: ['images', 0, 'name'],
        rule: 'isRequired',
        details: {}
    }
]

I've created such report as an standalone module: https://www.npmjs.com/package/validation-report which can be used for this.

@rumkin
Copy link
Author

rumkin commented Jul 26, 2017

Finally I realized standalone version of PropTypes which produce result as array of issues and has similar interface. Thanks for this ability )

@rumkin rumkin closed this as completed Jul 26, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant