kazarena / json-gold

A JSON-LD processor for Go
Apache License 2.0
114 stars 17 forks source link

Schema Validation #10

Open ethernetdan opened 8 years ago

ethernetdan commented 8 years ago

It doesn't appear like there is a way to validate that a piece of conforms to a schema.

I would expect it to behave similarly to this tool and check that the provided schema(s) match the fields used: https://search.google.com/structured-data/testing-tool

Not sure how much work this would be to implement but I'm happy to lend a hand.

kazarena commented 8 years ago

@ethernetdan This sounds like a very good idea! Few observations:

"aggregateRating": {
    "@type": "AggregateRating",
    "ratingValue": "4.5",
    "reviewCount": "276",
    "bestRating": "5",
    "worstRating": "1"
  }

This also may be an alreadt solved problem (for RDF). If that's the case, building a validator could be easy: use this library to transform JSON-LD into RDF quads and apply RDF based validation!

Feel free to expand, I'm open to suggestions!

bruth commented 8 years ago

@ethernetdan For schema validation, using json-schema. gojsonschema is a library for doing this in Go. You can use it to validate that a JSON-LD record is valid as well as the schemas themselves are valid.