diff --git a/python_jsonschema_objects/classbuilder.py b/python_jsonschema_objects/classbuilder.py
index b230977..f162565 100644
--- a/python_jsonschema_objects/classbuilder.py
+++ b/python_jsonschema_objects/classbuilder.py
@@ -453,6 +453,7 @@ class ClassBuilder(object):
         logger.debug(util.lazy_format("Constructing {0}", uri))
         if ("override" not in kw or kw["override"] is False) and uri in self.resolved:
             logger.debug(util.lazy_format("Using existing {0}", uri))
+            assert self.resolved[uri] is not None
             return self.resolved[uri]
         else:
             ret = self._construct(uri, *args, **kw)
diff --git a/python_jsonschema_objects/wrapper_types.py b/python_jsonschema_objects/wrapper_types.py
index 3f90998..c2ce58f 100644
--- a/python_jsonschema_objects/wrapper_types.py
+++ b/python_jsonschema_objects/wrapper_types.py
@@ -122,8 +122,7 @@ class ArrayWrapper(collections.MutableSequence):
     def validate_uniqueness(self):
 
         if getattr(self, "uniqueItems", False) is True:
-
-            testset = set(self.data)
+            testset = set(repr(item) for item in self.data)
             if len(testset) != len(self.data):
                 raise ValidationError(
                     "{0} has duplicate elements, but uniqueness required".format(
@@ -303,7 +302,6 @@ class ArrayWrapper(collections.MutableSequence):
 
                         with klassbuilder.resolver.resolving(uri) as resolved:
                             # Set incase there is a circular reference in schema definition
-                            klassbuilder.resolved[uri] = None
                             klassbuilder.resolved[uri] = klassbuilder.construct(
                                 uri, resolved, (classbuilder.ProtocolBase,)
                             )

Nesting array and objects problematic
Attached is a schema with python code - I could not get this to run. The problem is with this line:
objs = Array1([o1, o2])

The script is:
import python_jsonschema_objects as pjs

import collections

schema = {}
schema['Test'] = 'test.json'
builder = pjs.ObjectBuilder(schema['Test'])
ns = builder.build_classes()

print ([str(x) for x in dir(ns)])

Obj1 = ns.MyObj1
Array1 = ns.MyArray
Msg1 = ns.MyMsg1
o1 = Obj1(e1='E_A', e2='F_C', i1=2600)
o2 = Obj1(e1='E_B', e2='F_D', i1=2500)
objs = Array1([o1, o2])
msg = Msg1(a1=objs)

print(msg.serialize())

(also attached in the zip)

The output I get is:
['MyArray', 'MyEnum1', 'MyEnum2', 'MyInt', 'MyMsg1', 'MyMsg2', 'MyObj1', 'S1', 'Test']
Traceback (most recent call last):
  File "test.py", line 18, in <module>
    msg = Msg1(a1=objs)
  File "C:\...\Python\Python_3.6_x64\lib\site-packages\python_jsonschema_
objects\classbuilder.py", line 210, in __init__
    setattr(self, prop, props[prop])
  File "C:\...\Python\Python_3.6_x64\lib\site-packages\python_jsonschema_
objects\classbuilder.py", line 230, in __setattr__
    prop.fset(self, val)
  File "C:\...\Python\Python_3.6_x64\lib\site-packages\python_jsonschema_
objects\classbuilder.py", line 831, in setprop
    val.validate()
  File "C:\...\Python\Python_3.6_x64\lib\site-packages\python_jsonschema_
objects\wrapper_types.py", line 102, in validate
    self.validate_uniqueness()
  File "C:\...\Python\Python_3.6_x64\lib\site-packages\python_jsonschema_
objects\wrapper_types.py", line 109, in validate_uniqueness
    testset = set(self.data)
TypeError: unhashable type: 'MyObj1'

Am I doing something not allowed, or just plain wrong?

I was quite impressed with the simpler type handling for enums, integers and basic structs - but arrays seem to cause problems. Thanks for any answers!

[test.zip](https://github.com/cwacek/python-jsonschema-objects/files/1818853/test.zip)


diff --git a/test/test_regression_126.py b/test/test_regression_126.py
new file mode 100644
index 0000000..9709260
--- /dev/null
+++ b/test/test_regression_126.py
@@ -0,0 +1,58 @@
+import pytest
+import python_jsonschema_objects as pjs
+import collections
+
+
+@pytest.fixture
+def schema():
+    return {
+        "$schema": "http://json-schema.org/draft-04/schema#",
+        "title": "Test",
+        "definitions": {
+            "MyEnum1": {"type": "string", "enum": ["E_A", "E_B"]},
+            "MyEnum2": {"type": "string", "enum": ["F_A", "F_B", "F_C", "F_D"]},
+            "MyInt": {
+                "default": "0",
+                "type": "integer",
+                "minimum": 0,
+                "maximum": 4294967295,
+            },
+            "MyObj1": {
+                "type": "object",
+                "properties": {
+                    "e1": {"$ref": "#/definitions/MyEnum1"},
+                    "e2": {"$ref": "#/definitions/MyEnum2"},
+                    "i1": {"$ref": "#/definitions/MyInt"},
+                },
+                "required": ["e1", "e2", "i1"],
+            },
+            "MyArray": {
+                "type": "array",
+                "items": {"$ref": "#/definitions/MyObj1"},
+                "minItems": 0,
+                "uniqueItems": True,
+            },
+            "MyMsg1": {
+                "type": "object",
+                "properties": {"a1": {"$ref": "#/definitions/MyArray"}},
+            },
+            "MyMsg2": {"type": "object", "properties": {"s1": {"type": "string"}}},
+        },
+        "type": "object",
+        "oneOf": [{"$ref": "#/definitions/MyMsg1"}, {"$ref": "#/definitions/MyMsg2"}],
+    }
+
+
+def test_regression_126(schema):
+    builder = pjs.ObjectBuilder(schema)
+    ns = builder.build_classes(standardize_names=False)
+
+    Obj1 = ns.MyObj1
+    Array1 = ns.MyArray
+    Msg1 = ns.MyMsg1
+    o1 = Obj1(e1="E_A", e2="F_C", i1=2600)
+    o2 = Obj1(e1="E_B", e2="F_D", i1=2500)
+    objs = Array1([o1, o2])
+    msg = Msg1(a1=objs)
+
+    print(msg.serialize())

pip install -e .[dev]
parse_log_pytest
requirements.txt
pytest
apt-get update apt-get install -y gcc
3.6
development.txt
pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning
alabaster==0.7.13
attrs==22.2.0
Babel==2.11.0
certifi==2021.5.30
charset-normalizer==2.0.12
colorama==0.4.5
commonmark==0.9.1
docutils==0.18.1
idna==3.10
imagesize==1.4.1
importlib-metadata==4.8.3
inflection==0.5.1
iniconfig==1.1.1
Jinja2==3.0.3
jsonschema==3.2.0
livereload==2.6.3
Markdown==3.3.7
MarkupSafe==2.0.1
nose==1.3.0
packaging==21.3
pandoc==2.4
pluggy==1.0.0
plumbum==1.8.3
ply==3.11
py==1.11.0
pyandoc==0.2.0
Pygments==2.14.0
pyparsing==3.1.4
pyrsistent==0.18.0
pytest==7.0.1
pytest-mock==3.6.1
-e git+https://github.com/cwacek/python-jsonschema-objects.git@773f4be636fae50432d230fb6b7dad744d257bcc#egg=python_jsonschema_objects
python-termstyle==0.1.10
pytz==2025.2
recommonmark==0.7.1
rednose==0.4.1
requests==2.27.1
six==1.17.0
snowballstemmer==2.2.0
Sphinx==5.3.0
sphinx-autobuild==2021.3.14
sphinxcontrib-applehelp==1.0.2
sphinxcontrib-devhelp==1.0.2
sphinxcontrib-htmlhelp==2.0.0
sphinxcontrib-jsmath==1.0.1
sphinxcontrib-qthelp==1.0.3
sphinxcontrib-serializinghtml==1.1.5
tomli==1.2.3
tornado==6.1
typing_extensions==4.1.1
urllib3==1.26.20
zipp==3.6.0

name: python-jsonschema-objects
channels:
  - defaults
  - https://repo.anaconda.com/pkgs/main
  - https://repo.anaconda.com/pkgs/r
  - conda-forge
dependencies:
  - _libgcc_mutex=0.1=main
  - _openmp_mutex=5.1=1_gnu
  - ca-certificates=2025.2.25=h06a4308_0
  - certifi=2021.5.30=py36h06a4308_0
  - ld_impl_linux-64=2.40=h12ee557_0
  - libffi=3.3=he6710b0_2
  - libgcc-ng=11.2.0=h1234567_1
  - libgomp=11.2.0=h1234567_1
  - libstdcxx-ng=11.2.0=h1234567_1
  - ncurses=6.4=h6a678d5_0
  - openssl=1.1.1w=h7f8727e_0
  - pip=21.2.2=py36h06a4308_0
  - python=3.6.13=h12debd9_1
  - readline=8.2=h5eee18b_0
  - setuptools=58.0.4=py36h06a4308_0
  - sqlite=3.45.3=h5eee18b_0
  - tk=8.6.14=h39e8969_0
  - wheel=0.37.1=pyhd3eb1b0_0
  - xz=5.6.4=h5eee18b_1
  - zlib=1.2.13=h5eee18b_1
  - pip:
      - alabaster==0.7.13
      - attrs==22.2.0
      - babel==2.11.0
      - charset-normalizer==2.0.12
      - colorama==0.4.5
      - commonmark==0.9.1
      - docutils==0.18.1
      - idna==3.10
      - imagesize==1.4.1
      - importlib-metadata==4.8.3
      - inflection==0.5.1
      - iniconfig==1.1.1
      - jinja2==3.0.3
      - jsonschema==3.2.0
      - livereload==2.6.3
      - markdown==3.3.7
      - markupsafe==2.0.1
      - nose==1.3.0
      - packaging==21.3
      - pandoc==2.4
      - pluggy==1.0.0
      - plumbum==1.8.3
      - ply==3.11
      - py==1.11.0
      - pyandoc==0.2.0
      - pygments==2.14.0
      - pyparsing==3.1.4
      - pyrsistent==0.18.0
      - pytest==7.0.1
      - pytest-mock==3.6.1
      - python-termstyle==0.1.10
      - pytz==2025.2
      - recommonmark==0.7.1
      - rednose==0.4.1
      - requests==2.27.1
      - six==1.17.0
      - snowballstemmer==2.2.0
      - sphinx==5.3.0
      - sphinx-autobuild==2021.3.14
      - sphinxcontrib-applehelp==1.0.2
      - sphinxcontrib-devhelp==1.0.2
      - sphinxcontrib-htmlhelp==2.0.0
      - sphinxcontrib-jsmath==1.0.1
      - sphinxcontrib-qthelp==1.0.3
      - sphinxcontrib-serializinghtml==1.1.5
      - tomli==1.2.3
      - tornado==6.1
      - typing-extensions==4.1.1
      - urllib3==1.26.20
      - zipp==3.6.0
prefix: /opt/conda/envs/python-jsonschema-objects

test/test_regression_126.py::test_regression_126
python_jsonschema_objects/wrapper_types.py python_jsonschema_objects/classbuilder.py
python_jsonschema_objects/wrapper_types.py python_jsonschema_objects/classbuilder.py