Skip to content

Commit cae8e10

Browse files
committed
Allow OpenAPIConverter to use _jsonschema_type_mapping
1 parent 3671552 commit cae8e10

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/labthings/apispec/converter.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
from apispec.ext.marshmallow import OpenAPIConverter
2-
from ..fields import Bytes as BytesField
32

43

54
class ExtendedOpenAPIConverter(OpenAPIConverter):
@@ -11,6 +10,7 @@ def init_attribute_functions(self, *args, **kwargs):
1110

1211
def bytes2json(self, field, **kwargs):
1312
ret = {}
14-
if isinstance(field, BytesField):
15-
ret.update(BytesField()._jsonschema_type_mapping())
13+
if hasattr(field, "_jsonschema_type_mapping"):
14+
schema = field._jsonschema_type_mapping()
15+
ret.update(schema)
1616
return ret

0 commit comments

Comments
 (0)