Created
January 31, 2015 02:43
-
-
Save tacaswell/1451999b17d59e06d887 to your computer and use it in GitHub Desktop.
jschema_play
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from jsonschema import validate | |
| schema = { | |
| "definitions": { | |
| "data_key": { | |
| "properties": { | |
| "external": { | |
| "type": "string", | |
| "pattern": "^[A-Z]+:?" | |
| }, | |
| "source": { | |
| "type": "string", | |
| "pattern": "^[A-Z]+:" | |
| } | |
| }, | |
| "required": [ | |
| "source" | |
| ], | |
| "type": "object" | |
| } | |
| }, | |
| "properties": { | |
| "keys": { | |
| "additionalProperties": { | |
| "$ref": "#/definitions/data_key" | |
| }, | |
| "type": "object" | |
| }, | |
| "uuid": { | |
| "type": "string" | |
| } | |
| }, | |
| "type": "object" | |
| } | |
| test = { | |
| "uid": '789', | |
| "keys": { | |
| "chan1": {"source": "PV:XF:23ID1-ES{Sclr:1}.S1"}, | |
| "chan2": {"source": "PV:XF:23ID1-ES{Sclr:1}.S2"}, | |
| "chan3": {"source": "PV:XF:23ID1-ES{Sclr:1}.S3"}, | |
| "chan4": {"source": "PV:XF:23ID1-ES{Sclr:1}.S4"}, | |
| "chan5": {"source": "PV:XF:23ID1-ES{Sclr:1}.S5"}, | |
| "chan6": {"source": "PV:XF:23ID1-ES{Sclr:1}.S6"}, | |
| "chan7": {"source": "PV:XF:23ID1-ES{Sclr:1}.S7"}, | |
| "chan8": {"source": "PV:XF:23ID1-ES{Sclr:1}.S8"}, | |
| "pimte": {"source": "CCD:name_of_detector", "external": "FILESTORE"}, | |
| }, | |
| "begin_run_event": '789', | |
| "time": 789.456, | |
| } | |
| validate(test, schema) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment