google / schema-dts

JSON-LD TypeScript types for Schema.org vocabulary
Apache License 2.0
860 stars 32 forks source link

Rich Result Text shows "offer" error when using Motorcycle type #192

Open DarthTicius opened 1 year ago

DarthTicius commented 1 year ago

When trying to use the Motorcycle as "@type" for 'itemOffer' the Rich Result test throw an error about offer for Product snippets. If we change the @type to Car the error is gone.

The issue appears to be in the "itemOffered" part. We get error when using Motorcycle as type:

"itemOffered": {
  "@type": "Motorcycle",
  "name": "Long name of product",
  "itemCondition": "UsedCondition",
},
Screen Shot 2023-04-28 at 5 42 43 PM

while using Car as type will pass:

"itemOffered": {
  "@type": "Car",
  "name": "Long name of product",
  "itemCondition": "UsedCondition",
},
Screen Shot 2023-04-28 at 6 05 07 PM

Is this intended behaviour?

(Schema also tested on the validator.schema.org) Test code example used in Rich Result Text to reproduce:

 <html>
  <head>
    <title>Executive Anvil</title>
    <script type="application/ld+json">
      {
        "@context": "https://schema.org/",
        "@type": "Product",
        "name": "Long name of product",
        "brand": {
          "@type": "Brand",
          "name": "Brand Name"
        },
        "image": {
          "@type": "ImageObject",
          "url": "#"
        },
        "description": "<p>Test</p>\n",
        "offers": {
          "@type": "Offer",
          "url": "url of the product",
          "availability": "InStock",
          "name": "Long name of product",
          "image": {
            "@type": "ImageObject",
            "url": "#"
          },
          "offeredBy": {
            "@type": "Person",
            "name": "Name and Surname of the seller",
            "address": {
              "@type": "PostalAddress",
              "streetAddress": "My street address",
              "addressLocality": "The city",
              "postalCode": "Some postal code",
              "addressCountry": "UN"
            }
          },
          "itemOffered": {
            "@type": "Motorcycle",
            "name": "Long name of product",
            "itemCondition": "UsedCondition"
          },
          "priceSpecification": {
            "@type": "PriceSpecification",
            "price": "99.99",
            "priceCurrency": "EUR"
          }
        }
      }
    </script>
  </head>
  <body>
  </body>
</html>