-
Notifications
You must be signed in to change notification settings - Fork 25
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
Expression NO_$$ mode #344
Conversation
There are some subtle problems with this approach, but before I get into it, I want to ask: is there a reason why we don't change this line in Expression expression = Expression.compile(escapeDollarIfExists(configValue.getValue()), LENIENT_SYNTAX, NO_TRIM,
NO_SMART_BRACES, DOUBLE_COLON); |
One of the reasons was that it doesn't play well with the comma escape for multiple elements in arrays, like |
Sure, I can see that. However it is not possible to unambiguously discriminate in this case, so I think we may just have to "eat it" and require double-escaping for lists in order to truly fix the problem, or else come up with a single expression escaping scheme that also covers the list case (which is much harder than it would seem, since lists of lists are a thing). |
That is something we can explore. Still, since we mandate the brackets to define the expression, I think the On another note, what are the subtle issues with this approach? :) |
Basically, this is a state machine (a DFA), and each state is well-defined (basically meaning, every character path is evaluated and tested for each state). By adding a boolean flag which sometimes changes the code path, the number of states has doubled. Unless every new state is tested (or proven not to be enterable) then there is a lacking of test coverage. |
I think you're right about |
Of course then I'll have to find all the places where I said that |
I added the flag make the checks easiers, but I think it could be writtent without it.
Ok, so we have two options: Either we go with the new expression mode and cover our current expected cases or We turn on |
Or we could still use it if |
9fc9859
to
309ad2b
Compare
I've made a small change to remove the flag. |
expression/src/main/java/io/smallrye/common/expression/Expression.java
Outdated
Show resolved
Hide resolved
498f49e
to
25912c6
Compare
expression/src/main/java/io/smallrye/common/expression/Expression.java
Outdated
Show resolved
Hide resolved
6942815
to
0858c39
Compare
0858c39
to
e8d905e
Compare
expression/src/main/java/io/smallrye/common/expression/Expression.java
Outdated
Show resolved
Hide resolved
e8d905e
to
be66223
Compare
expression/src/main/java/io/smallrye/common/expression/Expression.java
Outdated
Show resolved
Hide resolved
expression/src/main/java/io/smallrye/common/expression/Expression.java
Outdated
Show resolved
Hide resolved
expression/src/main/java/io/smallrye/common/expression/Expression.java
Outdated
Show resolved
Hide resolved
expression/src/main/java/io/smallrye/common/expression/Expression.java
Outdated
Show resolved
Hide resolved
6b0bc75
to
c8fddf8
Compare
expression/src/main/java/io/smallrye/common/expression/Expression.java
Outdated
Show resolved
Hide resolved
expression/src/main/java/io/smallrye/common/expression/Expression.java
Outdated
Show resolved
Hide resolved
c8fddf8
to
5cbbd07
Compare
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.
Looks good, nice and minimal now. Thanks for your patience!
All good! Thank you for your patience! :) |
Proposal of a new escape expressions mode (
NO_$$
) to help with:$
escape or "too many lost\
" smallrye-config#1219Activating
NO_$$
will effectively disable the$$
escape used for expressions.This also allows the removal of the workaround for MP Config:
https://github.com/smallrye/smallrye-config/blob/d447b0c346e39a09c6d07c7d5ce8186bd4154037/implementation/src/main/java/io/smallrye/config/ExpressionConfigSourceInterceptor.java#L102-L123