- Issue created by @wim leers
- š§šŖBelgium wim leers Ghent š§šŖšŖšŗ
The intent has been from the start to avoid adding "Drupalism" to SDC's use of JSON Schema.
That's why we started using
/schema.json
and defined$ref: json-schema-definitions://experience_builder.module/image-uri
.However, given that ⨠[PP-1] Make link widget autocomplete work (for uri and uri-reference props) Postponed is proposing to add a variation for
format: uri
namedformat: uri+entity_autocomplete
(which required a core change: š ComponentValidator ignores the set validator and creates a new one Active )So, an alternative HERE could be that we start using custom
format
s (fortype: string
). Which is exactly what @lauriii expressed he'd strongly prefer over at #3462705-47: [META] Missing features in SDC needed for XB ā . (Note that JSON Schema does support custom format attributes: https://json-schema.org/draft/2020-12/json-schema-validation#section-7 + https://json-schema.org/draft/2020-12/json-schema-validation#name-custom...)Or better yet: use
contentMediaType
.So then we'd go from:
"image-uri": { "title": "Image URL", "type": "string", "format": "uri-reference", "pattern": "^(/|https?://)?.*\\.(png|gif|jpg|jpeg|webp)(\\?.*)?(#.*)?$" },
to:
"image-uri": { "title": "Image URL", "type": "string", "format": "uri-reference", "contentMediaType": "image/*" },
⦠which is not quite exactly how
contentMediaType
is meant to be used (that's really describing the contents of the string itself), but is ⦠close enough? Something along these lines has been proposed asresourceMediaType
.Examples of actually defining new JSON Schema formats seem impossible to find.
This would then also allow us to apply a similar improvement to "video URLs", which is being added at ⨠Define JSON Schema $refs for linking/embedding videos and linking documents Active .
- š§šŖBelgium wim leers Ghent š§šŖšŖšŗ
Related but different: š Decouple image shape matching from the `image` MediaType Active .
- š§šŖBelgium wim leers Ghent š§šŖšŖšŗ
Bumping to priority. Because without this, we'll need to keep doing awkward dances/updates and we'll never match all image fields.
IOW: without this, we won't be able to match any image fields or image media on existing Drupal sites that do not allow AVIF uploads. That's bad! XB users will be (rightfully!) baffled and frustrated that they can't use their years worth of uploaded images.