File: json-validator.py

package info (click to toggle)
scummvm 2026.1.0%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 480,768 kB
  • sloc: cpp: 4,623,045; asm: 28,515; python: 13,070; sh: 11,622; java: 10,065; xml: 8,087; perl: 2,667; ansic: 2,193; yacc: 1,685; makefile: 968; javascript: 384; awk: 368; lex: 335; objc: 82; sed: 11; php: 1
file content (22 lines) | stat: -rw-r--r-- 429 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#!/usr/bin/env python3

from jsonschema import validate
import json


def main():
    f = open('../dlc-metadata-schema.json')
    schema = json.load(f)

    f = open('../dlc-games.json')
    games = json.load(f)

    for key in games.keys():
        game = games[key]
        validate(game, schema)  # we get error if not valid

    print("All games' metadata in dlc-games.json is valid")


if __name__ == "__main__":
    main()