Skip to content

Commit 0912ff6

Browse files
author
Chris Wacek
committed
0.0.12 - Support true as a value for 'additionalProperties'
1 parent 7949873 commit 0912ff6

File tree

4 files changed

+20
-1
lines changed

4 files changed

+20
-1
lines changed

README.md

+10
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,14 @@ For instance:
106106
}
107107
```
108108

109+
``` schema
110+
{
111+
"title": "AddlPropsAllowed",
112+
"type": "object",
113+
"additionalProperties": true
114+
}
115+
```
116+
109117
``` schema
110118
{
111119
"title": "Other",
@@ -155,6 +163,8 @@ tox`, then `tox`.
155163

156164
## Changelog
157165

166+
0.0.12 - Support "true" as a value for 'additionalProperties'
167+
158168
0.0.11 - Generated wrappers can now properly deserialize data
159169
representing 'oneOf' relationships, so long as the candidate
160170
schemas are unique.

python_jsonschema_objects/classbuilder.py

+2
Original file line numberDiff line numberDiff line change
@@ -511,6 +511,8 @@ def _build_object(self, nm, clsdata, parents):
511511

512512
if addlProp is False:
513513
props['__extensible__'] = False
514+
elif addlProp is True:
515+
props['__extensible__'] = True
514516
else:
515517
if '$ref' in addlProp:
516518
refs = self.resolve_classes([addlProp])

setup.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ def parse_requirements(path):
6060
long_description = ''
6161

6262
setup(name='python_jsonschema_objects',
63-
version='0.0.11',
63+
version='0.0.12',
6464
description='An object wrapper for JSON Schema definitions',
6565
author='Chris Wacek',
6666
long_description=long_description,

test/test.py

+7
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,13 @@ def set_attribute(object):
7777

7878
int(person.randomAttribute).should.equal(4)
7979

80+
it 'should be oky with additionalProperties == True':
81+
builder = pjs.ObjectBuilder(self.examples['AddlPropsAllowed'], resolved=self.examples)
82+
builder.should.be.ok
83+
84+
test = builder.classes['Addlpropsallowed']()
85+
test.randomAttribute = 40
86+
8087
it 'should still raise errors when accessing undefined attributes':
8188

8289
person = self.Person()

0 commit comments

Comments
 (0)