From 34af06b1d113df539732400a349e10a6a6a5c100 Mon Sep 17 00:00:00 2001 From: Richard Date: Mon, 19 Jul 2021 22:21:39 +0100 Subject: [PATCH] Document route parameter in nested dictionaries --- .../api/v2/views/instrument.py | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/openflexure_microscope/api/v2/views/instrument.py b/openflexure_microscope/api/v2/views/instrument.py index 28d9ea8a..8bb2e37d 100644 --- a/openflexure_microscope/api/v2/views/instrument.py +++ b/openflexure_microscope/api/v2/views/instrument.py @@ -32,9 +32,24 @@ class SettingsProperty(PropertyView): return self.get() +ROUTE_PARAMETER = { + "name": "route", + "in": "path", + "description": ( + "The location of a key or sub-dictionary. " + + "This is formatted like a path, i.e. forward " + + "slashes delimit components of the path." + ), + "required": True, + "schema": {"type": "string"}, + "example": "camera/exposure_time", +} + + class NestedSettingsProperty(View): tags = ["properties"] responses = {404: {"description": "Settings key cannot be found"}} + parameters = [ROUTE_PARAMETER] def get(self, route: str): """ @@ -79,6 +94,7 @@ class StateProperty(PropertyView): class NestedStateProperty(View): tags = ["properties"] responses = {404: {"description": "Status key cannot be found"}} + parameters = [ROUTE_PARAMETER] def get(self, route): """ @@ -107,6 +123,7 @@ class ConfigurationProperty(PropertyView): class NestedConfigurationProperty(View): tags = ["properties"] responses = {404: {"description": "Status key cannot be found"}} + parameters = [ROUTE_PARAMETER] def get(self, route): """