Skip to content

[feat] Add REST protocol samples#1109

Open
Alanxtl wants to merge 4 commits into
apache:mainfrom
Alanxtl:add_rest
Open

[feat] Add REST protocol samples#1109
Alanxtl wants to merge 4 commits into
apache:mainfrom
Alanxtl:add_rest

Conversation

@Alanxtl

@Alanxtl Alanxtl commented Jun 1, 2026

Copy link
Copy Markdown
Member

No description provided.

@Alanxtl Alanxtl changed the title [feat] Add REST API samples [feat] Add REST protocol samples Jun 1, 2026
@Alanxtl Alanxtl added the enhancement New feature or request label Jun 2, 2026
panic(err)
}

fmt.Printf("REST response: userID=%d name=%s traceID=%s message=%s greeting=%q\n",

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[P1] 样例已引入工程 Logger,但成功路径仍直接使用 fmt.Printf。这会绕过统一日志级别、格式和输出目标;请改为 logger.Infof,并移除不再需要的 fmt 依赖(若其他位置未使用)。

@AlexStocks
AlexStocks requested a review from Copilot July 19, 2026 11:39
@AlexStocks

Copy link
Copy Markdown
Contributor

@Alanxtl 有空修复下 ci 流程失败和我给你留的 comment

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a new Dubbo-Go REST protocol sample under rpc/rest, including a Go provider/consumer pair and documentation demonstrating direct URL usage plus registry/service-discovery modes. This extends the existing RPC protocol sample set and wires the sample into the repository’s integration test runner and top-level sample indexes.

Changes:

  • Add rpc/rest sample implementation (Go server/client + shared API/config helpers).
  • Add English/Chinese documentation for running the REST sample and explaining REST mapping + discovery modes.
  • Register the new sample in the root READMEs and the integration test suite.

Reviewed changes

Copilot reviewed 10 out of 10 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
start_integrate_test.sh Adds rpc/rest to the integration test sample list.
rpc/rest/README.md Documents how to run the REST sample and what it validates.
rpc/rest/README_CN.md Chinese documentation for the REST sample.
rpc/rest/go-server/cmd/server.go REST provider implementation + registry/discovery flag handling.
rpc/rest/go-client/cmd/client.go REST consumer implementation + direct/registry dialing logic.
rpc/rest/api/rest_config.go Defines REST method mapping (path/query/header/body) via Dubbo-Go REST config.
rpc/rest/api/registry.go Encapsulates registry and registry-type option selection.
rpc/rest/api/greeting.go Shared service/interface constants and request/response DTOs.
README.md Adds rpc/rest entry to the repository sample index.
README_CN.md Adds rpc/rest entry to the Chinese sample index.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread rpc/rest/README.md

## 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`.
Comment thread rpc/rest/README_CN.md

## REST 映射

Provider URL 只提供网络目标,例如:
Comment thread README.md
* `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.
Comment thread README_CN.md
* `rpc/jsonrpc`:基于 JSON-RPC 协议的示例。
* `rpc/triple`:Triple 协议示例,涵盖多种序列化方式。
* `rpc/triple/openapi`:演示如何为 Triple 协议服务启用 OpenAPI 文档,包括多版本服务和非 IDL 服务的注册。
* `rpc/rest`:基于 Rest 协议的示例。
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants