Koleksiyonlar ile düzeninizi koruyun
İçeriği tercihlerinize göre kaydedin ve kategorilere ayırın.
Feed'inizi oluştururken veya güncellerken öğeleri doğrulamak için aşağıdaki JSON şemalarını kullanın. Şemalar JSON Şeması spesifikasyonuna dayanır.
Oluşturduğunuz öğeleri doğrulamak için bir birim testi ekleyerek feed kalitesini etkileyecek sorunları tespit edebilirsiniz. Sık karşılaşılan hataları önlemek için feed'inizi geliştirirken de bu şemaları kullanabilirsiniz.
Sağlanan şemalar taslak 7 sürümünde yazılmıştır. Bu nedenle, seçtiğiniz uygulamanın düzgün çalışması için bu sürümü desteklemesi gerekir.
Doğrulama örneği
Aşağıdaki örnekte, schema.json şeması dosyası ve jsonschema Python modülü kullanılarak feed.json dosyasında bulunan tüm öğelerin nasıl doğrulanacağı gösterilmektedir. Varlıklar, veri feed'i zarfında belirtildiği gibi dataFeedElement mülkündedir.
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")
[[["Anlaması kolay","easyToUnderstand","thumb-up"],["Sorunumu çözdü","solvedMyProblem","thumb-up"],["Diğer","otherUp","thumb-up"]],[["İhtiyacım olan bilgiler yok","missingTheInformationINeed","thumb-down"],["Çok karmaşık / çok fazla adım var","tooComplicatedTooManySteps","thumb-down"],["Güncel değil","outOfDate","thumb-down"],["Çeviri sorunu","translationIssue","thumb-down"],["Örnek veya kod sorunu","samplesCodeIssue","thumb-down"],["Diğer","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"]]