Oxidaner opened a new issue, #3708:
URL: https://github.com/apache/dubbo-go/issues/3708

   ### Problem
   
   PR #3505 made `MapGeneralizer.Realize` use `m` as the `mapstructure` decoder 
tag, preserving compatibility with existing Dubbo-Go users.
   
   However, `MapGeneralizer.Generalize` still treats the complete `m` tag value 
as a field name. As a result, standard mapstructure options are serialized into 
wire keys instead of being interpreted:
   
   ```go
   type Request struct {
       ID       string `m:"id,omitempty"`
       Password string `m:"-"`
   }
   ```
   
   Currently, generalizing this value produces keys such as `id,omitempty` and 
`-`. A field tagged with `,squash` is similarly emitted under the literal key 
`,squash`, while realization already parses the tag name and options through 
mapstructure.
   
   This makes the same `m` tag behave differently in the two directions and 
prevents predictable round trips.
   
   ### Expected behavior
   
   Keep `m` as the Dubbo-Go tag for backward compatibility, but make 
generalization interpret the struct-to-map options supported by the pinned 
mapstructure version:
   
   - `-`: omit the field
   - `omitempty`: omit empty values
   - `squash`: flatten a struct field into its parent map
   
   Direction-specific map-to-struct behavior such as `remain` should continue 
to be handled by mapstructure during realization.
   
   Existing plain `m:"field_name"` tags and untagged lower-camel-case field 
names must remain unchanged.
   
   ### Related
   
   - #3503
   - #3505


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