diff --git a/marshmallow_jsonschema/base.py b/marshmallow_jsonschema/base.py index 1096363..2db5a3d 100644 --- a/marshmallow_jsonschema/base.py +++ b/marshmallow_jsonschema/base.py @@ -326,7 +326,7 @@ def _from_nested_schema(self, obj, field): self._nested_schema_classes.update(wrapped_nested._nested_schema_classes) # and the schema is just a reference to the def - schema = {"type": "object", "$ref": "#/definitions/{}".format(name)} + schema = self._schema_base(name) # NOTE: doubled up to maintain backwards compatibility metadata = field.metadata.get("metadata", {}) @@ -348,6 +348,9 @@ def _from_nested_schema(self, obj, field): return schema + def _schema_base(self, name): + return {"type": "object", "$ref": "#/definitions/{}".format(name)} + def dump(self, obj, **kwargs): """Take obj for later use: using class name to namespace definition.""" self.obj = obj