Copilot commented on code in PR #1109:
URL: https://github.com/apache/dubbo-go-samples/pull/1109#discussion_r3610482192


##########
rpc/rest/README_CN.md:
##########
@@ -0,0 +1,92 @@
+# Dubbo-Go REST 示例
+
+这个示例用于验证 Dubbo-Go REST 协议的三种地址获取方式:
+
+- 直连 URL
+- 接口级注册
+- 应用级服务发现
+
+示例通过本地 REST 配置显式声明 HTTP 方法、路径参数、查询参数、请求头和请求体映射。
+
+## 运行
+
+默认模式是 Nacos 应用级服务发现:
+
+```bash
+go run ./rpc/rest/go-server/cmd
+```
+
+在另一个终端运行消费者:
+
+```bash
+go run ./rpc/rest/go-client/cmd
+```
+
+期望输出:
+
+```text
+REST response: userID=101 name=dubbo-go traceID=trace-rest-basic 
message=body-from-dubbo-rest-client greeting="hello dubbo-go, userID=101, 
traceID=trace-rest-basic, message=body-from-dubbo-rest-client"
+```
+
+Provider 同时也是一个普通 HTTP 服务,可以直接用 `curl` 调用:
+
+```bash
+curl -s \
+  -X POST 'http://127.0.0.1:20080/api/v1/users/202/greeting?name=curl' \
+  -H 'Content-Type: application/json' \
+  -H 'Accept: application/json' \
+  -H 'X-Trace-ID: trace-curl' \
+  -d '{"message":"body-from-curl"}'
+```
+
+## REST 映射
+
+Provider URL 只提供网络目标,例如:

Review Comment:
   这里写的是“Provider URL 只提供网络目标”,但示例 URL 里还包含接口名。建议改成“用于标识可调用的 Dubbo 服务端点(地址 + 
接口)”,避免误导为只有 host/port。



##########
rpc/rest/README.md:
##########
@@ -0,0 +1,76 @@
+# Dubbo-Go REST sample
+
+This sample validates the Dubbo-Go REST protocol with direct URL, 
interface-level registry, and application-level service discovery. It uses an 
explicit REST mapping for path, query, header, and body arguments.
+
+## Run
+
+Start the provider with the default Nacos application-level service discovery 
mode:
+
+```bash
+go run ./rpc/rest/go-server/cmd
+```
+
+Run the Dubbo-Go REST consumer in another terminal:
+
+```bash
+go run ./rpc/rest/go-client/cmd
+```
+
+Expected client output:
+
+```text
+REST response: userID=101 name=dubbo-go traceID=trace-rest-basic 
message=body-from-dubbo-rest-client greeting="hello dubbo-go, userID=101, 
traceID=trace-rest-basic, message=body-from-dubbo-rest-client"
+```
+
+The same provider is also a normal HTTP endpoint:
+
+```bash
+curl -s \
+  -X POST 'http://127.0.0.1:20080/api/v1/users/202/greeting?name=curl' \
+  -H 'Content-Type: application/json' \
+  -H 'Accept: application/json' \
+  -H 'X-Trace-ID: trace-curl' \
+  -d '{"message":"body-from-curl"}'
+```
+
+## What this proves
+
+The provider URL only supplies the network target, for example 
`rest://127.0.0.1:20080/org.apache.dubbo.samples.rest.GreetingService`.

Review Comment:
   This sentence says the provider URL "only supplies the network target", but 
the example URL also includes the Dubbo interface name. Reword it to avoid 
implying the URL is just host/port, while keeping the key point that HTTP 
mapping comes from `api/rest_config.go`.



##########
README.md:
##########
@@ -70,6 +70,7 @@ Please refer to [HOWTO.md](HOWTO.md) for detailed 
instructions on running the sa
   * `rpc/jsonrpc`: JSON-RPC protocol example.
   * `rpc/triple`: Triple protocol example with multiple serialization formats.
   * `rpc/triple/openapi`: Demonstrates how to enable OpenAPI documentation for 
Triple protocol services, including versioned services and non-IDL services.
+  * `rpc/rest`: Rest protocol example.

Review Comment:
   Use the standard acronym capitalization for the REST protocol to keep the 
list consistent with other entries (e.g., JSON-RPC, gRPC, OpenAPI).



##########
README_CN.md:
##########
@@ -70,6 +70,7 @@
   * `rpc/jsonrpc`:基于 JSON-RPC 协议的示例。
   * `rpc/triple`:Triple 协议示例,涵盖多种序列化方式。
   * `rpc/triple/openapi`:演示如何为 Triple 协议服务启用 OpenAPI 文档,包括多版本服务和非 IDL 服务的注册。
+  * `rpc/rest`:基于 Rest 协议的示例。

Review Comment:
   这里建议把协议名统一用缩写大写“REST”,与其它条目(JSON-RPC、gRPC、OpenAPI 等)的写法一致。



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to