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

Fixed empty result for jira_issue_comment with id filters Closes #137 #138

Merged
merged 2 commits into from
Sep 25, 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
11 changes: 9 additions & 2 deletions jira/table_jira_issue.go
Original file line number Diff line number Diff line change
Expand Up @@ -258,8 +258,15 @@ func listIssues(ctx context.Context, d *plugin.QueryData, _ *plugin.HydrateData)
Expand: "names",
}

jql := buildJQLQueryFromQuals(d.Quals, d.Table.Columns)
plugin.Logger(ctx).Debug("jira_issue.listIssues", "JQL", jql)
jql := ""

// The "jira_issue_comment" table is a child of the "jira_issue" table. When querying the child table, the parent table is executed first.
// This restriction is necessary to correctly build the input parameters when querying only the "jira_issue" table.
// Without this check, a query like "select title, id, issue_id, body from jira_issue_comment where issue_id = '10015'" will fail with an error.
// Error: jira: request failed. Please analyze the request body for more details. Status code: 400: could not parse JSON: unexpected end of JSON input
if d.Table.Name == "jira_issue" {
jql = buildJQLQueryFromQuals(d.Quals, d.Table.Columns)
}

for {
searchResult, res, err := searchWithContext(ctx, d, jql, &options)
Expand Down
2 changes: 1 addition & 1 deletion jira/table_jira_issue_comment.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ func tableIssueComment(_ context.Context) *plugin.Table {
Name: "jira_issue_comment",
Description: "Comments that provided in issue.",
Get: &plugin.GetConfig{
KeyColumns: plugin.AnyColumn([]string{"issue_id", "id"}),
KeyColumns: plugin.AllColumns([]string{"issue_id", "id"}),
Hydrate: getIssueComment,
},
List: &plugin.ListConfig{
Expand Down
Loading