Last active
August 29, 2015 14:03
-
-
Save garyhodgson/3f52bf75eecddce62b46 to your computer and use it in GitHub Desktop.
This file contains 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
{ | |
"$schema":"http://json-schema.org/draft-03/schema#", | |
"type":"object", | |
"properties":{ | |
"id":{ | |
"type":"string" | |
}, | |
"version":{ | |
"type":"number" | |
}, | |
"url":{ | |
"type":"string" | |
}, | |
"description":{ | |
"type":"string" | |
}, | |
"updated":{ | |
"type":"string", | |
"pattern":"^\\d{4}-[01]?[0-9]{1}-[0123]?[0-9]{1}T[012]?[0-9]{1}:[0-5]?[0-9]{1}:[0-5]?[0-9]{1}\\.?\\d+(([+|-]{1}\\d+:\\d+)|Z)$" | |
}, | |
"thingsCount":{ | |
"type":"number" | |
}, | |
"trackersCount":{ | |
"type":"number" | |
}, | |
"trackersTraversalDepth":{ | |
"type":"number" | |
}, | |
"maintainers":{ | |
"type":"array", | |
"items":{ | |
"type":"object", | |
"properties":{ | |
"name":{ | |
"type":"string", | |
"required":true | |
}, | |
"url":{ | |
"type":"string" | |
}, | |
"email":{ | |
"type":"string" | |
}, | |
"xIdentityMetadata":{ | |
"type":"object", | |
"id":"id-42300" | |
} | |
} | |
} | |
}, | |
"things":{ | |
"type":"array", | |
"items":{ | |
"type":"object", | |
"properties":{ | |
"id":{ | |
"type":"string", | |
"required":true | |
}, | |
"title":{ | |
"type":"string", | |
"required":true | |
}, | |
"url":{ | |
"type":"string" | |
}, | |
"downloadUrl":{ | |
"type":"string" | |
}, | |
"authors":{ | |
"type":"array", | |
"items":{ | |
"type":"object", | |
"properties":{ | |
"name":{ | |
"type":"string", | |
"required":true | |
}, | |
"url":{ | |
"type":"string" | |
}, | |
"email":{ | |
"type":"string" | |
}, | |
"xIdentityMetadata":{ | |
"type":"object" | |
} | |
} | |
} | |
}, | |
"licenses":{ | |
"type":"array", | |
"items":{ | |
"type":"string" | |
} | |
}, | |
"thumbnailUrls":{ | |
"type":"array", | |
"items":{ | |
"type":"string" | |
} | |
}, | |
"description":{ | |
"type":"string" | |
}, | |
"created":{ | |
"type":"string", | |
"pattern":"^\\d{4}-[01]?[0-9]{1}-[0123]?[0-9]{1}T[012]?[0-9]{1}:[0-5]?[0-9]{1}:[0-5]?[0-9]{1}\\.?\\d+(([+|-]{1}\\d+:\\d+)|Z)$" | |
}, | |
"updated":{ | |
"type":"string", | |
"pattern":"^\\d{4}-[01]?[0-9]{1}-[0123]?[0-9]{1}T[012]?[0-9]{1}:[0-5]?[0-9]{1}:[0-5]?[0-9]{1}\\.?\\d+(([+|-]{1}\\d+:\\d+)|Z)$" | |
}, | |
"metadata":{ | |
"type":"object", | |
"properties":{ | |
"created":{ | |
"type":"string", | |
"pattern":"^\\d{4}-[01]?[0-9]{1}-[0123]?[0-9]{1}T[012]?[0-9]{1}:[0-5]?[0-9]{1}:[0-5]?[0-9]{1}\\.?\\d+(([+|-]{1}\\d+:\\d+)|Z)$" | |
}, | |
"updated":{ | |
"type":"string", | |
"pattern":"^\\d{4}-[01]?[0-9]{1}-[0123]?[0-9]{1}T[012]?[0-9]{1}:[0-5]?[0-9]{1}:[0-5]?[0-9]{1}\\.?\\d+(([+|-]{1}\\d+:\\d+)|Z)$" | |
}, | |
"submitter":{ | |
"type":"object", | |
"properties":{ | |
"name":{ | |
"type":"string", | |
"required":true | |
}, | |
"url":{ | |
"type":"string" | |
}, | |
"email":{ | |
"type":"string" | |
}, | |
"xIdentityMetadata":{ | |
"type":"object" | |
} | |
} | |
} | |
} | |
}, | |
"subject":{ | |
"type":"array", | |
"items":{ | |
"type":"string" | |
} | |
}, | |
"media":{ | |
"type":"array", | |
"items":{ | |
"type":"string" | |
} | |
}, | |
"categories":{ | |
"type":"array", | |
"items":{ | |
"type":"string" | |
} | |
}, | |
"tags":{ | |
"type":"array", | |
"items":{ | |
"type":"string" | |
} | |
}, | |
"relationships":{ | |
"type":"array", | |
"items":{ | |
"type":"object", | |
"properties":{ | |
"title":{ | |
"type":"string" | |
}, | |
"type":{ | |
"type":"string" | |
}, | |
"url":{ | |
"type":"string" | |
}, | |
"xRelationshipMetadata":{ | |
"type":"object" | |
} | |
} | |
} | |
}, | |
"billOfMaterials":{ | |
"type":"array", | |
"items":{ | |
"type":"object", | |
"properties":{ | |
"partNumber":{ | |
"type":"string" | |
}, | |
"description":{ | |
"type":"string" | |
}, | |
"type":{ | |
"type":"string", | |
"pattern":"\\bsource\\b|\\bgenerated\\b|\\bbom\\b|\\bimage\\b|\\bthing\\b" | |
}, | |
"url":{ | |
"type":"string" | |
}, | |
"mimetype":{ | |
"type":"string" | |
}, | |
"unit":{ | |
"type":"string" | |
}, | |
"quantity":{ | |
"type":"number" | |
}, | |
"thumbnailUrl":{ | |
"type":"string" | |
}, | |
"xBomMetadata":{ | |
"type":"object" | |
} | |
} | |
} | |
}, | |
"instructions":{ | |
"type":"array", | |
"items":{ | |
"type":"object", | |
"properties":{ | |
"step":{ | |
"type":"number" | |
}, | |
"text":{ | |
"type":"string" | |
}, | |
"imagUurls":{ | |
"type":"array", | |
"items":{ | |
"type":"string" | |
} | |
}, | |
"xInstructionMetadata":{ | |
"type":"object" | |
} | |
} | |
} | |
}, | |
"xThingMetadata":{ | |
"type":"object" | |
} | |
} | |
}, | |
"required":true | |
}, | |
"thingsCache":{ | |
"type":"object", | |
"properties":{ | |
"url":{ | |
"type":"string", | |
"required":true | |
}, | |
"thingsCount":{ | |
"type":"number" | |
}, | |
"updated":{ | |
"type":"string", | |
"pattern":"^\\d{4}-[01]?[0-9]{1}-[0123]?[0-9]{1}T[012]?[0-9]{1}:[0-5]?[0-9]{1}:[0-5]?[0-9]{1}\\.?\\d+(([+|-]{1}\\d+:\\d+)|Z)$" | |
}, | |
"xThingsCacheMetadata":{ | |
"type":"object" | |
} | |
} | |
}, | |
"xTrackerMetadata":{ | |
"type":"object" | |
}, | |
"trackers":{ | |
"type":"array", | |
"items":{ | |
"type":"object", | |
"properties":{ | |
"id":{ | |
"type":"string" | |
}, | |
"url":{ | |
"type":"string", | |
"required":true | |
}, | |
"accessed":{ | |
"type":"string", | |
"pattern":"^\\d{4}-[01]?[0-9]{1}-[0123]?[0-9]{1}T[012]?[0-9]{1}:[0-5]?[0-9]{1}:[0-5]?[0-9]{1}\\.?\\d+(([+|-]{1}\\d+:\\d+)|Z)$" | |
}, | |
"status":{ | |
"type":"string", | |
"pattern":"\\bunknown\\b|\\bok\\b|\\berror\\b" | |
}, | |
"thingsCache":{ | |
"type":"object", | |
"properties":{ | |
"url":{ | |
"type":"string", | |
"required":true | |
}, | |
"thingsCount":{ | |
"type":"number" | |
}, | |
"updated":{ | |
"type":"string", | |
"pattern":"^\\d{4}-[01]?[0-9]{1}-[0123]?[0-9]{1}T[012]?[0-9]{1}:[0-5]?[0-9]{1}:[0-5]?[0-9]{1}\\.?\\d+(([+|-]{1}\\d+:\\d+)|Z)$" | |
}, | |
"xThingsCacheMetadata":{ | |
"type":"object" | |
} | |
} | |
} | |
} | |
} | |
} | |
} | |
} |
This file contains 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.validators import Draft3Validator | |
from jsonschema.exceptions import best_match | |
schema = { | |
"$schema":"http://json-schema.org/draft-03/schema#", | |
"type":"object", | |
"properties":{ | |
"id":{ | |
"type":"string" | |
}, | |
"version":{ | |
"type":"number" | |
}, | |
"url":{ | |
"type":"string" | |
}, | |
"description":{ | |
"type":"string" | |
}, | |
"updated":{ | |
"type":"string", | |
"pattern":"^\\d{4}-[01]?[0-9]{1}-[0123]?[0-9]{1}T[012]?[0-9]{1}:[0-5]?[0-9]{1}:[0-5]?[0-9]{1}\\.?\\d+(([+|-]{1}\\d+:\\d+)|Z)$" | |
}, | |
"thingsCount":{ | |
"type":"number" | |
}, | |
"trackersCount":{ | |
"type":"number" | |
}, | |
"trackersTraversalDepth":{ | |
"type":"number" | |
}, | |
"maintainers":{ | |
"type":"array", | |
"items":{ | |
"type":"object", | |
"properties":{ | |
"name":{ | |
"type":"string", | |
"required":True | |
}, | |
"url":{ | |
"type":"string" | |
}, | |
"email":{ | |
"type":"string" | |
}, | |
"xIdentityMetadata":{ | |
"type":"object", | |
"id":"id-42300" | |
} | |
} | |
} | |
}, | |
"things":{ | |
"type":"array", | |
"items":{ | |
"type":"object", | |
"properties":{ | |
"id":{ | |
"type":"string", | |
"required":True | |
}, | |
"title":{ | |
"type":"string", | |
"required":True | |
}, | |
"url":{ | |
"type":"string" | |
}, | |
"downloadUrl":{ | |
"type":"string" | |
}, | |
"authors":{ | |
"type":"array", | |
"items":{ | |
"type":"object", | |
"properties":{ | |
"name":{ | |
"type":"string", | |
"required":True | |
}, | |
"url":{ | |
"type":"string" | |
}, | |
"email":{ | |
"type":"string" | |
}, | |
"xIdentityMetadata":{ | |
"type":"object" | |
} | |
} | |
} | |
}, | |
"licenses":{ | |
"type":"array", | |
"items":{ | |
"type":"string" | |
} | |
}, | |
"thumbnailUrls":{ | |
"type":"array", | |
"items":{ | |
"type":"string" | |
} | |
}, | |
"description":{ | |
"type":"string" | |
}, | |
"created":{ | |
"type":"string", | |
"pattern":"^\\d{4}-[01]?[0-9]{1}-[0123]?[0-9]{1}T[012]?[0-9]{1}:[0-5]?[0-9]{1}:[0-5]?[0-9]{1}\\.?\\d+(([+|-]{1}\\d+:\\d+)|Z)$" | |
}, | |
"updated":{ | |
"type":"string", | |
"pattern":"^\\d{4}-[01]?[0-9]{1}-[0123]?[0-9]{1}T[012]?[0-9]{1}:[0-5]?[0-9]{1}:[0-5]?[0-9]{1}\\.?\\d+(([+|-]{1}\\d+:\\d+)|Z)$" | |
}, | |
"metadata":{ | |
"type":"object", | |
"properties":{ | |
"created":{ | |
"type":"string", | |
"pattern":"^\\d{4}-[01]?[0-9]{1}-[0123]?[0-9]{1}T[012]?[0-9]{1}:[0-5]?[0-9]{1}:[0-5]?[0-9]{1}\\.?\\d+(([+|-]{1}\\d+:\\d+)|Z)$" | |
}, | |
"updated":{ | |
"type":"string", | |
"pattern":"^\\d{4}-[01]?[0-9]{1}-[0123]?[0-9]{1}T[012]?[0-9]{1}:[0-5]?[0-9]{1}:[0-5]?[0-9]{1}\\.?\\d+(([+|-]{1}\\d+:\\d+)|Z)$" | |
}, | |
"submitter":{ | |
"type":"object", | |
"properties":{ | |
"name":{ | |
"type":"string", | |
"required":True | |
}, | |
"url":{ | |
"type":"string" | |
}, | |
"email":{ | |
"type":"string" | |
}, | |
"xIdentityMetadata":{ | |
"type":"object" | |
} | |
} | |
} | |
} | |
}, | |
"subject":{ | |
"type":"array", | |
"items":{ | |
"type":"string" | |
} | |
}, | |
"media":{ | |
"type":"array", | |
"items":{ | |
"type":"string" | |
} | |
}, | |
"categories":{ | |
"type":"array", | |
"items":{ | |
"type":"string" | |
} | |
}, | |
"tags":{ | |
"type":"array", | |
"items":{ | |
"type":"string" | |
} | |
}, | |
"relationships":{ | |
"type":"array", | |
"items":{ | |
"type":"object", | |
"properties":{ | |
"title":{ | |
"type":"string" | |
}, | |
"type":{ | |
"type":"string" | |
}, | |
"url":{ | |
"type":"string" | |
}, | |
"xRelationshipMetadata":{ | |
"type":"object" | |
} | |
} | |
} | |
}, | |
"billOfMaterials":{ | |
"type":"array", | |
"items":{ | |
"type":"object", | |
"properties":{ | |
"partNumber":{ | |
"type":"string" | |
}, | |
"description":{ | |
"type":"string" | |
}, | |
"type":{ | |
"type":"string", | |
"pattern":"\\bsource\\b|\\bgenerated\\b|\\bbom\\b|\\bimage\\b|\\bthing\\b" | |
}, | |
"url":{ | |
"type":"string" | |
}, | |
"mimetype":{ | |
"type":"string" | |
}, | |
"unit":{ | |
"type":"string" | |
}, | |
"quantity":{ | |
"type":"number" | |
}, | |
"thumbnailUrl":{ | |
"type":"string" | |
}, | |
"xBomMetadata":{ | |
"type":"object" | |
} | |
} | |
} | |
}, | |
"instructions":{ | |
"type":"array", | |
"items":{ | |
"type":"object", | |
"properties":{ | |
"step":{ | |
"type":"number" | |
}, | |
"text":{ | |
"type":"string" | |
}, | |
"imagUurls":{ | |
"type":"array", | |
"items":{ | |
"type":"string" | |
} | |
}, | |
"xInstructionMetadata":{ | |
"type":"object" | |
} | |
} | |
} | |
}, | |
"xThingMetadata":{ | |
"type":"object" | |
} | |
} | |
}, | |
"required":True | |
}, | |
"thingsCache":{ | |
"type":"object", | |
"properties":{ | |
"url":{ | |
"type":"string", | |
"required":True | |
}, | |
"thingsCount":{ | |
"type":"number" | |
}, | |
"updated":{ | |
"type":"string", | |
"pattern":"^\\d{4}-[01]?[0-9]{1}-[0123]?[0-9]{1}T[012]?[0-9]{1}:[0-5]?[0-9]{1}:[0-5]?[0-9]{1}\\.?\\d+(([+|-]{1}\\d+:\\d+)|Z)$" | |
}, | |
"xThingsCacheMetadata":{ | |
"type":"object" | |
} | |
} | |
}, | |
"xTrackerMetadata":{ | |
"type":"object" | |
}, | |
"trackers":{ | |
"type":"array", | |
"items":{ | |
"type":"object", | |
"properties":{ | |
"id":{ | |
"type":"string" | |
}, | |
"url":{ | |
"type":"string", | |
"required":True | |
}, | |
"accessed":{ | |
"type":"string", | |
"pattern":"^\\d{4}-[01]?[0-9]{1}-[0123]?[0-9]{1}T[012]?[0-9]{1}:[0-5]?[0-9]{1}:[0-5]?[0-9]{1}\\.?\\d+(([+|-]{1}\\d+:\\d+)|Z)$" | |
}, | |
"status":{ | |
"type":"string", | |
"pattern":"\\bunknown\\b|\\bok\\b|\\berror\\b" | |
}, | |
"thingsCache":{ | |
"type":"object", | |
"properties":{ | |
"url":{ | |
"type":"string", | |
"required":True | |
}, | |
"thingsCount":{ | |
"type":"number" | |
}, | |
"updated":{ | |
"type":"string", | |
"pattern":"^\\d{4}-[01]?[0-9]{1}-[0123]?[0-9]{1}T[012]?[0-9]{1}:[0-5]?[0-9]{1}:[0-5]?[0-9]{1}\\.?\\d+(([+|-]{1}\\d+:\\d+)|Z)$" | |
}, | |
"xThingsCacheMetadata":{ | |
"type":"object" | |
} | |
} | |
} | |
} | |
} | |
} | |
} | |
} | |
Draft3Validator.check_schema(schema) |
This file contains 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.validators import Draft3Validator | |
from jsonschema.exceptions import best_match | |
schema = { | |
"$schema":"http://json-schema.org/draft-03/schema#", | |
"type":"object", | |
"properties":{ | |
"id":{ | |
"type":"string" | |
}, | |
"version":{ | |
"type":"number" | |
}, | |
"url":{ | |
"type":"string" | |
}, | |
"description":{ | |
"type":"string" | |
}, | |
"updated":{ | |
"type":"string", | |
"pattern":"^\\d{4}-[01]?[0-9]{1}-[0123]?[0-9]{1}T[012]?[0-9]{1}:[0-5]?[0-9]{1}:[0-5]?[0-9]{1}\\.?\\d+(([+|-]{1}\\d+:\\d+)|Z)$" | |
}, | |
"thingsCount":{ | |
"type":"number" | |
}, | |
"trackersCount":{ | |
"type":"number" | |
}, | |
"trackersTraversalDepth":{ | |
"type":"number" | |
}, | |
"maintainers":{ | |
"type":"array", | |
"items":{ | |
"type":"object", | |
"properties":{ | |
"name":{ | |
"type":"string", | |
"required":True | |
}, | |
"url":{ | |
"type":"string" | |
}, | |
"email":{ | |
"type":"string" | |
}, | |
"xIdentityMetadata":{ | |
"type":"object", | |
"id":"id-42300" | |
} | |
} | |
} | |
}, | |
"things":{ | |
"type":"array", | |
"items":{ | |
"type":"object", | |
"properties":{ | |
"id":{ | |
"type":"string", | |
"required":True | |
}, | |
"title":{ | |
"type":"string", | |
"required":True | |
}, | |
"url":{ | |
"type":"string" | |
}, | |
"downloadUrl":{ | |
"type":"string" | |
}, | |
"authors":{ | |
"type":"array", | |
"items":{ | |
"type":"object", | |
"properties":{ | |
"name":{ | |
"type":"string", | |
"required":True | |
}, | |
"url":{ | |
"type":"string" | |
}, | |
"email":{ | |
"type":"string" | |
}, | |
"xIdentityMetadata":{ | |
"type":"object" | |
} | |
} | |
} | |
}, | |
"licenses":{ | |
"type":"array", | |
"items":{ | |
"type":"string" | |
} | |
}, | |
"thumbnailUrls":{ | |
"type":"array", | |
"items":{ | |
"type":"string" | |
} | |
}, | |
"description":{ | |
"type":"string" | |
}, | |
"created":{ | |
"type":"string", | |
"pattern":"^\\d{4}-[01]?[0-9]{1}-[0123]?[0-9]{1}T[012]?[0-9]{1}:[0-5]?[0-9]{1}:[0-5]?[0-9]{1}\\.?\\d+(([+|-]{1}\\d+:\\d+)|Z)$" | |
}, | |
"updated":{ | |
"type":"string", | |
"pattern":"^\\d{4}-[01]?[0-9]{1}-[0123]?[0-9]{1}T[012]?[0-9]{1}:[0-5]?[0-9]{1}:[0-5]?[0-9]{1}\\.?\\d+(([+|-]{1}\\d+:\\d+)|Z)$" | |
}, | |
"metadata":{ | |
"type":"object", | |
"properties":{ | |
"created":{ | |
"type":"string", | |
"pattern":"^\\d{4}-[01]?[0-9]{1}-[0123]?[0-9]{1}T[012]?[0-9]{1}:[0-5]?[0-9]{1}:[0-5]?[0-9]{1}\\.?\\d+(([+|-]{1}\\d+:\\d+)|Z)$" | |
}, | |
"updated":{ | |
"type":"string", | |
"pattern":"^\\d{4}-[01]?[0-9]{1}-[0123]?[0-9]{1}T[012]?[0-9]{1}:[0-5]?[0-9]{1}:[0-5]?[0-9]{1}\\.?\\d+(([+|-]{1}\\d+:\\d+)|Z)$" | |
}, | |
"submitter":{ | |
"type":"object", | |
"properties":{ | |
"name":{ | |
"type":"string", | |
"required":True | |
}, | |
"url":{ | |
"type":"string" | |
}, | |
"email":{ | |
"type":"string" | |
}, | |
"xIdentityMetadata":{ | |
"type":"object" | |
} | |
} | |
} | |
} | |
}, | |
"subject":{ | |
"type":"array", | |
"items":{ | |
"type":"string" | |
} | |
}, | |
"media":{ | |
"type":"array", | |
"items":{ | |
"type":"string" | |
} | |
}, | |
"categories":{ | |
"type":"array", | |
"items":{ | |
"type":"string" | |
} | |
}, | |
"tags":{ | |
"type":"array", | |
"items":{ | |
"type":"string" | |
} | |
}, | |
"relationships":{ | |
"type":"array", | |
"items":{ | |
"type":"object", | |
"properties":{ | |
"title":{ | |
"type":"string" | |
}, | |
"type":{ | |
"type":"string" | |
}, | |
"url":{ | |
"type":"string" | |
}, | |
"xRelationshipMetadata":{ | |
"type":"object" | |
} | |
} | |
} | |
}, | |
"billOfMaterials":{ | |
"type":"array", | |
"items":{ | |
"type":"object", | |
"properties":{ | |
"partNumber":{ | |
"type":"string" | |
}, | |
"description":{ | |
"type":"string" | |
}, | |
"type":{ | |
"type":"string", | |
"pattern":"\\bsource\\b|\\bgenerated\\b|\\bbom\\b|\\bimage\\b|\\bthing\\b" | |
}, | |
"url":{ | |
"type":"string" | |
}, | |
"mimetype":{ | |
"type":"string" | |
}, | |
"unit":{ | |
"type":"string" | |
}, | |
"quantity":{ | |
"type":"number" | |
}, | |
"thumbnailUrl":{ | |
"type":"string" | |
}, | |
"xBomMetadata":{ | |
"type":"object" | |
} | |
} | |
} | |
}, | |
"instructions":{ | |
"type":"array", | |
"items":{ | |
"type":"object", | |
"properties":{ | |
"step":{ | |
"type":"number" | |
}, | |
"text":{ | |
"type":"string" | |
}, | |
"imagUurls":{ | |
"type":"array", | |
"items":{ | |
"type":"string" | |
} | |
}, | |
"xInstructionMetadata":{ | |
"type":"object" | |
} | |
} | |
} | |
}, | |
"xThingMetadata":{ | |
"type":"object" | |
} | |
} | |
}, | |
"required":True | |
}, | |
"thingsCache":{ | |
"type":"object", | |
"properties":{ | |
"url":{ | |
"type":"string", | |
"required":True | |
}, | |
"thingsCount":{ | |
"type":"number" | |
}, | |
"updated":{ | |
"type":"string", | |
"pattern":"^\\d{4}-[01]?[0-9]{1}-[0123]?[0-9]{1}T[012]?[0-9]{1}:[0-5]?[0-9]{1}:[0-5]?[0-9]{1}\\.?\\d+(([+|-]{1}\\d+:\\d+)|Z)$" | |
}, | |
"xThingsCacheMetadata":{ | |
"type":"object" | |
} | |
} | |
}, | |
"xTrackerMetadata":{ | |
"type":"object" | |
}, | |
"trackers":{ | |
"type":"array", | |
"items":{ | |
"type":"object", | |
"properties":{ | |
"id":{ | |
"type":"string" | |
}, | |
"url":{ | |
"type":"string", | |
"required":True | |
}, | |
"accessed":{ | |
"type":"string", | |
"pattern":"^\\d{4}-[01]?[0-9]{1}-[0123]?[0-9]{1}T[012]?[0-9]{1}:[0-5]?[0-9]{1}:[0-5]?[0-9]{1}\\.?\\d+(([+|-]{1}\\d+:\\d+)|Z)$" | |
}, | |
"status":{ | |
"type":"string", | |
"pattern":"\\bunknown\\b|\\bok\\b|\\berror\\b" | |
}, | |
"thingsCache":{ | |
"type":"object", | |
"properties":{ | |
"url":{ | |
"type":"string", | |
"required":True | |
}, | |
"thingsCount":{ | |
"type":"number" | |
}, | |
"updated":{ | |
"type":"string", | |
"pattern":"^\\d{4}-[01]?[0-9]{1}-[0123]?[0-9]{1}T[012]?[0-9]{1}:[0-5]?[0-9]{1}:[0-5]?[0-9]{1}\\.?\\d+(([+|-]{1}\\d+:\\d+)|Z)$" | |
}, | |
"xThingsCacheMetadata":{ | |
"type":"object" | |
} | |
} | |
} | |
} | |
} | |
} | |
} | |
} | |
instance = { | |
"version":0.0, | |
"id":"832769e0-e7fc-11e3-ac10-0800200c9a66", | |
"url":"http://garyhodgson.com/thingtracker", | |
"description":"An example tracker to demonstrate how it might look.", | |
"updated":"2013-01-22T23:45:00+01:00", | |
"thingsCount":2, | |
"trackersCount":1, | |
"trackersTraversalDepth":1, | |
"maintainers":[ | |
{ | |
"name":"Gary Hodgson", | |
"url":"http://garyhodgson.com/reprap", | |
"email":"contact@garyhodgson.com" | |
} | |
], | |
"things":[ | |
{ | |
"id":"cdebf011-e999-4dc5-b4c2-c4163f5584a0", | |
"title":"strandbeest", | |
"url":"http://garyhodgson.github.com/strandbeest", | |
"authors":[ | |
{ | |
"name":"Gary Hodgson", | |
"url":"http://garyhodgson.com/reprap", | |
"email":"contact@garyhodgson.com" | |
} | |
], | |
"licenses":[ | |
"GPL3" | |
], | |
"tags":[ | |
"mechanical movement", | |
"fun" | |
], | |
"thumbnailUrls":[ | |
"https://github.com/garyhodgson/strandbeest/raw/master/img/assembly.png" | |
], | |
"description":"Work in Progress!!\\n\\nMy take on implementing Theo Jansen's Strandbeest on a 3D printer.\\n\\nUsing the \"Theo Jansen Linkage 11 holy numbers\" together with the top j strut as a reference point use the ratio to determine lengths See: http://www.strandbeest.com/beests_leg.php and http://www.instructables.com/community/theo-jansen-mechanism-1/" | |
}, | |
{ | |
"id":"f8736600-ff82-4a92-a5e9-fdeeeeb259fe", | |
"title":"Mechanical Movement #27", | |
"url":"https://github.com/garyhodgson/mechanical-movement-27", | |
"authors":[ | |
{ | |
"name":"Gary Hodgson", | |
"url":"https://github.com/garyhodgson" | |
} | |
], | |
"licenses":[ | |
"GPL3" | |
], | |
"thumbnailUrls":[ | |
"https://github.com/garyhodgson/mechanical-movement-27/raw/master/img/test-jig.jpg" | |
], | |
"description":"An implementation of movement #27 from \"501 Mechanical Movements\" by Henry T. Brown.\\n\\nThis is still a work in progress.", | |
"created":"2012-09-03T14:50:20.000Z", | |
"updated":"2012-09-14T21:50:52.000Z", | |
"metadata":{ | |
"created":"2013-01-17T20:13:30.362Z", | |
"updated":"2013-01-17T20:13:30.362Z", | |
"submitter":{ | |
"name":"Gary Hodgson", | |
"url":"http://garyhodgson.com/reprap", | |
"email":"contact@garyhodgson.com" | |
} | |
}, | |
"subject":[ | |
"mechanism" | |
], | |
"media":[ | |
"PLA" | |
], | |
"categories":[ | |
"mechanical movement" | |
], | |
"tags":[ | |
"fun" | |
], | |
"relationships":[ | |
{ | |
"title":"Details of the legs.", | |
"type":"reference", | |
"url":"http://www.strandbeest.com/beests_leg.php" | |
}, | |
{ | |
"title":"Example implementation.", | |
"type":"reference", | |
"url":"http://www.instructables.com/community/theo-jansen-mechanism-1" | |
} | |
], | |
"billOfMaterials":[ | |
{ | |
"partNumber":"1", | |
"description":"Frame", | |
"url":"https://github.com/garyhodgson/mechanical-movement-27/raw/master/stl/MechanicalMovement27_frame.stl", | |
"type":"generated", | |
"mimetype":"application/sla", | |
"thumbnailUrl":"https://github.com/garyhodgson/mechanical-movement-27/raw/master/img/frame.png", | |
"xBomMetadata":{ | |
"note":"This part has not yet been tested." | |
} | |
}, | |
{ | |
"partNumber":"2", | |
"description":"Small Wheel", | |
"url":"https://raw.github.com/garyhodgson/mechanical-movement-27/master/stl/MechanicalMovement27_small_wheel.stl", | |
"type":"generated", | |
"mimetype":"application/sla", | |
"thumbnailUrl":"https://github.com/garyhodgson/mechanical-movement-27/raw/master/img/small_wheel.png" | |
}, | |
{ | |
"partNumber":"3", | |
"description":"Wheel", | |
"url":"https://raw.github.com/garyhodgson/mechanical-movement-27/master/stl/MechanicalMovement27_wheel.stl", | |
"type":"generated", | |
"mimetype":"application/sla", | |
"thumbnailUrl":"https://github.com/garyhodgson/mechanical-movement-27/raw/master/img/wheel.png" | |
}, | |
{ | |
"partNumber":"4", | |
"description":"OpenSCAD Source Code", | |
"url":"https://raw.github.com/garyhodgson/mechanical-movement-27/master/src/MechanicalMovement27.scad", | |
"type":"source", | |
"mimetype":"application/x-scad" | |
}, | |
{ | |
"partNumber":"5", | |
"description":"623ZZ Bearing", | |
"unit":"EA", | |
"quantity":3 | |
}, | |
{ | |
"partNumber":"6", | |
"description":"M3 Bolt", | |
"unit":"EA", | |
"quantity":3 | |
}, | |
{ | |
"partNumber":"7", | |
"description":"M4 Bolt", | |
"unit":"EA", | |
"quantity":1 | |
}, | |
{ | |
"partNumber":"8", | |
"description":"M5 Bolt", | |
"unit":"EA", | |
"quantity":1 | |
} | |
], | |
"instructions":[ | |
{ | |
"step":1, | |
"text":"Print out the Frame, Small Wheel and Large Wheel.", | |
"imageUrls":[ | |
"https://github.com/garyhodgson/mechanical-movement-27/raw/master/img/frame.png", | |
"https://github.com/garyhodgson/mechanical-movement-27/raw/master/img/wheel.png", | |
"https://github.com/garyhodgson/mechanical-movement-27/raw/master/img/small_wheel.png" | |
] | |
}, | |
{ | |
"step":2, | |
"text":"Attach three 623ZZ bearings to the small wheel with the short M3 bolts." | |
}, | |
{ | |
"step":3, | |
"text":"Connect the small and large wheel to the frame with an M4 and M5 bolt respectively.", | |
"imageUrls":[ | |
"https://github.com/garyhodgson/mechanical-movement-27/raw/master/img/test-jig.jpg" | |
], | |
"xInstructionMetadata":{ | |
"note":"So far the wheels have been printed and tested, but not yet the frame. This is shown in the attached image." | |
} | |
} | |
] | |
} | |
], | |
"thingsCache":{ | |
"url":"http://garyhodgson.com/thingtracker/thingscache", | |
"thingsCount":302, | |
"updated":"2013-01-22T23:00:00+01:00" | |
}, | |
"trackers":[ | |
{ | |
"id":"3d715220-ae50-44d1-b4fd-1eabdc71c00a", | |
"url":"http://reprap.development-tracker.info/thingtracker", | |
"accessed":"2013-01-22T23:00:00+01:00", | |
"status":"ok", | |
"thingsCache":{ | |
"url":"http://garyhodgson.com/thingtracker/tracker/3d715220-ae50-44d1-b4fd-1eabdc71c00a/thingscache", | |
"thingsCount":300, | |
"updated":"2013-01-22T23:02:00+01:00" | |
} | |
} | |
] | |
} | |
Draft3Validator.check_schema(schema) | |
Draft3Validator(schema).validate(instance) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment