summaryrefslogtreecommitdiff
path: root/README.md
blob: 9ae3dc457839bb2a3b1c9d927ea4fe81bbb9d0b2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# Warlock!

1) Create a class

    import warlock

	schema = {
	    'name': 'Country',
	    'properties': {
	        'name': {'type': 'string'},
	        'abbreviation': {'type': 'string'},
	    },
	}

	Country = warlock.model_factory(schema)

2) Create an object using your class

	sweden = Country(name='Sweden', abbreviation='SE')

3) Let the object validate itself!

    sweden.name = 5
    # Raises ValueError

    sweden.overlord = 'Bears'
    # Raises AttributeError