From 71576f81d9f69a4c1ff3a215f558c6f950bd552e Mon Sep 17 00:00:00 2001 From: Souheil CHELFOUH Date: Tue, 6 Jun 2023 17:46:52 +0200 Subject: [PATCH] Fixed array with no subfield --- src/jsonschema_colander/types.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/jsonschema_colander/types.py b/src/jsonschema_colander/types.py index d73ee7e..aa3ddde 100644 --- a/src/jsonschema_colander/types.py +++ b/src/jsonschema_colander/types.py @@ -181,10 +181,13 @@ def get_widget(self, factory, options): def __call__(self): factory = self.get_factory() options = self.get_options() - subfield = self.subfield() - if not subfield.name: - subfield.name = 'item' - return factory(subfield, **options) + if self.subfield is not None: + subfield = self.subfield() + if not subfield.name: + subfield.name = 'item' + return factory(subfield, **options) + widget = self.get_widget(factory, options) + return colander.SchemaNode(factory(), widget=widget, **options) @classmethod def extract(cls, params: Mapping, available: set):