Revanth14 commented on code in PR #2361:
URL: https://github.com/apache/iceberg-go/pull/2361#discussion_r4460672610


##########
types.go:
##########
@@ -431,13 +431,28 @@ func (s *StructType) Equals(other Type) bool {
 
 func (s *StructType) Fields() []NestedField { return s.FieldList }
 
-func (s *StructType) MarshalJSON() ([]byte, error) {
-       type Alias StructType
+// The JSON methods of the nested types name every serialized field instead of
+// encoding through an alias of the type, so the wire format does not depend on
+// which Go fields are exported.
 
+func (s *StructType) MarshalJSON() ([]byte, error) {
        return json.Marshal(struct {
-               Type string `json:"type"`
-               *Alias
-       }{Type: s.Type(), Alias: (*Alias)(s)})
+               Type   string        `json:"type"`
+               Fields []NestedField `json:"fields"`
+       }{Type: s.Type(), Fields: s.FieldList})
+}
+
+func (s *StructType) UnmarshalJSON(b []byte) error {

Review Comment:
   Moved it to an aux struct that names every key, so both directions are now 
off the tags. Behaviour is unchanged. The new round-trip guard covers it: 
dropping `Doc` from the decode fails it.
   



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