zeroshade commented on code in PR #424: URL: https://github.com/apache/iceberg-go/pull/424#discussion_r2080201687
########## schema.go: ########## @@ -51,6 +51,17 @@ type Schema struct { lazyNameMapping func() NameMapping } +// NewSchemaFromJson constructs a new schema with the provided ID and a string in json form +func NewSchemaFromJson(id int, jsonStr string) (*Schema, error) { + var fields []NestedField + err := json.Unmarshal([]byte(jsonStr), &fields) + if err != nil { + return nil, fmt.Errorf("failed to parse schema JSON: %w", err) + } + + return NewSchema(id, fields...), nil +} Review Comment: do we actually need this function instead of just letting people use `json.Unmarshal(bytes, &schema)` ? -- 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: issues-unsubscr...@iceberg.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: issues-unsubscr...@iceberg.apache.org For additional commands, e-mail: issues-h...@iceberg.apache.org