(data, schema_filename)
| 109 | |
| 110 | |
| 111 | def validate_schema(data, schema_filename): |
| 112 | if schema_filename: |
| 113 | with open(schema_filename, 'r') as f: |
| 114 | s = f.read() |
| 115 | sdata = json.loads(s) |
| 116 | try: |
| 117 | # validate will throw if invalid schema. |
| 118 | if schema_filename: |
| 119 | validate(instance=data, schema=sdata) |
| 120 | except ValidationError as ve: |
| 121 | return str(ve) |
| 122 | |
| 123 | return "" |
| 124 | |
| 125 | |
| 126 | def save_to_file(filename, is_json, typerepr, no_backup, data): |
no test coverage detected