Skip to content

Instantly share code, notes, and snippets.

@ihpd
Created January 26, 2013 14:53
Show Gist options
  • Save ihpd/4642802 to your computer and use it in GitHub Desktop.
Save ihpd/4642802 to your computer and use it in GitHub Desktop.
import json
import os
import validictory
irc_schema = { "type": "object",
"properties":{
"config": {
"type": "object",
"properties": {
"protocol_plugin": {
"type": "string"
},
"connection_protocol_type": {
"type": "string"
},
"log_plugins": {
"type": "string",
},
"nick": {
"type": "string",
},
"host": {
"type": "string",
},
"port": {
"type": "string",
},
"channel": {
"type": "string",
},
"reconn_attempts": {
"type": "string",
}
}
}
}
}
json_data = open('settings.set')
data = json.load(json_data)
try:
data2 = validictory.validate(data, irc_schema)
except ValueError, error:
print error
@glaslos
Copy link

glaslos commented Jan 28, 2013

port and reconn_attempts should be int, please define all properties as required

@ihpd
Copy link
Author

ihpd commented Jan 28, 2013

Both the parameters are passed as string and not as int

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment