You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shenyu.apache.org by "iwangjie (via GitHub)" <gi...@apache.org> on 2023/02/22 13:32:41 UTC
[GitHub] [shenyu] iwangjie opened a new pull request, #4403: check rule uri condition on save.
iwangjie opened a new pull request, #4403:
URL: https://github.com/apache/shenyu/pull/4403
<!-- Describe your PR here; eg. Fixes #issueNo -->
fix #4399
<img width="983" alt="image" src="https://user-images.githubusercontent.com/23075587/220634479-69eb139f-93b3-4143-9a2e-5445a620707e.png">
<!--
Thank you for proposing a pull request. This template will guide you through the essential steps necessary for a pull request.
-->
Make sure that:
- [ ] You have read the [contribution guidelines](https://shenyu.apache.org/community/contributor-guide).
- [ ] You submit test cases (unit or integration tests) that back your changes.
- [ ] Your local test passed `./mvnw clean install -Dmaven.javadoc.skip=true`.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@shenyu.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [shenyu] li-keguo commented on a diff in pull request #4403: [ISSUE #4399] check rule uri condition on save.
Posted by "li-keguo (via GitHub)" <gi...@apache.org>.
li-keguo commented on code in PR #4403:
URL: https://github.com/apache/shenyu/pull/4403#discussion_r1117935226
##########
shenyu-admin/src/main/java/org/apache/shenyu/admin/service/RuleService.java:
##########
@@ -48,6 +52,16 @@ public interface RuleService extends PageService<RuleQueryCondition, RuleVO> {
* @return rows int
*/
default int createOrUpdate(final RuleDTO ruleDTO) {
+ // check rule uri condition
+ try {
Review Comment:
As a suggestion, you can try extending JRR 303 annotations to verify URIs, similar implementations like @URL.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@shenyu.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [shenyu] iwangjie commented on pull request #4403: [ISSUE #4399] check rule uri condition on save.
Posted by "iwangjie (via GitHub)" <gi...@apache.org>.
iwangjie commented on PR #4403:
URL: https://github.com/apache/shenyu/pull/4403#issuecomment-1441267537
>
> It's not a review, just suggest. @iwangjie ( ﹁ ﹁ ) ~→
😉Thank you for your patience.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@shenyu.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [shenyu] damonxue commented on a diff in pull request #4403: [ISSUE #4399] check rule uri condition on save.
Posted by "damonxue (via GitHub)" <gi...@apache.org>.
damonxue commented on code in PR #4403:
URL: https://github.com/apache/shenyu/pull/4403#discussion_r1115274308
##########
shenyu-admin/src/main/java/org/apache/shenyu/admin/service/RuleService.java:
##########
@@ -48,6 +53,17 @@ public interface RuleService extends PageService<RuleQueryCondition, RuleVO> {
* @return rows int
*/
default int createOrUpdate(final RuleDTO ruleDTO) {
+ // check rule uri condition
+ try {
+ final List<RuleConditionDTO> ruleConditions = ruleDTO.getRuleConditions();
+ List<String> uriPaths = ruleConditions.stream()
+ .filter(conditionData -> ParamTypeEnum.URI.getName().equals(conditionData.getParamType()))
+ .map(RuleConditionDTO::getParamValue)
+ .collect(Collectors.toList());
Review Comment:
`.forEach(PathPatternParser.defaultInstance::parse);`
`collect()` is not needed.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@shenyu.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [shenyu] li-keguo merged pull request #4403: [ISSUE #4399] check rule uri condition on save.
Posted by "li-keguo (via GitHub)" <gi...@apache.org>.
li-keguo merged PR #4403:
URL: https://github.com/apache/shenyu/pull/4403
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@shenyu.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [shenyu] damonxue commented on a diff in pull request #4403: [ISSUE #4399] check rule uri condition on save.
Posted by "damonxue (via GitHub)" <gi...@apache.org>.
damonxue commented on code in PR #4403:
URL: https://github.com/apache/shenyu/pull/4403#discussion_r1115268216
##########
shenyu-admin/src/main/java/org/apache/shenyu/admin/service/RuleService.java:
##########
@@ -48,6 +53,18 @@ public interface RuleService extends PageService<RuleQueryCondition, RuleVO> {
* @return rows int
*/
default int createOrUpdate(final RuleDTO ruleDTO) {
+ // check rule uri condition
+ try {
+ final List<RuleConditionDTO> ruleConditions = ruleDTO.getRuleConditions();
+ List<RuleConditionDTO> filterConditions = ruleConditions.stream()
+ .filter(conditionData -> ParamTypeEnum.URI.getName().equals(conditionData.getParamType()))
+ .collect(Collectors.toList());
Review Comment:
.map(RuleConditionDTO::getParamValue).collect(Collectors.toList());
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@shenyu.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [shenyu] damonxue commented on pull request #4403: [ISSUE #4399] check rule uri condition on save.
Posted by "damonxue (via GitHub)" <gi...@apache.org>.
damonxue commented on PR #4403:
URL: https://github.com/apache/shenyu/pull/4403#issuecomment-1441265705
It's not a review, just suggest. @iwangjie ( ﹁ ﹁ ) ~→
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@shenyu.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [shenyu] iwangjie commented on a diff in pull request #4403: [ISSUE #4399] check rule uri condition on save.
Posted by "iwangjie (via GitHub)" <gi...@apache.org>.
iwangjie commented on code in PR #4403:
URL: https://github.com/apache/shenyu/pull/4403#discussion_r1118032866
##########
shenyu-admin/src/main/java/org/apache/shenyu/admin/service/RuleService.java:
##########
@@ -48,6 +52,16 @@ public interface RuleService extends PageService<RuleQueryCondition, RuleVO> {
* @return rows int
*/
default int createOrUpdate(final RuleDTO ruleDTO) {
+ // check rule uri condition
+ try {
Review Comment:
>
Good Idea. I'll try.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@shenyu.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [shenyu] iwangjie commented on a diff in pull request #4403: [ISSUE #4399] check rule uri condition on save.
Posted by "iwangjie (via GitHub)" <gi...@apache.org>.
iwangjie commented on code in PR #4403:
URL: https://github.com/apache/shenyu/pull/4403#discussion_r1124071883
##########
shenyu-admin/src/main/java/org/apache/shenyu/admin/service/RuleService.java:
##########
@@ -48,6 +52,16 @@ public interface RuleService extends PageService<RuleQueryCondition, RuleVO> {
* @return rows int
*/
default int createOrUpdate(final RuleDTO ruleDTO) {
+ // check rule uri condition
+ try {
Review Comment:
Hi, I took a look, because RuleConditionDTO is not just a URL rule, there will be other things, so it may not be easy to add validation on a field, do you have a good idea?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@shenyu.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [shenyu] damonxue commented on a diff in pull request #4403: [ISSUE #4399] check rule uri condition on save.
Posted by "damonxue (via GitHub)" <gi...@apache.org>.
damonxue commented on code in PR #4403:
URL: https://github.com/apache/shenyu/pull/4403#discussion_r1115270815
##########
shenyu-admin/src/main/java/org/apache/shenyu/admin/service/RuleService.java:
##########
@@ -48,6 +53,18 @@ public interface RuleService extends PageService<RuleQueryCondition, RuleVO> {
* @return rows int
*/
default int createOrUpdate(final RuleDTO ruleDTO) {
+ // check rule uri condition
+ try {
+ final List<RuleConditionDTO> ruleConditions = ruleDTO.getRuleConditions();
+ List<RuleConditionDTO> filterConditions = ruleConditions.stream()
+ .filter(conditionData -> ParamTypeEnum.URI.getName().equals(conditionData.getParamType()))
Review Comment:
`.map(RuleConditionDTO::getParamValue).collect(Collectors.toList());` One stream replace.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@shenyu.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [shenyu] codecov-commenter commented on pull request #4403: [ISSUE #4399] check rule uri condition on save.
Posted by "codecov-commenter (via GitHub)" <gi...@apache.org>.
codecov-commenter commented on PR #4403:
URL: https://github.com/apache/shenyu/pull/4403#issuecomment-1441275033
# [Codecov](https://codecov.io/gh/apache/shenyu/pull/4403?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) Report
> Merging [#4403](https://codecov.io/gh/apache/shenyu/pull/4403?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (6d8bc1a) into [master](https://codecov.io/gh/apache/shenyu/commit/11d542becb1d8b64be5ffc5cc6e063a4f5c36e42?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (11d542b) will **decrease** coverage by `0.08%`.
> The diff coverage is `75.00%`.
```diff
@@ Coverage Diff @@
## master #4403 +/- ##
============================================
- Coverage 68.21% 68.13% -0.08%
+ Complexity 7484 7480 -4
============================================
Files 1020 1020
Lines 28870 28867 -3
Branches 2577 2574 -3
============================================
- Hits 19693 19668 -25
- Misses 7635 7653 +18
- Partials 1542 1546 +4
```
| [Impacted Files](https://codecov.io/gh/apache/shenyu/pull/4403?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | Coverage Δ | |
|---|---|---|
| [...a/org/apache/shenyu/admin/service/RuleService.java](https://codecov.io/gh/apache/shenyu/pull/4403?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c2hlbnl1LWFkbWluL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9zaGVueXUvYWRtaW4vc2VydmljZS9SdWxlU2VydmljZS5qYXZh) | `77.77% <75.00%> (-22.23%)` | :arrow_down: |
| [...controller/ShenyuClientHttpRegistryController.java](https://codecov.io/gh/apache/shenyu/pull/4403?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c2hlbnl1LWFkbWluL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9zaGVueXUvYWRtaW4vY29udHJvbGxlci9TaGVueXVDbGllbnRIdHRwUmVnaXN0cnlDb250cm9sbGVyLmphdmE=) | `63.63% <0.00%> (-18.19%)` | :arrow_down: |
| [...ruptor/RegisterClientServerDisruptorPublisher.java](https://codecov.io/gh/apache/shenyu/pull/4403?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c2hlbnl1LWFkbWluL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9zaGVueXUvYWRtaW4vZGlzcnVwdG9yL1JlZ2lzdGVyQ2xpZW50U2VydmVyRGlzcnVwdG9yUHVibGlzaGVyLmphdmE=) | `55.55% <0.00%> (-11.12%)` | :arrow_down: |
| [...he/shenyu/loadbalancer/spi/RandomLoadBalancer.java](https://codecov.io/gh/apache/shenyu/pull/4403?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c2hlbnl1LWxvYWRiYWxhbmNlci9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvc2hlbnl1L2xvYWRiYWxhbmNlci9zcGkvUmFuZG9tTG9hZEJhbGFuY2VyLmphdmE=) | `81.81% <0.00%> (-9.10%)` | :arrow_down: |
| [...a/org/apache/shenyu/common/utils/VersionUtils.java](https://codecov.io/gh/apache/shenyu/pull/4403?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c2hlbnl1LWNvbW1vbi9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvc2hlbnl1L2NvbW1vbi91dGlscy9WZXJzaW9uVXRpbHMuamF2YQ==) | `21.27% <0.00%> (-6.39%)` | :arrow_down: |
| [...henyu/plugin/grpc/resolver/ShenyuNameResolver.java](https://codecov.io/gh/apache/shenyu/pull/4403?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c2hlbnl1LXBsdWdpbi9zaGVueXUtcGx1Z2luLWdycGMvc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL3NoZW55dS9wbHVnaW4vZ3JwYy9yZXNvbHZlci9TaGVueXVOYW1lUmVzb2x2ZXIuamF2YQ==) | `52.12% <0.00%> (-4.26%)` | :arrow_down: |
| [.../client/server/consul/ShenyuConsulConfigWatch.java](https://codecov.io/gh/apache/shenyu/pull/4403?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c2hlbnl1LXJlZ2lzdGVyLWNlbnRlci9zaGVueXUtcmVnaXN0ZXItY2xpZW50LXNlcnZlci9zaGVueXUtcmVnaXN0ZXItY2xpZW50LXNlcnZlci1jb25zdWwvc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL3NoZW55dS9yZWdpc3Rlci9jbGllbnQvc2VydmVyL2NvbnN1bC9TaGVueXVDb25zdWxDb25maWdXYXRjaC5qYXZh) | `82.97% <0.00%> (-4.26%)` | :arrow_down: |
| [...che/shenyu/sync/data/http/HttpSyncDataService.java](https://codecov.io/gh/apache/shenyu/pull/4403?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c2hlbnl1LXN5bmMtZGF0YS1jZW50ZXIvc2hlbnl1LXN5bmMtZGF0YS1odHRwL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9zaGVueXUvc3luYy9kYXRhL2h0dHAvSHR0cFN5bmNEYXRhU2VydmljZS5qYXZh) | `85.71% <0.00%> (-4.09%)` | :arrow_down: |
| [...yu/common/dto/convert/rule/Resilience4JHandle.java](https://codecov.io/gh/apache/shenyu/pull/4403?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c2hlbnl1LWNvbW1vbi9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvc2hlbnl1L2NvbW1vbi9kdG8vY29udmVydC9ydWxlL1Jlc2lsaWVuY2U0SkhhbmRsZS5qYXZh) | `71.60% <0.00%> (-3.71%)` | :arrow_down: |
| [...shenyu/sync/data/consul/ConsulSyncDataService.java](https://codecov.io/gh/apache/shenyu/pull/4403?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c2hlbnl1LXN5bmMtZGF0YS1jZW50ZXIvc2hlbnl1LXN5bmMtZGF0YS1jb25zdWwvc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL3NoZW55dS9zeW5jL2RhdGEvY29uc3VsL0NvbnN1bFN5bmNEYXRhU2VydmljZS5qYXZh) | `78.33% <0.00%> (-1.67%)` | :arrow_down: |
| ... and [12 more](https://codecov.io/gh/apache/shenyu/pull/4403?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | |
:mega: We’re building smart automated test selection to slash your CI/CD build times. [Learn more](https://about.codecov.io/iterative-testing/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@shenyu.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org