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

Bulk issues creation (create_issues method) misses errorMessages field in response #1872

Closed
2 of 4 tasks
mariadeluna-tomtom opened this issue Jul 8, 2024 · 1 comment · Fixed by #1854
Closed
2 of 4 tasks

Comments

@mariadeluna-tomtom
Copy link

mariadeluna-tomtom commented Jul 8, 2024

Bug summary

When using create_issues method, only errors key from API response is returned and not errorMessages as well.

This is because in create_issues method only "error" key is kept, not both.
https://github.com/pycontribs/jira/blob/main/jira/client.py#L1919-L1920

for error in raw_issue_json["errors"]:
    errors[error["failedElementNumber"]] = error["elementErrors"]["errors"]

According to JIRA documentation:
image

So errors key is a dict with errors releated to specific fields and errorMessages general errors.

Is there an existing issue for this?

  • I have searched the existing issues

Jira Instance type

Jira Cloud (Hosted by Atlassian)

Jira instance version

No response

jira-python version

3.8.0

Python Interpreter version

3.11

Which operating systems have you used?

  • Linux
  • macOS
  • Windows

Reproduction steps

# 1. Given a Jira client instance
jira: JIRA
# 2. When I call the function with argument issues_list
jira.create_issues(issues_list)
# 3. When there are errors I get empty error key when there was errors in `errorMessages` in raw response:
[
    {
        "status": "Error",
        "error": {},
        "issue": None,
        "input_fields": { (...) },
    },
    {
        "status": "Error",
        "error": {},
        "issue": None,
        "input_fields": { (...) }
    }
]

Stack trace

#Response from REST API /rest/api/2/issue/bulk:

{
"issues": [],
"errors": [
{
	"status": 400,
	"elementErrors": {
		"errorMessages": [
			"Team with id '2542' not found."
		],
		"errors": {}
	},
	"failedElementNumber": 0
},
{
	"status": 400,
	"elementErrors": {
		"errorMessages": [
			"Team with id '2542' not found."
		],
		"errors": {}
	},
	"failedElementNumber": 1
  }
  ]
}

Expected behaviour

Response should be something like:

[
    {
        "status": "Error",
        "error": {},
        "errorMessages": ["Team with id '2542' not found."],
        "issue": None,
        "input_fields": { (...) },
    },
    {
        "status": "Error",
        "error": {},
        "errorMessages": ["Team with id '2542' not found."],
        "issue": None,
        "input_fields": { (...) }
    }
]

Additional Context

No response

@mariadeluna-tomtom mariadeluna-tomtom changed the title Bulk issues creation (create_issues method) misses errorMessages field in response Bulk issues creation (create_issues method) misses errorMessages field in response Jul 10, 2024
@dimitarOnGithub
Copy link

Possibly the same issue as the one reported in #1846

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants