You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We've recently moved from an on premise Jira Server to Jira Cloud and I'm currently updating an internal tool to be compatible. One of the issues I've faced is that issues are not being mapped successfully when loading them:
Fatal error: Uncaught TypeError: JiraCloud\ADF\AtlassianDocumentFormat::__construct(): Argument #1 ($document) must be of type DH\Adf\Node\Block\Document|DH\Adf\Node\Node, string given, called in .../vendor/netresearch/jsonmapper/src/JsonMapper.php on line 653 and defined in .../vendor/lesstif/jira-cloud-restapi/src/ADF/AtlassianDocumentFormat.php:21
Stack trace:
#0 .../vendor/netresearch/jsonmapper/src/JsonMapper.php(653): JiraCloud\ADF\AtlassianDocumentFormat->__construct('h3. Hintergrund...')
#1 .../vendor/netresearch/jsonmapper/src/JsonMapper.php(292): JsonMapper->createInstance('\\JiraCloud\\ADF\\...', true, 'h3. Hintergrund...')
#2 .../vendor/netresearch/jsonmapper/src/JsonMapper.php(295): JsonMapper->map(Object(stdClass), Object(JiraCloud\Issue\IssueField))
#3 .../vendor/netresearch/jsonmapper/src/JsonMapper.php(449): JsonMapper->map(Object(stdClass), Object(JiraCloud\Issue\Issue))
I can fix this for now by changing the type of \JiraCloud\Issue\IssueField::$description and the signature of \JiraCloud\Issue\IssueField::setDescription to use ?string instead of ?AtlassianDocumentFormat and get it working for now. However I assume that once I process issues that were created in Jira Cloud rather than migrated, this will fail again.
So basically a stable fix would require \JiraCloud\Issue\IssueField::$description to be of type AtlassianDocumentFormat|string|null and somehow get JsonMapper to support intersection types, trying each of them and picking the one that's mapped successfully.
The text was updated successfully, but these errors were encountered:
Hi @mayrn-techdivision Sorry for the late reply.
Unfortunately, Jason mapper does not support the multiple instance types during serialize/deserialize.
So I suppose that I need to separate the setter function as two, for example.
// for mapper when fetching from the Jira CloudpublicfunctionsetDescription(?string$description): static
{
}
// setterpublicfunctionsetDescriptionByADF(?AtlassianDocumentFormat$description): static
{
}
Hi @aaronflorey Could you share more information about this? for instance, when do you meet this error? which library version do you use?
and could you share your code with me, please? because I can't recreate the above error on my side.
We've recently moved from an on premise Jira Server to Jira Cloud and I'm currently updating an internal tool to be compatible. One of the issues I've faced is that issues are not being mapped successfully when loading them:
I can fix this for now by changing the type of
\JiraCloud\Issue\IssueField::$description
and the signature of\JiraCloud\Issue\IssueField::setDescription
to use?string
instead of?AtlassianDocumentFormat
and get it working for now. However I assume that once I process issues that were created in Jira Cloud rather than migrated, this will fail again.So basically a stable fix would require
\JiraCloud\Issue\IssueField::$description
to be of typeAtlassianDocumentFormat|string|null
and somehow get JsonMapper to support intersection types, trying each of them and picking the one that's mapped successfully.The text was updated successfully, but these errors were encountered: