schema icon indicating copy to clipboard operation
schema copied to clipboard

Embedded review object not surfaced

Open jdrucey opened this issue 3 years ago • 2 comments

When running through this example schema (which validates without errors or warnings at validator.schema.org), the returned Car object contains an empty Review object, where I would expect the full review details.

Example schema:

{
  "@context": "https://schema.org",
  "@type": "Car",
  "name": "Citroen C5 Aircross",
  "description": "On the whole, the C5 Aircross remains a practical, comfort-focused offering, now with an improved cabin ambience",
  "review": {
    "@context": "https://schema.org",
    "name": "New Citroen C5 Aircross 2022 review",
    "author": {
      "@type": "Person",
      "name": "John McIlroy",
      "image": "https://media.autoexpress.co.uk/image/private/s--M0Zdgnzr--/v1570031644/autoexpress/dsc_9517_0.jpg"
    },
    "image": "https://media.autoexpress.co.uk/image/private/s--X-WVjvBW--/f_auto,t_content-image-full-desktop@1/v1654788066/autoexpress/2022/06/2022 Citroen C5 Aircross.jpg",
    "dateModified": "2022-06-09T16:30:30+01:00",
    "datePublished": "2022-06-09T16:30:30+01:00",
    "publisher": {
      "@type": "Organization",
      "name": "AutoExpress",
      "logo": {
        "@type": "ImageObject",
        "url": "https://www.autoexpress.co.uk/public/logo-auto-express.svg",
        "height": 93,
        "width": 88
      }
    },
    "reviewRating": {
      "@type": "Rating",
      "bestRating": 5,
      "worstRating": 0,
      "ratingValue": 3.5
    },
    "reviewBody": null
  },
  "brand": { "@type": "Brand", "name": "Citroen" }
}

jdrucey avatar Jun 10 '22 11:06 jdrucey

So this is failing because there is no @type inside review. but this still passes all checks on schema.org. Trying to find information on the requirement of this field when it can be deduced from the parent objects property.

jdrucey avatar Jun 10 '22 13:06 jdrucey

It makes sense to deduce the type from the possible types. https://schema.org/Car says review can only be of type https://schema.org/Review . Currently, brick/schema only knows about the possible fields but not their types (properties.php).

What's the right thing to do about e.g. isSimilarTo which can be https://schema.org/Product | https://schema.org/Service (or an array of those things). I'm not sure a preference should be expressed by taking a missing type to be either, so maybe it should only work for cases where there's only one possibility (but ideally not lose the information when it cannot be said, so there could be additional handling in the calling code).

jhard avatar Jan 28 '23 10:01 jhard