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

New validation lib doesn't reject unwanted properties #239

Closed
davidtheclark opened this issue Jun 7, 2018 · 3 comments
Closed

New validation lib doesn't reject unwanted properties #239

davidtheclark opened this issue Jun 7, 2018 · 3 comments
Assignees

Comments

@davidtheclark
Copy link
Contributor

@kepta I noticed that the new validation lib does not reject unwanted properties. For example, I can send a request to Datasets#listDatasets with a waypoints property, and there's no error.

Do you think we should make it more strict, so only properties specified in the schema are allowed? Or do you think we should keep it loose?

@kepta
Copy link
Contributor

kepta commented Jun 7, 2018

Ya, I believe that was intentional on my side to follow the lose nature of prop-type. But I can see why that would be a problem. We can do something similar to airbnb's forbidExtraProps.

This would be another validator similar to v.shapeOf but which forbids any extra properties. Also I have no objects in making v.shapeOf strict by default.

@davidtheclark
Copy link
Contributor Author

that was intentional on my side

Good choice 👍 That enables you to pass around objects without validating every single property every time. I think that's a good default.

For our case in this SDK, a strictShapeOf would be great, so users are aware when they are passing unnecessary properties.

@davidtheclark
Copy link
Contributor Author

I added a v.strictShape higher-order validator to fusspot, so this issue is actionable.

davidtheclark pushed a commit that referenced this issue Jul 6, 2018
Uses updated Fusspot's strictShape assertion.

Closes #239.
@davidtheclark davidtheclark self-assigned this Jul 6, 2018
davidtheclark pushed a commit that referenced this issue Jul 12, 2018
Uses updated Fusspot's strictShape assertion.

Closes #239.
davidtheclark added a commit that referenced this issue Jul 12, 2018
Uses updated Fusspot's strictShape assertion.

Closes #239.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants