zeroshade commented on code in PR #424: URL: https://github.com/apache/iceberg-go/pull/424#discussion_r2080536584
########## 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: Okay that's fair enough, we should probably rename the argument to be `--fields` then instead :smile: -- 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