Problem/Motivation
Until now, we are the only ones using the JSON Schema reference system with SDC prop definitions. But core may introduce a similar mechanism, inspired from ours: #3352063: Allow schema references in Single Directory Component prop schemas
Proposed resolution
So, we need to test if "ui-patterns" is the scheme of the URL before doing any processing.
Also, let's check if the prop type exists.
API changes
This is not a breaking change.
Issue fork ui_patterns-3446471
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #2
oldebComment #3
oldebCheck for correct scheme is already done in the ComponentPluginManager::annotateProps method.
PropType availiblity is done by the PluginManagerBase::createInstance method.
Comment #4
pdureau commentedIt is not the same check .Sure, it is technically the same, but not at the same moment for the same purpose.
Anyway, the check is already done, indeed, by the stream_wrapper service manager, because of the tags from the service definition;
So, instead of doing the check again, maybe a little ocmment to explain why it is not necessary
What will happen if we do
ui-patterns://this_is_not_a_prop_type?Because we have
$plugin->getSchema()later in the stream wrapper?https://git.drupalcode.org/project/ui_patterns/-/blob/2.0.x/src/SchemaMa...
Comment #5
oldebWhen an incorrect scheme is passed : an error is thrown. This should never happen since it's checked by the ComponentPluginManager before calling file_get_contents and, like you said, the streamwrapper is always called with the correct scheme because of the tags in the service definition.
When an incorrect plugin is passed, the file_get_contents return a string with an empty array : "[]"
So there is no error, the schema is just empty.