tools: add json schema for idf_size

This commit is contained in:
simon.chupin
2021-10-14 16:22:27 +02:00
parent 6ef6c2a2c7
commit cd5e830445
5 changed files with 6021 additions and 386 deletions

View File

@@ -0,0 +1,22 @@
#!/usr/bin/env python
#
# SPDX-FileCopyrightText: 2017-2021 Espressif Systems (Shanghai) CO LTD
# SPDX-License-Identifier: Apache-2.0
#
import json
import os
from sys import stdin
try:
import jsonschema
except ImportError:
raise RuntimeError('You need to install jsonschema package to use validate command')
input_json = ''
for line in stdin:
input_json += line
size_json = json.loads(input_json)
with open(os.path.join(os.path.dirname(__file__), 'size_schema.json'), 'r') as schema_file:
schema_json = json.load(schema_file)
jsonschema.validate(size_json, schema_json)
print(input_json.strip('\n'))