diff --git a/CHANGELOG.md b/CHANGELOG.md index 17c0cbf..5d86e8d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,12 +13,10 @@ New: - cookie auth & its specification in TD (cookie auth branch) - adding custom handlers for each property, action and event to override default behaviour -Bug Fixes: -- composed sub`Thing`s exposed with correct URL path - ## [v0.2.8] - 2024-12-06 - pydantic & JSON schema support for property models +- composed sub`Thing`s exposed with correct URL path ## [v0.2.7] - 2024-10-22 diff --git a/hololinked/server/dataklasses.py b/hololinked/server/dataklasses.py index 8005411..320ee9a 100644 --- a/hololinked/server/dataklasses.py +++ b/hololinked/server/dataklasses.py @@ -569,8 +569,9 @@ def get_organised_resources(instance): # second condition allows sharing of Things without adding once again to the list of exposed resources # for example, a shared logger continue - resource._owner = instance - resource._prepare_resources() + if resource._owner is None: + resource._owner = instance + resource._prepare_resources() httpserver_resources.update(resource.httpserver_resources) # zmq_resources.update(resource.zmq_resources) instance_resources.update(resource.instance_resources) diff --git a/hololinked/server/td.py b/hololinked/server/td.py index 0106ab9..ac3d8c0 100644 --- a/hololinked/server/td.py +++ b/hololinked/server/td.py @@ -736,8 +736,7 @@ class ThingDescription(Schema): 'events', 'thing_description', 'GUI', 'object_info' ] skip_actions = ['_set_properties', '_get_properties', '_add_property', '_get_properties_in_db', - 'push_events', 'stop_events', 'get_postman_collection', 'get_thing_description', - 'get_our_temp_thing_description'] + 'get_postman_collection', 'get_thing_description', 'get_our_temp_thing_description'] # not the best code and logic, but works for now @@ -779,12 +778,18 @@ def add_interaction_affordances(self): if (resource.obj_name == 'state' and (not hasattr(self.instance, 'state_machine') or not isinstance(self.instance.state_machine, StateMachine))): continue + if resource.obj_name not in self.instance.properties: + continue self.properties[resource.obj_name] = PropertyAffordance.generate_schema(resource.obj, self.instance, self.authority) elif (resource.isaction and resource.obj_name not in self.actions and resource.obj_name not in self.skip_actions and hasattr(resource.obj, '_remote_info')): - + + if resource.bound_obj != self.instance or (resource.obj_name == 'exit' and + self.instance._owner is not None) or (not hasattr(resource.bound_obj, 'db_engine') and + resource.obj_name == 'load_properties_from_DB'): + continue self.actions[resource.obj_name] = ActionAffordance.generate_schema(resource.obj, self.instance, self.authority) except Exception as ex: