@@ -111,7 +111,10 @@ def test_td_action(app, thing_description, view_cls, app_ctx, schemas_path):
111111
112112
113113def test_td_action_with_schema (app , thing_description , view_cls , app_ctx , schemas_path ):
114- view_cls .post .__apispec__ = {"_params" : {"integer" : fields .Int ()}}
114+ view_cls .post .__apispec__ = {
115+ "_params" : {"integer" : fields .Int ()},
116+ "@type" : "ToggleAction" ,
117+ }
115118
116119 app .add_url_rule ("/" , view_func = view_cls .as_view ("index" ))
117120 rules = app .url_map ._rules_by_endpoint ["index" ]
@@ -123,6 +126,7 @@ def test_td_action_with_schema(app, thing_description, view_cls, app_ctx, schema
123126 assert thing_description .to_dict ().get ("actions" ).get ("index" ).get ("input" ) == {
124127 "type" : "object" ,
125128 "properties" : {"integer" : {"type" : "integer" , "format" : "int32" }},
129+ "@type" : "ToggleAction" ,
126130 }
127131 validate_thing_description (thing_description , app_ctx , schemas_path )
128132
@@ -147,7 +151,10 @@ class Index(View):
147151 def get (self ):
148152 return "GET"
149153
150- Index .__apispec__ = {"_propertySchema" : {"integer" : fields .Int ()}}
154+ Index .__apispec__ = {
155+ "_propertySchema" : {"integer" : fields .Int ()},
156+ "@type" : "OnOffProperty" ,
157+ }
151158
152159 app .add_url_rule ("/" , view_func = Index .as_view ("index" ))
153160 rules = app .url_map ._rules_by_endpoint ["index" ]
@@ -156,6 +163,7 @@ def get(self):
156163
157164 with app_ctx .test_request_context ():
158165 assert "index" in thing_description .to_dict ().get ("properties" )
166+ assert "@type" in thing_description .to_dict ().get ("properties" ).get ("index" , {})
159167 validate_thing_description (thing_description , app_ctx , schemas_path )
160168
161169
0 commit comments