You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@devlake.apache.org by zh...@apache.org on 2022/09/19 12:09:45 UTC
[incubator-devlake] branch main updated: fix: add json tag for apiresponse (#3124)
This is an automated email from the ASF dual-hosted git repository.
zhangliang2022 pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/incubator-devlake.git
The following commit(s) were added to refs/heads/main by this push:
new b05e4955 fix: add json tag for apiresponse (#3124)
b05e4955 is described below
commit b05e4955bcdfc80eb7ad3179554176f4f157ee18
Author: tsoc <47...@users.noreply.github.com>
AuthorDate: Mon Sep 19 20:09:41 2022 +0800
fix: add json tag for apiresponse (#3124)
* fix: add json tag for apiresponse
* fix: add json tag
* fix: change style of imports
* fix: change imports style
---
plugins/bitbucket/tasks/issue_comment_extractor.go | 25 ++++++++-------
plugins/bitbucket/tasks/issue_extractor.go | 36 ++++++++-------------
plugins/bitbucket/tasks/pr_comment_extractor.go | 29 +++++++++--------
plugins/bitbucket/tasks/pr_extractor.go | 37 ++++++++++++++--------
plugins/bitbucket/tasks/repo_extractor.go | 35 ++++++++++----------
5 files changed, 81 insertions(+), 81 deletions(-)
diff --git a/plugins/bitbucket/tasks/issue_comment_extractor.go b/plugins/bitbucket/tasks/issue_comment_extractor.go
index 7069b893..24b1d5ab 100644
--- a/plugins/bitbucket/tasks/issue_comment_extractor.go
+++ b/plugins/bitbucket/tasks/issue_comment_extractor.go
@@ -19,11 +19,12 @@ package tasks
import (
"encoding/json"
+ "time"
+
"github.com/apache/incubator-devlake/errors"
"github.com/apache/incubator-devlake/plugins/bitbucket/models"
"github.com/apache/incubator-devlake/plugins/core"
"github.com/apache/incubator-devlake/plugins/helper"
- "time"
)
type BitbucketIssueCommentsResponse struct {
@@ -32,27 +33,27 @@ type BitbucketIssueCommentsResponse struct {
CreatedOn time.Time `json:"created_on"`
UpdatedOn *time.Time `json:"updated_on"`
Content struct {
- Type string
+ Type string `json:"type"`
Raw string `json:"raw"`
} `json:"content"`
- User *BitbucketAccountResponse
+ User *BitbucketAccountResponse `json:"user"`
Issue struct {
- Type string
- Id int
- Repository *BitbucketApiRepo
+ Type string `json:"type"`
+ Id int `json:"id"`
+ Repository *BitbucketApiRepo `json:"repository"`
Links struct {
Self struct {
- Href string
- }
- }
- Title string
+ Href string `json:"href"`
+ } `json:"self"`
+ } `json:"links"`
+ Title string `json:"title"`
}
Links struct {
Self struct {
- Href string
+ Href string `json:"href"`
} `json:"self"`
Html struct {
- Href string
+ Href string `json:"href"`
} `json:"html"`
} `json:"links"`
}
diff --git a/plugins/bitbucket/tasks/issue_extractor.go b/plugins/bitbucket/tasks/issue_extractor.go
index 5811b7a7..1bda1b6f 100644
--- a/plugins/bitbucket/tasks/issue_extractor.go
+++ b/plugins/bitbucket/tasks/issue_extractor.go
@@ -19,38 +19,37 @@ package tasks
import (
"encoding/json"
- "github.com/apache/incubator-devlake/errors"
- "regexp"
"time"
+ "github.com/apache/incubator-devlake/errors"
"github.com/apache/incubator-devlake/plugins/bitbucket/models"
"github.com/apache/incubator-devlake/plugins/core"
"github.com/apache/incubator-devlake/plugins/helper"
)
type IssuesResponse struct {
- Type string `json:"type"`
- BitbucketId int `json:"id"`
- Repository *BitbucketApiRepo
+ Type string `json:"type"`
+ BitbucketId int `json:"id"`
+ Repository *BitbucketApiRepo `json:"repository"`
Links struct {
Self struct {
- Href string
+ Href string `json:"href"`
} `json:"self"`
Html struct {
- Href string
+ Href string `json:"href"`
} `json:"html"`
} `json:"links"`
Title string `json:"title"`
Content struct {
- Type string
- Raw string
+ Type string `json:"type"`
+ Raw string `json:"raw"`
} `json:"content"`
- Reporter *BitbucketAccountResponse
- Assignee *BitbucketAccountResponse
- State string `json:"state"`
- Kind string `json:"kind"`
+ Reporter *BitbucketAccountResponse `json:"reporter"`
+ Assignee *BitbucketAccountResponse `json:"assignee"`
+ State string `json:"state"`
+ Kind string `json:"kind"`
Milestone *struct {
- Id int
+ Id int `json:"id"`
} `json:"milestone"`
Component string `json:"component"`
Priority string `json:"priority"`
@@ -60,15 +59,6 @@ type IssuesResponse struct {
BitbucketUpdatedAt time.Time `json:"updated_on"`
}
-type IssueRegexes struct {
- SeverityRegex *regexp.Regexp
- ComponentRegex *regexp.Regexp
- PriorityRegex *regexp.Regexp
- TypeBugRegex *regexp.Regexp
- TypeRequirementRegex *regexp.Regexp
- TypeIncidentRegex *regexp.Regexp
-}
-
var ExtractApiIssuesMeta = core.SubTaskMeta{
Name: "extractApiIssues",
EntryPoint: ExtractApiIssues,
diff --git a/plugins/bitbucket/tasks/pr_comment_extractor.go b/plugins/bitbucket/tasks/pr_comment_extractor.go
index 034f0fe4..e44cb538 100644
--- a/plugins/bitbucket/tasks/pr_comment_extractor.go
+++ b/plugins/bitbucket/tasks/pr_comment_extractor.go
@@ -19,11 +19,12 @@ package tasks
import (
"encoding/json"
+ "time"
+
"github.com/apache/incubator-devlake/errors"
"github.com/apache/incubator-devlake/plugins/bitbucket/models"
"github.com/apache/incubator-devlake/plugins/core"
"github.com/apache/incubator-devlake/plugins/helper"
- "time"
)
var ExtractApiPrCommentsMeta = core.SubTaskMeta{
@@ -40,12 +41,12 @@ type BitbucketPrCommentsResponse struct {
CreatedOn time.Time `json:"created_on"`
UpdatedOn *time.Time `json:"updated_on"`
Content struct {
- Type string
- Raw string
+ Type string `json:"type"`
+ Raw string `json:"raw"`
} `json:"content"`
- User *BitbucketAccountResponse
- Deleted bool
- Type string `json:"type"`
+ User *BitbucketAccountResponse `json:"user"`
+ Deleted bool `json:"deleted"`
+ Type string `json:"type"`
Links struct {
Self struct {
Href string
@@ -55,17 +56,17 @@ type BitbucketPrCommentsResponse struct {
} `json:"html"`
} `json:"links"`
PullRequest struct {
- Type string
- Id int
- Title string
+ Type string `json:"type"`
+ Id int `json:"id"`
+ Title string `json:"title"`
Links struct {
Self struct {
- Href string
- }
+ Href string `json:"href"`
+ } `json:"self"`
Html struct {
- Href string
- }
- }
+ Href string `json:"href"`
+ } `json:"html"`
+ } `json:"links"`
}
}
diff --git a/plugins/bitbucket/tasks/pr_extractor.go b/plugins/bitbucket/tasks/pr_extractor.go
index cff84aa2..c55283bc 100644
--- a/plugins/bitbucket/tasks/pr_extractor.go
+++ b/plugins/bitbucket/tasks/pr_extractor.go
@@ -19,11 +19,12 @@ package tasks
import (
"encoding/json"
+ "time"
+
"github.com/apache/incubator-devlake/errors"
"github.com/apache/incubator-devlake/plugins/bitbucket/models"
"github.com/apache/incubator-devlake/plugins/core"
"github.com/apache/incubator-devlake/plugins/helper"
- "time"
)
var ExtractApiPullRequestsMeta = core.SubTaskMeta{
@@ -44,38 +45,46 @@ type BitbucketApiPullRequest struct {
Title string `json:"title"`
Description string `json:"description"`
MergeCommit *struct {
- Type string
+ Type string `json:"type"`
Hash string `json:"hash"`
Links *struct {
- Self struct{ Href string }
- Html struct{ Href string }
- }
+ Self struct {
+ Href string `json:"href"`
+ } `json:"self"`
+ Html struct {
+ Href string `json:"href"`
+ } `json:"html"`
+ } `json:"links"`
} `json:"merge_commit"`
Links *struct {
- Self struct{ Href string }
- Html struct{ Href string }
- }
+ Self struct {
+ Href string `json:"href"`
+ } `json:"self"`
+ Html struct {
+ Href string `json:"href"`
+ } `json:"html"`
+ } `json:"links"`
ClosedBy *BitbucketAccountResponse `json:"closed_by"`
Author *BitbucketAccountResponse `json:"author"`
BitbucketCreatedAt time.Time `json:"created_on"`
BitbucketUpdatedAt time.Time `json:"updated_on"`
BaseRef *struct {
Branch struct {
- Name string
+ Name string `json:"name"`
} `json:"branch"`
Commit struct {
- Type string
- Hash string
+ Type string `json:"type"`
+ Hash string `json:"hash"`
} `json:"commit"`
Repo *BitbucketApiRepo `json:"repository"`
} `json:"destination"`
HeadRef *struct {
Branch struct {
- Name string
+ Name string `json:"name"`
} `json:"branch"`
Commit struct {
- Type string
- Hash string
+ Type string `json:"type"`
+ Hash string `json:"hash"`
} `json:"commit"`
Repo *BitbucketApiRepo `json:"repository"`
} `json:"source"`
diff --git a/plugins/bitbucket/tasks/repo_extractor.go b/plugins/bitbucket/tasks/repo_extractor.go
index b6a40cf3..d79f5c36 100644
--- a/plugins/bitbucket/tasks/repo_extractor.go
+++ b/plugins/bitbucket/tasks/repo_extractor.go
@@ -20,9 +20,9 @@ package tasks
import (
"encoding/json"
"fmt"
- "github.com/apache/incubator-devlake/errors"
"time"
+ "github.com/apache/incubator-devlake/errors"
"github.com/apache/incubator-devlake/plugins/bitbucket/models"
"github.com/apache/incubator-devlake/plugins/core"
"github.com/apache/incubator-devlake/plugins/helper"
@@ -40,31 +40,30 @@ type ApiRepoResponse BitbucketApiRepo
type BitbucketApiRepo struct {
BitbucketId string
- Scm string `json:"scm"`
- HasWiki bool `json:"has_wiki"`
+ Scm string `json:"scm"`
+ HasWiki bool `json:"has_wiki"`
+ Uuid string `json:"uuid"`
+ FullName string `json:"full_name"`
+ Language string `json:"language"`
+ Description string `json:"description"`
+ Type string `json:"type"`
+ HasIssue bool `json:"has_issue"`
+ ForkPolicy string `json:"fork_policy"`
+ Owner models.BitbucketAccount `json:"owner"`
+ CreatedAt time.Time `json:"created_on"`
+ UpdatedAt *time.Time `json:"updated_on"`
Links struct {
Clone []struct {
- Href string
- Name string
+ Href string `json:"href"`
+ Name string `json:"name"`
} `json:"clone"`
Self struct {
- Href string
+ Href string `json:"href"`
} `json:"self"`
-
Html struct {
- Href string
+ Href string `json:"href"`
} `json:"html"`
} `json:"links"`
- Uuid string `json:"uuid"`
- FullName string `json:"full_name"`
- Language string `json:"language"`
- Description string `json:"description"`
- Type string `json:"type"`
- HasIssue bool `json:"has_issue"`
- ForkPolicy string `json:"fork_policy"`
- Owner models.BitbucketAccount
- CreatedAt time.Time `json:"created_on"`
- UpdatedAt *time.Time `json:"updated_on"`
}
func ExtractApiRepositories(taskCtx core.SubTaskContext) errors.Error {