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

Invalid content type "bulletList" for block node "blockquote" #13

Open
mzeis opened this issue Aug 16, 2024 · 0 comments
Open

Invalid content type "bulletList" for block node "blockquote" #13

mzeis opened this issue Aug 16, 2024 · 0 comments

Comments

@mzeis
Copy link

mzeis commented Aug 16, 2024

Hi,

First: thank you a lot for this open-sourcing this package! I learned about it by working with https://github.com/lesstif/php-JiraCloud-RESTAPI.

When I fetch issues from Jira Cloud using said library, and I further process them, for some of them, I get an exception like this:

In BlockNode.php line 65:
                                                                  
  [InvalidArgumentException]                                      
  Invalid content type "bulletList" for block node "blockquote".  
                                                                  

Exception trace:
  at /var/www/vendor/damienharper/adf-tools/src/Node/BlockNode.php:65
 DH\Adf\Node\BlockNode->append() at /var/www/vendor/damienharper/adf-tools/src/Node/BlockNode.php:43
 DH\Adf\Node\BlockNode::load() at /var/www/vendor/damienharper/adf-tools/src/Node/BlockNode.php:41
 DH\Adf\Node\BlockNode::load() at /var/www/src/path/to/my/code/Class.php:54
...

Looking at the documentation page referenced in \DH\Adf\Node\Block\Blockquote, in my understanding "bulletList" should be allowed here:

content must contain array of one or more of the following nodes:

Would it be an option to add bulletList (and orderedList, for which I also got an exception) as an allowed content type to Blockquote?

I did a quick test by adding them:

<?php

declare(strict_types=1);

namespace DH\Adf\Node\Block;

use DH\Adf\Builder\BulletListBuilder;
use DH\Adf\Builder\OrderedListBuilder;
use DH\Adf\Builder\ParagraphBuilder;
use DH\Adf\Node\BlockNode;
use JsonSerializable;

/**
 * @see https://developer.atlassian.com/cloud/jira/platform/apis/document/nodes/blockquote
 */
class Blockquote extends BlockNode implements JsonSerializable
{
    use BulletListBuilder;
    use OrderedListBuilder;
    use ParagraphBuilder;

    protected string $type = 'blockquote';
    protected array $allowedContentTypes = [
        BulletList::class,
        OrderedList::class,
        Paragraph::class,
    ];
}

I got no errors, and the result seems to be correct for my use case, too.

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

1 participant