iaincollins / structured-data-testing-tool

A library and command line tool to help inspect and test for Structured Data.
https://www.npmjs.com/package/structured-data-testing-tool
ISC License
64 stars 14 forks source link

How to test nested Object #23

Open xuanzhaopeng opened 4 years ago

xuanzhaopeng commented 4 years ago

Describe the bug Given we have this structured data:

{
   Product: [
        { name: "p1",  "offers": [ {"@type": "Offer", "name": "p1o1"}, {"@type": "Offer", "name": "p1o2"} ]  },
       { name: "p2",  "offers": [ {"@type": "Offer", "name": "p2o1"}, {"@type": "Offer", "name": "p2o2"} ]  },
   ]
}

Question: How can I define the preset for testing Product[*].offers[*].name are exist for all

For example the schema: https://schema.org/offers

iaincollins commented 4 years ago

Thanks! I don't have an answer for you right now and it will be probably be a little while before there is one, but use cases like this are helpful.

There is some work on going for more complex models and all examples of things that are not caught yet (but should be) will be added as tests.