You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@devlake.apache.org by kl...@apache.org on 2022/07/19 06:54:59 UTC
[incubator-devlake] branch main updated: fix: fix the schema of transformationRules (#2536)
This is an automated email from the ASF dual-hosted git repository.
klesh 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 f8a12121 fix: fix the schema of transformationRules (#2536)
f8a12121 is described below
commit f8a12121f0cd48aa38063c2143b285352962d005
Author: mindlesscloud <li...@merico.dev>
AuthorDate: Tue Jul 19 14:54:55 2022 +0800
fix: fix the schema of transformationRules (#2536)
---
plugins/jira/tasks/issue_extractor.go | 14 +++-----------
plugins/jira/tasks/task_data.go | 12 ++++++------
2 files changed, 9 insertions(+), 17 deletions(-)
diff --git a/plugins/jira/tasks/issue_extractor.go b/plugins/jira/tasks/issue_extractor.go
index 18c25999..6fc28bbe 100644
--- a/plugins/jira/tasks/issue_extractor.go
+++ b/plugins/jira/tasks/issue_extractor.go
@@ -60,19 +60,11 @@ func ExtractIssues(taskCtx core.SubTaskContext) error {
for _, issueType := range issueTypes {
typeIdMapping[issueType.Id] = issueType.UntranslatedName
}
- // prepare getStdType function
- // TODO: implement type mapping
+
stdTypeMappings := make(map[string]string)
- for _, userType := range data.Options.TransformationRules.RequirementTypeMapping {
- stdTypeMappings[userType] = "REQUIREMENT"
- }
- for _, userType := range data.Options.TransformationRules.BugTypeMapping {
- stdTypeMappings[userType] = "BUG"
+ for userType, stdType := range data.Options.TransformationRules.TypeMappings {
+ stdTypeMappings[userType] = strings.ToUpper(stdType.StandardType)
}
- for _, userType := range data.Options.TransformationRules.IncidentTypeMapping {
- stdTypeMappings[userType] = "INCIDENT"
- }
-
extractor, err := helper.NewApiExtractor(helper.ApiExtractorArgs{
RawDataSubTaskArgs: helper.RawDataSubTaskArgs{
Ctx: taskCtx,
diff --git a/plugins/jira/tasks/task_data.go b/plugins/jira/tasks/task_data.go
index 2fc28699..4d765e99 100644
--- a/plugins/jira/tasks/task_data.go
+++ b/plugins/jira/tasks/task_data.go
@@ -27,12 +27,12 @@ import (
)
type TransformationRules struct {
- RequirementTypeMapping []string
- BugTypeMapping []string
- IncidentTypeMapping []string
- EpicKeyField string
- StoryPointField string
- RemotelinkCommitShaPattern string
+ EpicKeyField string `json:"epicKeyField"`
+ StoryPointField string `json:"storyPointField"`
+ RemotelinkCommitShaPattern string `json:"remotelinkCommitShaPattern"`
+ TypeMappings map[string]struct {
+ StandardType string `json:"standardType"`
+ } `json:"typeMappings"`
}
type JiraOptions struct {