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

   ### What this PR does
   
   Part of #3472 (??????).
   
   This PR covers the follow-up generic typed-result and public capability 
slice after strict generic mode validation.
   
   Previously, `InvokeWithType` and generic filter response handling did not 
consistently use the configured generic mode. For example, a generic service 
configured with `generic=gson`, `generic=bean`, or `generic=protobuf-json` 
could still have typed result conversion handled like the default Map mode, 
making result conversion errors hard to diagnose.
   
   This PR aligns typed result handling, `InvokeWithType`, Triple generic 
detection, and generic exception recognition with the unified generic mode 
policy.
   
   ### Changes
   
   - `filter/generic/service.go`
     - Add generic mode state to `GenericService`.
     - Add `SetGenericType` and `GenericType`.
     - Make `InvokeWithType` resolve the configured generic mode before typed 
result conversion.
     - Return a clear error when typed result is requested with `generic=false`.
     - Validate unsupported typed-result modes before invoking the remote 
`$invoke` call.
   
   - `client/client.go`
     - Sync the final reference generic mode from `NewGenericService` into 
`GenericService`.
     - Ensure `client.WithGenericType(...)` affects `InvokeWithType` typed 
result conversion.
   
   - `filter/generic/filter.go`
     - Make `OnResponse` use the resolved generic mode for typed reply 
conversion.
     - Support typed reply conversion for `true`, `gson`, `bean`, and 
`protobuf-json`.
     - Return explicit errors when typed reply realization or assignment fails.
   
   - `filter/generic/util.go`
     - Add shared typed result helpers.
     - Add mode-aware typed result detection.
     - Add safer realized-result assignment for pointer/value conversion cases.
   
   - `internal/config.go`
     - Keep `generic=false` as a valid configuration value for disabling 
generic calls.
     - Preserve the distinction between "valid config value" and "generic 
invocation mode".
   
   - `protocol/triple/triple.go`
     - Reuse `internal.IsGenericMode` for Triple generic call detection.
     - Recognize `bean` as a Triple generic mode.
     - Keep legacy `protobuf` compatibility.
   
   - `filter/generic/exception.go`
     - Expose `GenericException` from `filter/generic`.
     - Expose `ToGenericException` for generic invoke exception recognition.
   
   - Tests
     - Cover `InvokeWithType` typed result behavior for `true`, `gson`, `bean`, 
and `protobuf-json`.
     - Cover `generic=false` typed result rejection before remote invocation.
     - Cover `OnResponse` typed reply behavior for supported modes.
     - Cover typed reply deserialization error handling.
     - Cover Triple generic mode detection for `bean` and legacy `protobuf`.
     - Cover public `GenericException` recognition.
   
   ### Note for reviewers
   
   This PR is the PR-2 follow-up for #3501 .
   
   The previous strict-validation PR rejected unsupported generic modes and 
removed silent fallback behavior. This PR builds on that by making typed result 
conversion and public generic helpers follow the same generic mode semantics.
   
   `protobuf` is still accepted as a legacy compatibility value, but new 
API/documentation should prefer `protobuf-json` when protobuf JSON behavior is 
intended.
   
   `generic=false` remains valid and means generic invocation is disabled. It 
is intentionally not treated as a generic invocation mode.
   
   ### Verification
   
   ```bash
   go test ./filter/generic
   go test ./filter/generic/generalizer
   go test ./internal
   go test ./protocol/triple
   go test ./protocol/dubbo/impl
   go test ./protocol/dubbo/hessian2
   go test ./client
   Also ran:
   go test ./...
   
   ---
   Restored from closed PR #3594 after the fork develop branch was accidentally 
synced with upstream using discard commits.


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