Incorrect Schema for table component

Created on 3 September 2024, 5 months ago

Problem/Motivation

Rendering a table with the properties defined results in an error:

The website encountered an unexpected error. Try again later.

JsonSchema\Exception\InvalidArgumentException: Unable to encode schema array as JSON: Recursion detected in JsonSchema\Constraints\BaseConstraint::arrayToObjectRecursive() (line 143 of /var/www/html/vendor/justinrainbow/json-schema/src/JsonSchema/Constraints/BaseConstraint.php).

I saw a similar closed issue ๐Ÿ› Incorrect schema for table component Fixed , and if this was fixed properly, it seems to be broken again.

Steps to reproduce

Navigate to a node creation form that contains a table (like for a multivalue field)

Proposed resolution

Not sure exactly what update needs to occur. But can confirm that deleting all of the properties from the table.component.yml file allows the node creation form to at least render without a fatal error.

Remaining tasks

User interface changes

API changes

Data model changes

๐Ÿ› Bug report
Status

Active

Version

6.0

Component

Code

Created by

๐Ÿ‡บ๐Ÿ‡ธUnited States MegaKeegMan

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

  • Issue created by @MegaKeegMan
  • ๐Ÿ‡บ๐Ÿ‡ธUnited States MegaKeegMan
  • ๐Ÿ‡บ๐Ÿ‡ธUnited States MegaKeegMan
  • ๐Ÿ‡บ๐Ÿ‡ธUnited States MegaKeegMan
  • If it is of any help I found a recursive element that causes json_encode to fail:

    $props_raw['rows'][0]['cells'][1]['content']['source']['#groups']['advanced'][0]['alias']['#groups']);

    With '#groups' recurring forever

  • Status changed to Postponed: needs info 4 months ago
  • Hey Keegan and lelkneralfaro, I couldn't recreate the issue but I suspect the issue could be due to most of the cells in a component accepts type: array

    Could you maybe help out by removing each part and test again to pinpoint the issue or update me on how to proceed to recreate the issue, thanks

  • ๐Ÿ‡จ๐Ÿ‡ฆCanada sanogo zie ahmed Montreal

    Hi, I am having the same issue while trying to edit a node on the front end.
    The user has the role authenticated, he is the author of the node as well.
    Switching to another front-end theme: Olivero, the user is able to edit his node properly.
    So the issue is definitely with the radix themes (both base theme and sub-theme).

  • ๐Ÿ‡บ๐Ÿ‡ธUnited States plato1123

    Having this problem with Radix too.

    JsonSchema\Exception\InvalidArgumentException: Unable to encode schema array as JSON: Recursion detected in JsonSchema\Constraints\BaseConstraint::arrayToObjectRecursive() (line 143 of /app/vendor/justinrainbow/json-schema/src/JsonSchema/Constraints/BaseConstraint.php).

    #0 /app/web/core/lib/Drupal/Core/Theme/Component/ComponentValidator.php(168): JsonSchema\Constraints\BaseConstraint::arrayToObjectRecursive(Array)
    #1 /app/web/core/lib/Drupal/Core/Template/ComponentsTwigExtension.php(127): Drupal\Core\Theme\Component\ComponentValidator->validateProps(Array, Object(Drupal\Core\Plugin\Component))
    #2 /app/web/core/lib/Drupal/Core/Template/ComponentsTwigExtension.php(109): Drupal\Core\Template\ComponentsTwigExtension->doValidateProps(Array, 'radix:table')
    #3 /app/web/sites/default/files/php/twig/67240bf11ea89_radix:table_4PZKCh15oUHzeCf2xm0OEi8YR/WLnEiLfiC0Cur8N-Ukx7ffndasfSTjht-WGN_2hVa0s.php(51): Drupal\Core\Template\ComponentsTwigExtension->validateProps(Array, 'radix:table')
    #4 /app/vendor/twig/twig/src/Template.php(393): __TwigTemplate_a127c9ba4bbea91988db2aeb570ccdb8->doDisplay(Array, Array)
    #5 /app/web/sites/default/files/php/twig/67240bf11ea89_table.html.twig_SPCn8rAg4ZXvnQ7Is2CPdFRhf/ez73NhjRatpgM8YBuIX6ufYeswDIJNlEu6foCbMPa2o.php(44): Twig\Template->yield(Array)
    #6 /app/vendor/twig/twig/src/Template.php(393): __TwigTemplate_ac01de880e7516bacf4a37257cbb9a87->doDisplay(Array, Array)
    #7 /app/vendor/twig/twig/src/Template.php(349): Twig\Template->yield(Array, Array)
    #8 /app/vendor/twig/twig/src/Template.php(364): Twig\Template->display(Array)
    #9 /app/vendor/twig/twig/src/TemplateWrapper.php(35): Twig\Template->render(Array)
    #10 /app/web/core/themes/engines/twig/twig.engine(33): Twig\TemplateWrapper->render(Array)
    #11 /app/web/core/lib/Drupal/Core/Theme/ThemeManager.php(348): twig_render_template('themes/custom/B...', Array)
    #12 /app/web/core/lib/Drupal/Core/Render/Renderer.php(491): Drupal\Core\Theme\ThemeManager->render('table', Array)
    #13 /app/web/core/lib/Drupal/Core/Render/Renderer.php(248): Drupal\Core\Render\Renderer->doRender(Array, false)
    #14 /app/web/core/lib/Drupal/Core/Template/TwigExtension.php(476): Drupal\Core\Render\Renderer->render(Array)
    #15 /app/web/sites/default/files/php/twig/67240bf11ea89_field-multiple-value-form_xRADZClSEqOeZoXPBJjwzuClW/T4sQc94sSB8LcPu-cgu-y1Yx6b2o8xHYMd1ZaD1GiWQ.php(55): Drupal\Core\Template\TwigExtension->escapeFilter(Object(Drupal\Core\Template\TwigEnvironment), Array, 'html', NULL, true)
    #16 /app/vendor/twig/twig/src/Template.php(393): __TwigTemplate_c17c005783c7b91e80f8efeb56f62bd1->doDisplay(Array, Array)
    #17 /app/vendor/twig/twig/src/Template.php(349): Twig\Template->yield(Array, Array)
    #18 /app/vendor/twig/twig/src/Template.php(364): Twig\Template->display(Array)
    #19 /app/vendor/twig/twig/src/TemplateWrapper.php(35): Twig\Template->render(Array)
    #20 /app/web/core/themes/engines/twig/twig.engine(33): Twig\TemplateWrapper->render(Array)
    #21 /app/web/core/lib/Drupal/Core/Theme/ThemeManager.php(348): twig_render_template('core/modules/sy...', Array)
    #22 /app/web/core/lib/Drupal/Core/Render/Renderer.php(491): Drupal\Core\Theme\ThemeManager->render('field_multiple_...', Array)
    #23 /app/web/core/lib/Drupal/Core/Render/Renderer.php(504): Drupal\Core\Render\Renderer->doRender(Array)
    #24 /app/web/core/lib/Drupal/Core/Render/Renderer.php(504): Drupal\Core\Render\Renderer->doRender(Array)
    #25 /app/web/core/lib/Drupal/Core/Render/Renderer.php(504): Drupal\Core\Render\Renderer->doRender(Array)
    #26 /app/web/core/lib/Drupal/Core/Render/Renderer.php(504): Drupal\Core\Render\Renderer->doRender(Array)
    #27 /app/web/core/lib/Drupal/Core/Render/Renderer.php(504): Drupal\Core\Render\Renderer->doRender(Array)
    #28 /app/web/core/lib/Drupal/Core/Render/Renderer.php(248): Drupal\Core\Render\Renderer->doRender(Array, false)
    #29 /app/web/core/lib/Drupal/Core/Render/MainContent/HtmlRenderer.php(238): Drupal\Core\Render\Renderer->render(Array, false)
    #30 /app/web/core/lib/Drupal/Core/Render/Renderer.php(638): Drupal\Core\Render\MainContent\HtmlRenderer->Drupal\Core\Render\MainContent\{closure}()
    #31 /app/web/core/lib/Drupal/Core/Render/MainContent/HtmlRenderer.php(231): Drupal\Core\Render\Renderer->executeInRenderContext(Object(Drupal\Core\Render\RenderContext), Object(Closure))
    #32 /app/web/core/lib/Drupal/Core/Render/MainContent/HtmlRenderer.php(128): Drupal\Core\Render\MainContent\HtmlRenderer->prepare(Array, Object(Symfony\Component\HttpFoundation\Request), Object(Drupal\Core\Routing\CurrentRouteMatch))
    #33 /app/web/core/lib/Drupal/Core/EventSubscriber/MainContentViewSubscriber.php(90): Drupal\Core\Render\MainContent\HtmlRenderer->renderResponse(Array, Object(Symfony\Component\HttpFoundation\Request), Object(Drupal\Core\Routing\CurrentRouteMatch))
    #34 [internal function]: Drupal\Core\EventSubscriber\MainContentViewSubscriber->onViewRenderArray(Object(Symfony\Component\HttpKernel\Event\ViewEvent), 'kernel.view', Object(Drupal\Component\EventDispatcher\ContainerAwareEventDispatcher))
    #35 /app/web/core/lib/Drupal/Component/EventDispatcher/ContainerAwareEventDispatcher.php(111): call_user_func(Array, Object(Symfony\Component\HttpKernel\Event\ViewEvent), 'kernel.view', Object(Drupal\Component\EventDispatcher\ContainerAwareEventDispatcher))
    #36 /app/vendor/symfony/http-kernel/HttpKernel.php(186): Drupal\Component\EventDispatcher\ContainerAwareEventDispatcher->dispatch(Object(Symfony\Component\HttpKernel\Event\ViewEvent), 'kernel.view')
    #37 /app/vendor/symfony/http-kernel/HttpKernel.php(76): Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object(Symfony\Component\HttpFoundation\Request), 1)
    #38 /app/web/core/lib/Drupal/Core/StackMiddleware/Session.php(53): Symfony\Component\HttpKernel\HttpKernel->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
    #39 /app/web/core/lib/Drupal/Core/StackMiddleware/KernelPreHandle.php(48): Drupal\Core\StackMiddleware\Session->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
    #40 /app/web/core/lib/Drupal/Core/StackMiddleware/ContentLength.php(28): Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
    #41 /app/web/core/modules/big_pipe/src/StackMiddleware/ContentLength.php(32): Drupal\Core\StackMiddleware\ContentLength->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
    #42 /app/web/core/modules/page_cache/src/StackMiddleware/PageCache.php(106): Drupal\big_pipe\StackMiddleware\ContentLength->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
    #43 /app/web/core/modules/page_cache/src/StackMiddleware/PageCache.php(85): Drupal\page_cache\StackMiddleware\PageCache->pass(Object(Symfony\Component\HttpFoundation\Request), 1, true)
    #44 /app/web/core/lib/Drupal/Core/StackMiddleware/ReverseProxyMiddleware.php(48): Drupal\page_cache\StackMiddleware\PageCache->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
    #45 /app/web/core/lib/Drupal/Core/StackMiddleware/NegotiationMiddleware.php(51): Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
    #46 /app/web/core/lib/Drupal/Core/StackMiddleware/AjaxPageState.php(36): Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
    #47 /app/web/core/lib/Drupal/Core/StackMiddleware/StackedHttpKernel.php(51): Drupal\Core\StackMiddleware\AjaxPageState->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
    #48 /app/web/core/lib/Drupal/Core/DrupalKernel.php(741): Drupal\Core\StackMiddleware\StackedHttpKernel->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
    #49 /app/web/index.php(19): Drupal\Core\DrupalKernel->handle(Object(Symfony\Component\HttpFoundation\Request))
    #50 {main}

  • ๐Ÿ‡บ๐Ÿ‡ธUnited States plato1123

    In my case if I go to "manage display" for the content type and disable/hide the entity reference field the error goes away. The entity reference is using "autocomplete" and goes to a taxonomy term using the "Default" reference method.

  • ๐Ÿ‡บ๐Ÿ‡ธUnited States plato1123
  • Status changed to Needs work 2 months ago
  • ๐Ÿ‡บ๐Ÿ‡ธUnited States diegopino

    This also happens on field_ui_table (View Modes). I have the feeling this is related to this here

    https://github.com/jsonrainbow/json-schema/issues/407 which is still an open issue.

    My solution was to use the component twig (the content) directly on field-ui-table.html.twig instead of using the component. I wonder if for some good reasons components are not always the only solution for everything, at least until all the quirks at core level are solved.

  • ๐Ÿ‡บ๐Ÿ‡ธUnited States danchadwick Boston

    Anyone want to work on a MR for this issue?

  • ๐Ÿ‡บ๐Ÿ‡ธUnited States danchadwick Boston

    Changing priority to minor since this only affects those who have required "core-dev" and enabled assertions.

  • amysiano4x3 โ†’ made their first commit to this issueโ€™s fork.

  • Pipeline finished with Failed
    12 days ago
    Total: 133s
    #391106
  • ๐Ÿ‡บ๐Ÿ‡ธUnited States danchadwick Boston

    @amysiano4x3 Thanks for the MR. However this issue is for the table schema. I don't think you can move a MR, so could you please open this MR on the issue for the dropdown-menu? And then I need someone else to test it with schema validation enabled.

  • ๐Ÿ‡บ๐Ÿ‡ธUnited States danchadwick Boston

    Note: the above merge request is actually for the dropdown schema. It got linked to the wrong issue. The table schema issue is still open.

Production build 0.71.5 2024