NeverENG opened a new pull request, #3500:
URL: https://github.com/apache/dubbo-go/pull/3500

   ### What this PR does
   
   Part of #3472 (泛化调用优化). This PR covers the `client` + config-validation 
slice: it makes an unknown generic mode fail fast at reference-creation time 
instead of silently falling back to the Map generalizer at runtime, and 
clarifies the generic-call configuration API.
   
   ### Changes
   
   - **`internal/config.go`**: add `ValidateGenericType`, accepting `true` / 
`gson` / `protobuf-json` / `bean` (case-insensitive; empty = non-generic). 
`protobuf` is kept as a legacy compatibility value and is not recommended. 
Unknown values return a clear error.
   - **`client/options.go`**:
     - wire the validation into `ReferenceOptions.init`, so 
`WithGenericType("bad-type")` is rejected when the reference is created.
     - add `WithGenericIncludeClass(bool)` to control the `class` field of Map 
(`generic=true`) results without relying on global config.
     - rewrite `WithGenericType` docs to distinguish **generic mode** 
(generalization format) from **transport serialization** (on-the-wire encoding).
   - **`client/client.go`**: document `NewGenericService` defaults (generic 
mode `true`/Map, transport serialization Hessian2) and that the two settings 
are independent.
   - **`internal/config_test.go`**: table-driven tests covering all valid 
modes, case-insensitivity, empty, and an unknown value.
   
   ### Acceptance criteria (from #3472 §3/§4)
   
   - [x] `NewGenericService(..., WithGenericType("bad-type"))` returns a clear 
error instead of falling back.
   - [x] generic mode vs transport serialization documented and disambiguated.
   - [x] `generic.include.class` exposed via a user-side API 
(`WithGenericIncludeClass`).
   - [x] `protobuf` retained as a documented legacy-compat value.
   
   ### Note for reviewers
   
   The valid-mode set here (`true`/`gson`/`protobuf-json`/`bean` + legacy 
`protobuf`) must stay aligned with `filter/generic/util.go` and 
`protocol/triple/triple.go`, which are handled in separate slices of #3472.
   
   ### Verification
   
   `go build ./...` and `go test ./internal/ ./client/` pass locally.
   
   🤖 Generated with [Claude Code](https://claude.com/claude-code)


-- 
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