Mantieni tutto organizzato con le raccolte
Salva e classifica i contenuti in base alle tue preferenze.
Per convalidare le entità durante la creazione o l'aggiornamento del feed, utilizza i seguenti schemi JSON. Gli schemi si basano sulla specifica JSON Schema.
Aggiungendo un test unitario per convalidare le entità generate, puoi rilevare i problemi che potrebbero influire sulla qualità del feed. Puoi anche utilizzare questi schemi durante lo sviluppo del feed per evitare errori comuni.
Lo schema della TV in diretta convalida le entità BroadcastEvent, BroadcastService, CableOrSatelliteService, Movie, Organization, SportsEvent, TelevisionChannel, TVEpisode, TVSeason e TVSeries.
Music Schema convalida le entità MusicAlbum, MusicGroup, MusicPlaylist e MusicRecording.
Radio Schema convalida le entità RadioBroadcastService.
Utilizza la specifica su questo sito come fonte attendibile, poiché questi schemi potrebbero non avere implementato tutte le funzionalità.
Gli schemi forniti sono scritti nella bozza 7, pertanto l'implementazione scelta deve supportare questa versione per funzionare correttamente.
Esempio di convalida
L'esempio seguente mostra come convalidare tutte le entità presenti in un filefeed.json utilizzando il file dello schema schema.json e il modulo Python jsonschema. Le entità si trovano nella proprietà dataFeedElement come specificato nella documentazione relativa all'involucro del feed di dati.
importjsonfromjsonschemaimportvalidate# Loading the schema filewithopen("schema.json","r")asfp:schema=json.load(fp)# Opening the feedwithopen("feed.json","r")asfp:feed=json.load(fp)# Validating each entity in the feedforentityinfeed["dataFeedElement"]:try:validate(schema=schema,instance=entity)print("Entity validated successfully")exceptExceptionase:# e may contain an explanation as to why the entity wasn't validprint("Failed to validate the entity")
[[["Facile da capire","easyToUnderstand","thumb-up"],["Il problema è stato risolto","solvedMyProblem","thumb-up"],["Altra","otherUp","thumb-up"]],[["Mancano le informazioni di cui ho bisogno","missingTheInformationINeed","thumb-down"],["Troppo complicato/troppi passaggi","tooComplicatedTooManySteps","thumb-down"],["Obsoleti","outOfDate","thumb-down"],["Problema di traduzione","translationIssue","thumb-down"],["Problema relativo a esempi/codice","samplesCodeIssue","thumb-down"],["Altra","otherDown","thumb-down"]],[],[[["JSON Schemas are provided to validate entities when creating or updating your data feed, ensuring data quality and consistency."],["Choose the appropriate Media Actions schema (VOD, Live TV, Music, or Radio) based on the type of entities in your feed."],["Select a validator implementation that supports JSON Schema draft 7 and integrate it into your workflow for automated validation."],["Refer to the specification on this site as the primary source of truth for entity requirements, as schemas may not include all features."],["Utilize the provided example code snippet to validate entities within your feed using the chosen schema and a compatible validator."]]],["To validate feed entities, use the provided JSON Schemas, based on the JSON Schema specification, for different media types: Video On Demand, Live TV, Music, and Radio. Add unit tests for validation to detect issues and avoid errors during feed development. Choose a validator implementation supporting draft 7, such as the `jsonschema` python module. Validate entities by loading the schema and feed, then iterating through entities in the `dataFeedElement` property and testing with the selected implementation, printing the results.\n"]]