Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from jsonschema import validate
- schema_version = {
- "$schema": "http://json-schema.org/schema#",
- "type": "object",
- "properties": {
- "version": {
- "type": "string",
- "pattern": "^[0-9]{0,3}.[0-9]{0,3}.[0-9]{0,3}$"
- },
- "url": {
- "type": "string",
- "format": "uri"
- },
- "mandatory": {
- "type": "boolean"
- }
- },
- "required": ["version", "url"],
- "additionalProperties": False
- }
- schema_versions = {
- "$schema": "http://json-schema.org/schema#",
- "type": "object",
- "properties": {
- "platforms": {
- "type": "object",
- "patternProperties": {
- "^ios|android$": {
- "type": "array",
- "items": {
- "$ref": "version.json"
- },
- "minItems": 1,
- "uniqueItems": True
- }
- },
- "additionalProperties": False
- }
- },
- "required": ["platforms"],
- "additionalProperties": False
- }
- versions = {
- "platforms": {
- "ios": [
- {
- "version": "0.9.26",
- "mandatory": False,
- "url": "https://www.example.com/"
- },
- {
- "version": "0.9.27",
- "mandatory": True,
- "url": "https://www.example.com"
- }
- ]
- }
- }
- validate(version, schema_versions)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement