-
-
Notifications
You must be signed in to change notification settings - Fork 5.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Higher fidelity imports #21114
Higher fidelity imports #21114
Conversation
PosterID int64 `yaml:"poster_id"` | ||
PosterName string `yaml:"poster_name"` | ||
PosterEmail string `yaml:"poster_email"` | ||
Created time.Time | ||
Updated time.Time | ||
Content string | ||
Reactions []*Reaction | ||
Meta map[string]interface{} `yaml:"meta,omitempty"` // see models/issues/comment.go for fields in Comment struct |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How does the value of Meta gets updated? I can only see some code reading it, but I can not find code writing it.
If let me decide, I would use clear field names instead of the dynamic map: the field names are clearly known, the dynamic map make the code like a dynamic language which loses the static compiling time check
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is written to via custom tooling to comments.yml and used during "restore-repo" CLI command.
I used an interface because this in theory could be extended to fit each field in the comments struct and I can import that struct due to cyclical imports.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is written to via custom tooling to comments.yml and used during "restore-repo" CLI command.
Is there a related PR to show how to use it?
I used an interface because this in theory could be extended to fit each field in the comments struct and I can import that struct due to cyclical imports.
I do not think the "in theory could be extended to fit each field" could really work with a dynamic map. In the end, on the reader side, every field is still pre-defined and clearly hard-coded in code. If it is the case, why not put some pointers like: AssigneeID *uint64
, OldTitle *string
.
closing in favour of #22510 |
Currently if you want to track the history of various things when importing, they'd be added in as comments (ie, x added y label to issue).
This allows for additional fields in yaml, specifically
issue comment type
, as well as an interface rather than having to re-iterate all the ones that exist in the comment struct already.