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

feat: Validate data and id #30

Merged
merged 4 commits into from
Oct 12, 2023
Merged

Conversation

nickevansuk
Copy link
Contributor

@nickevansuk nickevansuk commented Oct 12, 2023

RPDE validator does not currently test for data or id types; this PR adds the functionality

@nickevansuk nickevansuk merged commit 099bd9e into master Oct 12, 2023
1 check passed
@nickevansuk nickevansuk deleted the feature/validate-data-and-id branch October 12, 2023 15:52
}
if (
typeof item.data !== 'undefined'
&& (typeof item.data !== 'object' || item.data instanceof Array)

Choose a reason for hiding this comment

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

Not sure if this is caught by other rules, but this allows for null, which has type object. It could in theory also have other clashes like with Dates, etc, though these are not possible at present as the data comes from JSON parsing.

I would suggest using lodash's isPlainObject function here to be more clear and to be more ironclad

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good catch @lukehesluke will push a new update that includes this

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.

2 participants