Skip to content
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

Add default_label_name to JSON output of buf registry module info #3387

Merged
merged 2 commits into from
Oct 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@

## [Unreleased]

- No changes yet.
- Update `buf registry module info --format=json` to add `default_label_name, which provides the name
of the default label of a module.

## [v1.44.0] - 2024-10-03

Expand Down
30 changes: 16 additions & 14 deletions private/buf/bufprint/bufprint.go
Original file line number Diff line number Diff line change
Expand Up @@ -226,13 +226,14 @@ func NewCommitEntity(commit *modulev1.Commit, moduleFullName bufmodule.ModuleFul
// NewModuleEntity returns a new module entity to print.
func NewModuleEntity(module *modulev1.Module, moduleFullName bufmodule.ModuleFullName) Entity {
return outputModule{
ID: module.Id,
Remote: moduleFullName.Registry(),
Owner: moduleFullName.Owner(),
Name: moduleFullName.Name(),
FullName: moduleFullName.String(),
CreateTime: module.CreateTime.AsTime(),
State: module.State.String(),
ID: module.Id,
Remote: moduleFullName.Registry(),
Owner: moduleFullName.Owner(),
Name: moduleFullName.Name(),
FullName: moduleFullName.String(),
CreateTime: module.CreateTime.AsTime(),
State: module.State.String(),
DefaultLabelName: module.GetDefaultLabelName(),
}
}

Expand Down Expand Up @@ -430,13 +431,14 @@ func (c outputCommit) fullName() string {
}

type outputModule struct {
ID string `json:"id,omitempty"`
Remote string `json:"remote,omitempty"`
Owner string `json:"owner,omitempty"`
Name string `json:"name,omitempty"`
FullName string `json:"-" bufprint:"Name"`
CreateTime time.Time `json:"create_time,omitempty" bufprint:"Create Time"`
State string `json:"state,omitempty"`
ID string `json:"id,omitempty"`
Remote string `json:"remote,omitempty"`
Owner string `json:"owner,omitempty"`
Name string `json:"name,omitempty"`
FullName string `json:"-" bufprint:"Name"`
CreateTime time.Time `json:"create_time,omitempty" bufprint:"Create Time"`
State string `json:"state,omitempty"`
DefaultLabelName string `json:"default_label_name,omitempty"`
}

func (m outputModule) fullName() string {
Expand Down