github.com/status-im/status-go@v1.1.0/integration-tests/schema_builder.py (about) 1 import json 2 import os 3 from conftest import option 4 from genson import SchemaBuilder 5 6 7 class CustomSchemaBuilder(SchemaBuilder): 8 9 def __init__(self, schema_name): 10 super().__init__() 11 self.path = f"{option.base_dir}/schemas/{schema_name}" 12 13 def create_schema(self, response_json): 14 builder = SchemaBuilder() 15 builder.add_object(response_json) 16 schema = builder.to_schema() 17 18 os.makedirs(os.path.dirname(self.path), exist_ok=True) 19 with open(self.path, "w") as file: 20 json.dump(schema, file, sort_keys=True, indent=4, ensure_ascii=False)