diff --git a/CHANGELOG.md b/CHANGELOG.md index 89df8ae55..6dfc524c4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## Unreleased +### Fixed +- Any typing does not trigger error with subclass anymore + ## v0.7.0 ### Fixed diff --git a/dessia_common/utils/jsonschema.py b/dessia_common/utils/jsonschema.py index b5f3b39af..d75b2e601 100644 --- a/dessia_common/utils/jsonschema.py +++ b/dessia_common/utils/jsonschema.py @@ -228,6 +228,8 @@ def jsonschema_from_annotation(annotation, jsonschema_element, order, editable=N 'type': 'object', 'is_class': True, 'properties': {'name': {'type': 'string'}} }) + elif typing_ is Any: + jsonschema_element[key].update({'type': 'object', 'properties': {'.*': '.*'}}) elif inspect.isclass(typing_) and issubclass(typing_, Measure): ann = (key, float) jsonschema_element = jsonschema_from_annotation( @@ -237,11 +239,6 @@ def jsonschema_from_annotation(annotation, jsonschema_element, order, editable=N jsonschema_element[key]['units'] = typing_.units elif typing_ in [TextIO, BinaryIO] or issubclass(typing_, (BinaryFile, StringFile)): jsonschema_element[key].update({'type': 'text', 'is_file': True}) - elif typing_ is Any: - jsonschema_element[key].update({ - 'type': 'object', - 'properties': {'.*': '.*'} - }) else: classname = dc.full_classname(object_=typing_, compute_for='class') if inspect.isclass(typing_) and issubclass(typing_, dc.DessiaObject):