diff --git a/nova/api/openstack/compute/schemas/server_tags.py b/nova/api/openstack/compute/schemas/server_tags.py index e390def58ecc..e9f43a5f62bc 100644 --- a/nova/api/openstack/compute/schemas/server_tags.py +++ b/nova/api/openstack/compute/schemas/server_tags.py @@ -45,3 +45,37 @@ show_query = { 'properties': {}, 'additionalProperties': True, } + +show_response = {'type': 'null'} + +index_response = { + 'type': 'object', + 'properties': { + 'tags': { + 'type': 'array', + 'items': parameter_types.tag, + 'additionalItems': False, + }, + }, + 'required': ['tags'], + 'additionalProperties': False, +} + +update_response = {'type': 'null'} + +update_all_response = { + 'type': 'object', + 'properties': { + 'tags': { + 'type': 'array', + 'items': parameter_types.tag, + 'additionalItems': False, + }, + }, + 'required': ['tags'], + 'additionalProperties': False, +} + +delete_response = {'type': 'null'} + +delete_all_response = {'type': 'null'} diff --git a/nova/api/openstack/compute/server_tags.py b/nova/api/openstack/compute/server_tags.py index b8600d695c83..1cb046bc5534 100644 --- a/nova/api/openstack/compute/server_tags.py +++ b/nova/api/openstack/compute/server_tags.py @@ -41,6 +41,7 @@ def _get_instance_mapping(context, server_id): raise webob.exc.HTTPNotFound(explanation=e.format_message()) +@validation.validated class ServerTagsController(wsgi.Controller): _view_builder_class = server_tags.ViewBuilder @@ -64,6 +65,7 @@ class ServerTagsController(wsgi.Controller): @wsgi.response(204) @wsgi.expected_errors(404) @validation.query_schema(schema.show_query) + @validation.response_body_schema(schema.show_response) def show(self, req, server_id, id): context = req.environ["nova.context"] im = _get_instance_mapping(context, server_id) @@ -84,6 +86,7 @@ class ServerTagsController(wsgi.Controller): @wsgi.api_version("2.26") @wsgi.expected_errors(404) @validation.query_schema(schema.index_query) + @validation.response_body_schema(schema.index_response) def index(self, req, server_id): context = req.environ["nova.context"] im = _get_instance_mapping(context, server_id) @@ -101,6 +104,7 @@ class ServerTagsController(wsgi.Controller): @wsgi.api_version("2.26") @wsgi.expected_errors((400, 404, 409)) @validation.schema(schema.update) + @validation.response_body_schema(schema.update_response) def update(self, req, server_id, id, body): context = req.environ["nova.context"] im = _get_instance_mapping(context, server_id) @@ -154,6 +158,7 @@ class ServerTagsController(wsgi.Controller): @wsgi.api_version("2.26") @wsgi.expected_errors((404, 409)) @validation.schema(schema.update_all) + @validation.response_body_schema(schema.update_all_response) def update_all(self, req, server_id, body): context = req.environ["nova.context"] im = _get_instance_mapping(context, server_id) @@ -179,6 +184,7 @@ class ServerTagsController(wsgi.Controller): @wsgi.api_version("2.26") @wsgi.response(204) @wsgi.expected_errors((404, 409)) + @validation.response_body_schema(schema.delete_response) def delete(self, req, server_id, id): context = req.environ["nova.context"] im = _get_instance_mapping(context, server_id) @@ -204,6 +210,7 @@ class ServerTagsController(wsgi.Controller): @wsgi.api_version("2.26") @wsgi.response(204) @wsgi.expected_errors((404, 409)) + @validation.response_body_schema(schema.delete_all_response) def delete_all(self, req, server_id): context = req.environ["nova.context"] im = _get_instance_mapping(context, server_id)