- Issue created by @lauriii
- 🇧🇪Belgium wim leers Ghent 🇧🇪🇪🇺
This reminds meof the "optional image" problem space! 😅
Can you please share the component that triggers this edge case, rather than describing how to create it? 🙏 That would eliminate misinterpretation.
This could be a problem on either the client or the server.
- 🇧🇪Belgium wim leers Ghent 🇧🇪🇪🇺
Also reminds me of 🐛 SDC prop of `type: string` with empty string listed in its `enum` results in broken input UX Active .
- 🇫🇮Finland lauriii Finland
Here's the component I used for this:
uuid: 3dda3b0f-e2a1-4f44-999b-5f31c2b83c3a langcode: en status: true dependencies: enforced: { } machineName: link name: Link block_override: null required: { } props: link: title: Link type: string format: uri-reference title: title: Title type: string examples: - Link slots: { } js: original: |- import { cn } from "@/lib/utils"; const Link = ({ title = "Link", link = '#', }) => { return ( <a href={link}>{title}</a> ); }; export default Link; compiled: | import { jsx as _jsx } from "react/jsx-runtime"; import { cn } from "@/lib/utils"; const Link = ({ title = "Link", link = '#' })=>{ return /*#__PURE__*/ _jsx("a", { href: link, children: title }); }; export default Link; css: original: '' compiled: ''
- 🇧🇪Belgium wim leers Ghent 🇧🇪🇪🇺
This error message comes from JSON Schema validation, in
\JsonSchema\Constraints\FormatConstraint
:case 'uriref': case 'uri-reference': if (null === filter_var($element, FILTER_VALIDATE_URL, FILTER_NULL_ON_FAILURE)) { // FILTER_VALIDATE_URL does not conform to RFC-3986, and cannot handle relative URLs, but // the json-schema spec uses RFC-3986, so need a bit of hackery to properly validate them. // See https://tools.ietf.org/html/rfc3986#section-4.2 for additional information. if (substr($element, 0, 2) === '//') { // network-path reference $validURL = filter_var('scheme:' . $element, FILTER_VALIDATE_URL, FILTER_NULL_ON_FAILURE); } elseif (substr($element, 0, 1) === '/') { // absolute-path reference $validURL = filter_var('scheme://host' . $element, FILTER_VALIDATE_URL, FILTER_NULL_ON_FAILURE); } elseif (strlen($element)) { // relative-path reference $pathParts = explode('/', $element, 2); if (strpos($pathParts[0], ':') !== false) { $validURL = null; } else { $validURL = filter_var('scheme://host/' . $element, FILTER_VALIDATE_URL, FILTER_NULL_ON_FAILURE); } } else { $validURL = null; } if ($validURL === null) { $this->addError($path, 'Invalid URL format', 'format', array('format' => $schema->format)); } } break;
- 🇧🇪Belgium wim leers Ghent 🇧🇪🇪🇺
📌 ComponentMetadataRequirementsChecker::check() should validate that the example(s) actually match the JSON schema Active landed earlier today to enforce compliance of examples with the prop's schema. But … here there's no example!
So … not sure yet what's going on.
- 🇧🇪Belgium wim leers Ghent 🇧🇪🇪🇺
Actually, just tried to reproduce this, and couldn't. 😅
@wim-leers, I followed the steps outlined in the description but was unable to reproduce the issue. It seems this can be considered resolved.