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

Field 'descriptionV3' cannot be set. It is not on the appropriate screen, or unknown. #457

Closed
lucasaba opened this issue Jul 18, 2022 · 3 comments

Comments

@lucasaba
Copy link

I'm trying to create a new Issue. I'm a cloud user and using V3 of the API.

I tried to add the description to the IssueField but Jira says that description":"Operation value must be an Atlassian Document (see the Atlassian Document Format). I then tried with IssuFieldV3.

$issueField = new IssueFieldV3();
$description = new DescriptionV3();
$description->addDescriptionContent('paragraph', $summary);
$issueField->setProjectKey($projectKey)
    ->setSummary($summary)
    ->setIssueTypeAsString('Task')
    ->addComponentsAsArray($components)
    ->setDescriptionV3($description)
;

Now it says "descriptionV3":"Field 'descriptionV3' cannot be set. It is not on the appropriate screen, or unknown."

I'm using v4.0.4 of php-jira-rest-client and PHP 8.1.2.

Could I try to "force" to use "description" label in DescriptionV3 serialization ?

@lucasaba
Copy link
Author

lucasaba commented Jul 18, 2022

Editing src/Issue/IssueFieldV3.php and adding the following method (really a ugly code....):

    #[\ReturnTypeWillChange]
    public function jsonSerialize()
    {
        $result = parent::jsonSerialize();
        $result['description'] = $result['descriptionV3'];
        unset($result['descriptionV3']);
        return $result;
    }

solves the issue.

@lesstif
Copy link
Owner

lesstif commented Jul 24, 2022

Hi @lucasaba, Thank you for your comments.

I changed the code based on your suggestion, could you check the code works well, please?

@lucasaba
Copy link
Author

Hi @lesstif , works like a charm! Thank you very much!

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

No branches or pull requests

2 participants