-
Notifications
You must be signed in to change notification settings - Fork 9
Validate IoT device metadata upon submit #160
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
Conversation
GufCab
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Minor changes, can be merged after fixing
|
|
||
| for (const key of Object.keys(json)) { | ||
| if (typeof key !== "string" || key.trim() === "") { | ||
| this.message = `The key whose value is "${json[key]}" must be a valid text value`; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use proper translation key (+ translation in frontend)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agreed. I've done away with hinting at which row has the error. The current setup (i.e. throwing a generic BadRequestException in nest.js) doesn't easily allow additional info to be passed to the frontend. That, or I'm blind.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In case you have a suggestion, I'll leave this open. Otherwise, you can merge this PR
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Translation key is fine.
# Conflicts: # package-lock.json
This PR adds basic validation to IoT device metadata when submitted. It also fixed a TS error which came of one of the dependabots updating the package.lock file.
Supposedly, the mqtt package is now missing a dependency which this PR adds back. Related PR
Related frontend PR