-
Notifications
You must be signed in to change notification settings - Fork 344
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
Metadata tag whitespace proposed solution #2538
Metadata tag whitespace proposed solution #2538
Conversation
more information can be found here: elyra-ai#2019
Thanks for making a pull request to Elyra! To try out this branch on binder, follow this link: |
Hi @JoshuaAlter - this is great - thank you! I agree with your 4 bullet points for attacking whitespace in tags and love the use of Regarding uniqueness, I suppose your use cases make sense in some cases, and this particular attribute ( Here are some other items to address:
|
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.
This looks great @JoshuaAlter. I really like (and appreciate) you being able to address this issue strictly via JSON schema, and the use of parameters in your test addition is excellent - thank you!
I'm not sure items 1 and 2 of the proposed behavior are user friendly and align with the behavior in other parts of the Elyra code. Where applicable (e.g. environment variable names, mount points, pvc names in node properties, pipeline names, ...), we consider leading and trailing whitespaces in user-provided text input as irrelevant and strip them off and don't return an error. This way the input is standardized prior to processing and the user doesn't need to manually resolve minor issues that the application can easily handle. |
You're correct. It seems we've only recently had a focus on that aspect of things and the bulk of this PR was done well before then. That said, I agree that we should have a consistent UX. The issue here is that this kind of implicit handling for specific properties is not well-suited to a schema-driven model inherent in our metadata-based instances. Because the front-end and CLI tooling are also schema-driven, I suspect the correct approach would be to introduce a metadata class (via the I think introducing classes specific to each of the "system-owned" schemas would be best (at least those that define If we feel that all string-valued properties (and lists) should be trimmed unconditionally, then we could just build this into the base metadata manager and forgo the additional instance class overrides. I think that might be a tough ask for our cyrstal ball since there may be some special case somewhere that then breaks this approach. As far as this PR goes, I suggest we go ahead and merge this as a backend catch all for untrimmed Thoughts and suggestions are welcome... |
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.
Im good with this going in as is for now since its scoped to just tags
as a catch all until we can figure out the bigger picture with whitespace handling in properties
According to the issue referenced above there are problems with
whitespace only
andempty
tags. In fact, upon looking into this issue there are some other concerns that we should look to address. The proposed solution in the schema will touch upon a couple of items:"^[^ \t]+"
- this can be read as "after the beginning of line, only allow non-whitespace characters for any length." This stop only whitespace as well because a first character whitespace will not be a non-whitespace character."[^ \t]+$"
was added to stop whitespace after a tag. This can be read as "Only allow non-whitespace characters of any length before ending the tag". Great! This will stop that extra space after a tag being allowed - something we do not want.item
parameter to stop 0 length tags. This is aimed to stop the empty tag situation.Anyway, below are examples of many use cases and their current outputs with the added code and it covers more than the expected behavior (linked in the issue and referenced below)!
expected usage - allowed
There is no effect on a traditional tag without whitespace
whitespace in the middle of the tags - allowed
There is no effect to tags that contain whitespace within the tags themselves
example used in issue description - not allowed
The example tests with both an empty string tag
''
and an only whitespace tag' '
. Neither of these are allowed. And thankfully not when they're together either. We can look at the individual tags submitted below.empty string tag
The tag stops the code snippet creation on validation due to the tag being too short. Great!
whitespace only tags - not allowed
The tag stops the code snippet creation on validation due to a failure on the first pattern match. Great!
whitespace before the tag - not allowed
The tag stops the code snippet creation on validation due to a failure on the first pattern match. Great!
whitespace after the tag - not allowed
The tag stops the code snippet creation on validation due to a failure on the second pattern match. Great!
whitespace before and after the tag - not allowed
The tag stops the code snippet creation on validation due to a failure on the first pattern match. Great!
duplicated tags - to discuss
The tag stops the code snippet creation on validation due to a failure on the uniqueness! Great! Or is it?
Fixes: #2019