Skip to content

Commit

Permalink
fix: change language mapping
Browse files Browse the repository at this point in the history
  • Loading branch information
mohamadch91 committed Dec 22, 2024
1 parent 2aa4f42 commit c811992
Show file tree
Hide file tree
Showing 5 changed files with 372 additions and 306 deletions.
2 changes: 2 additions & 0 deletions pkg/sdk/es/resources_clients.go
Original file line number Diff line number Diff line change
Expand Up @@ -3462,6 +3462,7 @@ var listRepositoryFilters = map[string]string{
"owner": "Description.Owner",
"parent": "Description.Parent",
"permissions": "Description.Permissions",
"primary_language": "Description.PrimaryLanguage",
"pushed_at": "Description.PushedAt",
"repo_settings": "Description.RepositorySettings",
"repo_urls": "Description.RepoURLs",
Expand Down Expand Up @@ -3552,6 +3553,7 @@ var getRepositoryFilters = map[string]string{
"owner": "Description.Owner",
"parent": "Description.Parent",
"permissions": "Description.Permissions",
"primary_language": "Description.PrimaryLanguage",
"pushed_at": "Description.PushedAt",
"repo_settings": "Description.RepositorySettings",
"repo_urls": "Description.RepoURLs",
Expand Down
4 changes: 2 additions & 2 deletions provider/describer/repository.go
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ func GetRepository(
// 3) Fetch /languages => map[string]int
langs, err := util_fetchLanguages(sdk, organizationName, repositoryName)
if err == nil && len(langs) > 0 {
finalDetail.LanguageBreakdown = langs
finalDetail.Languages = langs
}

// 4) Enrich with metrics
Expand Down Expand Up @@ -296,7 +296,7 @@ func util_transformToFinalRepoDetail(detail *model.RepoDetail) *model.Repository
PrimaryLanguage: detail.PrimaryLanguage,

// We'll fill in LanguageBreakdown after calling /languages
LanguageBreakdown: nil,
Languages: nil,

RepositorySettings: model.RepositorySettings{
HasDiscussionsEnabled: detail.HasDiscussions,
Expand Down
2 changes: 1 addition & 1 deletion provider/model/model.go
Original file line number Diff line number Diff line change
Expand Up @@ -859,7 +859,7 @@ type RepositoryDescription struct {
Parent *RepositoryDescription `json:"parent"`
Source *RepositoryDescription `json:"source"`
PrimaryLanguage *string `json:"primary_language,omitempty"`
LanguageBreakdown map[string]int `json:"language_breakdown,omitempty"`
Languages map[string]int `json:"languages,omitempty"`
RepositorySettings RepositorySettings `json:"repo_settings"`
SecuritySettings SecuritySettings `json:"security_settings"`
RepoURLs RepoURLs `json:"repo_urls"`
Expand Down
Loading

0 comments on commit c811992

Please sign in to comment.