To validate entities when you're creating or updating your feed, use the following JSON Schemas. The schemas are based on the JSON Schema specification. By adding a unit test to validate the entities you generate, you can detect issues that would impact the feed quality. You can also use these schemas during the development of your feed to avoid common errors.
Select a Media Actions schema
- Video On Demand Schema validates
Movie
,TVEpisode
,TVSeries
andTVSeason
entities. - Live TV Schema validates
BroadcastEvent
,BroadcastService
,CableOrSatelliteService
,Movie
,Organization
,SportsEvent
,TelevisionChannel
,TVEpisode
,TVSeason
andTVSeries
entities. - Music Schema validates
MusicAlbum
,MusicGroup
,MusicPlaylist
andMusicRecording
entities. - Radio Schema validates
RadioBroadcastService
entities.
Use the specification on this site as the source of truth, since these schemas may not have all the features implemented.
Choose a validator
You can find the list of validator implementations on json-schema.org.
The schemas provided are written in draft 7, so the implementation you choose needs to support this version to work properly.
Example of validation
The following example show how to validate all entities present in a file
feed.json
using the schema file schema.json
and the jsonschema python module. The entities are in the
property dataFeedElement
as specified in the data feed envelope documentation.
import json
from jsonschema import validate
# Loading the schema file
with open("schema.json", "r") as fp:
schema = json.load(fp)
# Opening the feed
with open("feed.json", "r") as fp:
feed = json.load(fp)
# Validating each entity in the feed
for entity in feed["dataFeedElement"] :
try:
validate(schema=schema, instance=entity)
print("Entity validated successfully")
except Exception as e:
# e may contain an explanation as to why the entity wasn't valid
print("Failed to validate the entity")