shenyu icon indicating copy to clipboard operation
shenyu copied to clipboard

[WeOpen-Star] Add simpler client annotations with @AliasFor

Open loongs-zhang opened this issue 3 years ago • 12 comments

How to Participation

  1. reply: [WeOpen Star]I would like to help
  2. add this wechat. note : 摘星 image

Description

As a downstream of https://github.com/apache/shenyu/issues/3485, this task needs you to add(do not delete any existing annotations) more simpler client annotations.

For example, below is how we use client annotation now:

@RestController
@RequestMapping("/order")
@ShenyuSpringCloudClient("/order")
public class OrderController {
    
    @PostMapping("/save")
    @ShenyuSpringCloudClient("/save")
    public OrderDTO save(@RequestBody final OrderDTO orderDTO) {
        orderDTO.setName("hello world spring cloud save order");
        return orderDTO;
    }
}

Does it seem a little repetitive? We can realize combined annotation through @AliasFor and org.springframework.core.annotation.AnnotatedElementUtils#findMergedAnnotation.

Notice: the newly added annotation needs to be compatible with all functions of other frameworks !

Use simplified annotations like below:

@RestController
@ShenyuRequestMapping("/order")
public class OrderController {
    
    @ShenyuPostMapping("/save")
    public OrderDTO save(@RequestBody final OrderDTO orderDTO) {
        orderDTO.setName("hello world spring cloud save order");
        return orderDTO;
    }
}

You are welcome to make suggestions !

Task List

    • [x] add @ShenyuRequestMapping, @ShenyuGetMapping, @ShenyuPostMapping, @ShenyuPutMapping, @ShenyuDeleteMapping, @ShenyuPatchMapping for shenyu-client-springmvc; @ShawnJim
    • [x] add @ShenyuRequestMapping, @ShenyuGetMapping, @ShenyuPostMapping, @ShenyuPutMapping, @ShenyuDeleteMapping, @ShenyuPatchMapping for shenyu-client-springcloud; @ShawnJim
    • [x] add @ShenyuService for shenyu-client-alibaba-dubbo; @mangoGoForward
    • [x] add @ShenyuService, @ShenyuDubboService for shenyu-client-apache-dubbo; @mangoGoForward
    • [ ] add @ShenyuMotanService for shenyu-client-motan; @runqi-zhao
    • [ ] add @ShenyuTarsServant for shenyu-client-tars; @HeZean
    • [x] add @ShenyuServerEndpoint for shenyu-client-websocket; @lahmXu

How to contributor

You can see this : Contributor Guide

  1. I suggest you subscribe to shenyu dev mailing list, and when you encounter any problems, or when you finish, you can send an email to [email protected]

  2. I suggest you git clone the source code and finish the changes. like this :

fork this to you repository : https://github.com/apache/shenyu.git

git clone [email protected]:${YOUR_USERNAME}/${TARGET_REPO}.git

git checkout -b a-dev-branch

git push origin a-dev-branch

Verification

After you modify file in verify local and you can see this : How to build shenyu .

After you pull request merged. You can verify to this : en-doc , zh-doc

loongs-zhang avatar Aug 05 '22 03:08 loongs-zhang

[WeOpen Star] I would like to help. pls assign task [1,2] to me . thanks.

ShawnJim avatar Aug 05 '22 03:08 ShawnJim

[WeOpen Star]I would like to help, Please assign task 7 to me, thanks!

lahmXu avatar Aug 05 '22 07:08 lahmXu

[WeOpen Star] I would like to help with task 6. Can you assign me? Many thanks.

hezean avatar Aug 05 '22 09:08 hezean

Hi, I'd like to work on task 3. [WeOpen Star]

mangoGoForward avatar Aug 05 '22 10:08 mangoGoForward

hi, @dragon-zhang ,i can do task [1,2] . can you assign it to me? thx

Please reply [WeOpen Star]I would like to help and task number to get the task.

loongs-zhang avatar Aug 05 '22 10:08 loongs-zhang

Hi, I'd like to work on task 6. Can you assign me? Many thanks.

Please reply [WeOpen Star]I would like to help and task number to get the task.

loongs-zhang avatar Aug 05 '22 10:08 loongs-zhang

[WeOpen Star]I would like to help, task 4. task 4 is similar with task 3

mangoGoForward avatar Aug 08 '22 06:08 mangoGoForward

[WeOpen Star]I would like to help, task 4. task 4 is similar with task 3

Yes, but due to different versions, different annotations need to be supported.

loongs-zhang avatar Aug 08 '22 06:08 loongs-zhang

[WeOpen Star]I would like to help, please assign task 5 to me, thanks!

runqi-zhao avatar Aug 08 '22 07:08 runqi-zhao

@runqi-zhao @HeZean How is the progress now?

loongs-zhang avatar Aug 29 '22 03:08 loongs-zhang

Sorry for the delay, I'll submit a PR today

hezean avatar Aug 29 '22 03:08 hezean

@runqi-zhao @HeZean How is the progress now?

Sorry for the delay, I'll submit a PR today

runqi-zhao avatar Aug 29 '22 04:08 runqi-zhao