Revanth14 opened a new pull request, #2361: URL: https://github.com/apache/iceberg-go/pull/2361
## Problem `StructType` decodes through the exported `FieldList` tag, and `ListType` / `MapType` encode through an alias of their exported fields. Deep immutability of schema types (#2062) unexports those fields, and then encoding silently drops them: a struct decodes to an empty field list with no error. ## Fix `StructType` gets explicit `MarshalJSON` / `UnmarshalJSON`, and `ListType` / `MapType` get explicit `MarshalJSON`. Their `UnmarshalJSON` already used aux structs. The encoded bytes are unchanged, key order included. As a side effect, a failed `StructType` decode no longer leaves a partially decoded field list behind, which matches `NestedField.UnmarshalJSON`. ## Testing `TestNestedTypeJSONWireFormat` pins the exact bytes for a schema nesting all three types, with required and optional children, docs and defaults; it passes unchanged on main. With every field of the three types tagged `json:"-"` (what `encoding/json` sees once they are unexported), main fails `TestStructType`, `TestListType`, `TestMapType`, `TestUnknownTypeInNestedStructs` and the new tests, and this branch passes all of them. ## Context Step 1 of the deep-immutability series in #2062. -- 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]
