Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from jsonschema import validate
- schema = {
- "type": "object",
- "properties": {
- "rabbitmq": {
- "type": "object",
- "properties": {
- "host": {"type": "string"},
- "port": {"type": "number"},
- "root": {"type": "string"},
- "login": {"type": "string"},
- "password": {"type": "string"},
- "exchange": {"type": "string"}
- },
- "required": [
- "host",
- "port",
- "root",
- "login",
- "password",
- "exchange"
- ]
- },
- "sftp": {
- "type": "object",
- "properties": {
- "host": {"type": "string"},
- "port": {"type": "number"},
- "login": {"type": "string"},
- "password": {"type": "string"},
- "cdr_dir": {"type": "string"},
- "remove_after_download": {"type": "string"}
- },
- "required": [
- "host",
- "port",
- "login",
- "password",
- "cdr_dir",
- "remove_after_download"
- ]
- }
- },
- "required": [
- "rabbitmq",
- "sftp"
- ]
- }
- obj = {
- "cassandra": {
- "cluster": [
- "192.168.99.100"
- ],
- "port": 9042,
- "keyspace": "cdr",
- "batch_size": 50
- },
- "redis": {
- "host": "192.168.99.100",
- "port": 6379,
- "password": "",
- "db": 0
- },
- "delimiter": ";"
- }
- print validate(schema, obj)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement