Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Subthing exposed with correct URL path #52

Merged
merged 2 commits into from
Dec 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
5 changes: 3 additions & 2 deletions hololinked/server/dataklasses.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
11 changes: 8 additions & 3 deletions hololinked/server/td.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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:
Expand Down
Loading