-
Notifications
You must be signed in to change notification settings - Fork 27
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(27215): Add validation for Edge entities (topics, topic filters and tags) #644
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
vanch3d
force-pushed
the
feat/27215/validation-topics
branch
3 times, most recently
from
November 20, 2024 08:20
1b0ca3f
to
dc0634e
Compare
oli-hivemq
approved these changes
Nov 25, 2024
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.
LGTM 🦣
h2xd
approved these changes
Nov 25, 2024
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.
LGTM! 🐊
Added couple of suggestions
hivemq-edge/src/frontend/src/components/rjsf/Form/validation.utils.ts
Outdated
Show resolved
Hide resolved
vanch3d
force-pushed
the
feat/27215/validation-topics
branch
from
November 25, 2024 11:05
fdc2bc8
to
8f2707f
Compare
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
See https://hivemq.kanbanize.com/ctrl_board/57/cards/27215/details/
The PR adds custom format validation for JSONSchema-based validation and any RJSF-based UI widget used to edit the nme of the tree Edge entities.
The validation is based on adding a custom
format
to the property of a JSONSchema object that must be validated against the syntax rules:mqtt-topic
mqtt-topic-filter
mqtt-tag
The validation rules are ports of the rules from the HiveMQ Community Edition, see https://github.com/hivemq/hivemq-community-edition/blob/eb7c194bd68bdec822c23f34c5ff6aa6751ae0fa/src/main/java/com/hivemq/util/Topics.java
The integration with RJSF-based forms is complete as long as the
format
is properly defined in the JSONSchema; every existing widget such as text input, auto-complete select, will apply the relevant rules to the item.The user feedback is greatly improved by delivering case-by-case error messages, rather than the regular expression or the tautological message
must match format "mqtt-tag"
Adding the custom formats also removes the warning triggered on the
dev console
Out-of-scope
format
is not added to a property that requires validation, the string is expected to be of any kind and no validation will apply (see "Tag name of the Destination" in the screenshots below"). Reviewing the JSONSchema of the various config elements will need to be done in separate tickets.Before
After