[feat] Add REST protocol samples#1109
Open
Alanxtl wants to merge 4 commits into
Open
Conversation
AlexStocks
reviewed
Jul 11, 2026
| panic(err) | ||
| } | ||
|
|
||
| fmt.Printf("REST response: userID=%d name=%s traceID=%s message=%s greeting=%q\n", |
Contributor
There was a problem hiding this comment.
[P1] 样例已引入工程 Logger,但成功路径仍直接使用 fmt.Printf。这会绕过统一日志级别、格式和输出目标;请改为 logger.Infof,并移除不再需要的 fmt 依赖(若其他位置未使用)。
Contributor
|
@Alanxtl 有空修复下 ci 流程失败和我给你留的 comment |
Contributor
There was a problem hiding this comment.
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/restsample 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.
|
|
||
| ## 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`. |
|
|
||
| ## REST 映射 | ||
|
|
||
| Provider URL 只提供网络目标,例如: |
| * `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. |
| * `rpc/jsonrpc`:基于 JSON-RPC 协议的示例。 | ||
| * `rpc/triple`:Triple 协议示例,涵盖多种序列化方式。 | ||
| * `rpc/triple/openapi`:演示如何为 Triple 协议服务启用 OpenAPI 文档,包括多版本服务和非 IDL 服务的注册。 | ||
| * `rpc/rest`:基于 Rest 协议的示例。 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.