Don't require SDC components to have a schema
>>> [!note] Migrated issue <!-- Drupal.org comment --> <!-- Migrated from issue #3552069. --> Reported by: [pdureau](https://www.drupal.org/user/1903334) Related to !259 >>> <h3 id="overview">Overview</h3> <p>While testing Canvas with contrib &amp; custom SDC themes, I have notice than most of our SDC are not loaded and land in <em>Disabled &amp; incompatible components</em> tab.</p> <p>There were three reasons for this:</p> <ul> <li>&#128072;&#65039; A prop may not be of type "object" unless it has a $ref defined - already covered by <span class="drupalorg-gitlab-issue-link drupalorg-gitlab-link-wrapper"><a href="https://git.drupalcode.org/project/canvas/-/work_items/3515074" class="drupalorg-gitlab-link">https://git.drupalcode.org/project/canvas/-/work_items/3515074</a></span> and <span class="drupalorg-gitlab-issue-link drupalorg-gitlab-link-wrapper"><a href="https://git.drupalcode.org/project/canvas/-/work_items/3467890" class="drupalorg-gitlab-link">https://git.drupalcode.org/project/canvas/-/work_items/3467890</a></span></li> <li>&#128072;&#65039; Required props must have examples - already covered by <span class="drupalorg-gitlab-issue-link drupalorg-gitlab-link-wrapper"><a href="https://git.drupalcode.org/project/canvas/-/work_items/3514672" class="drupalorg-gitlab-link">https://git.drupalcode.org/project/canvas/-/work_items/3514672</a></span></li> <li>&#128073;&#65039; Canvas always requires schema, even for theme components - handled here</li> <h3>Steps to reproduce</h3> <p><code>ComponentMetadataRequirementsChecker</code> has this code</p> </ul><pre>&nbsp;&nbsp;&nbsp; if ($metadata-&gt;schema === NULL) {<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; throw new ComponentDoesNotMeetRequirementsException(['Component has no props schema']);<br>&nbsp;&nbsp;&nbsp; }</pre><p>A lot of SDC in the wild have only slots, so they don't have a props schema. Why not just adding the schema on the fly (or better, fixing the root cause leading to this restrictions) instead of being incompatible with them?</p> <h3 id="proposed-resolution">Proposed resolution</h3> <p>Solve <strong>Canvas always requires schema, even for theme components.</strong> by allowing <code>null</code> for props schema, assuming that there are no props for the component.</p> > Related issue: [Issue #3514672](https://www.drupal.org/node/3514672) > Related issue: [Issue #3515074](https://www.drupal.org/node/3515074) > Related issue: [Issue #3467890](https://www.drupal.org/node/3467890)
issue