`json-schema-definitions://canvas.module/stream-wrapper-uri` known prop shape is incorrectly mapped to link field type, causing error
>>> [!note] Migrated issue <!-- Drupal.org comment --> <!-- Migrated from issue #3573796. --> Reported by: [fago](https://www.drupal.org/user/16747) Related to !609 !610 >>> <h3 id="overview">Overview</h3> <p>Props using the stream-wrapper-uri JSON schema definition (canvas.module/stream-wrapper-uri) without contentMediaType: image/* are incorrectly mapped to a link field type.</p> <p>When the valid example value (e.g. public://documents/report.pdf) is evaluated, LinkUrl::getValue() calls Url::fromUri('public://...') which crashes because stream wrapper schemes are not supported by Url::fromUri().</p> <p>I ran into this when implementing <span class="drupalorg-gitlab-issue-link project-issue-status-info project-issue-status-7"><a href="https://www.drupal.org/project/canvas_extjs/issues/3567276" title="Status: Closed (fixed)">#3567276: Support all/most canvas-special json-schema types</a></span>. The type is defined in canvas/schema.json as following:</p> <pre>&nbsp; "stream-wrapper-uri": {<br>&nbsp;&nbsp;&nbsp; "title": "Stream wrapper URI",<br>&nbsp;&nbsp;&nbsp; "type": "string",<br>&nbsp;&nbsp;&nbsp; "format": "uri",<br>&nbsp;&nbsp;&nbsp; "x-allowed-schemes": ["public"]<br>&nbsp; },</pre><h3 id="proposed-resolution">Proposed resolution</h3> <p> For files/documents, in the end a two-layer approach like for images would make sense:<br> 1. Default: Map stream-wrapper-uri (without contentMediaType) to file_uri field type or a file field reference (file entity &rarr; uri &rarr; value)<br> 2. Media library upgrade: When media types with File source exist, override to media library entity reference &rarr; media &rarr; source field &rarr; file &rarr; uri &rarr; value</p> <p>I'd suggest to focus on part 1. here, to avoid the errors/bug, then implement part 2. as an optional follow-up improvement.</p> > Related issue: [Issue #3542895](https://www.drupal.org/node/3542895) > Related issue: [Issue #3567276](https://www.drupal.org/node/3567276) > Related issue: [Issue #3548298](https://www.drupal.org/node/3548298)
issue