Ensure the JSON-Schema covers the legacy v2 API

The legacy v2 API compatible mode support the protection of JSON-Schema.
The input body will be validated with JSON-Schema, and the extra invalid
parameters will be filtered out of the input body instead of return
HTTPBadRequest 400.

But some of API are missing that protection, the JSON-Schema validation
was limited to the v2.1 API. This patch ensures those schema covers the
legacy v2 API.

Change-Id: Ie165b2a79efd56a299d2d4ebe40a6904a340414f
Closes-Bug: #1701451
This commit is contained in:
He Jie Xu 2017-06-30 14:47:20 +08:00 committed by Matt Riedemann
parent 09fd39b194
commit aaeea4bf39
3 changed files with 3 additions and 3 deletions

View File

@ -72,7 +72,7 @@ class EvacuateController(wsgi.Controller):
# backwards compatibility reasons.
@extensions.expected_errors((400, 404, 409))
@wsgi.action('evacuate')
@validation.schema(evacuate.evacuate, "2.1", "2.13")
@validation.schema(evacuate.evacuate, "2.0", "2.13")
@validation.schema(evacuate.evacuate_v214, "2.14", "2.28")
@validation.schema(evacuate.evacuate_v2_29, "2.29")
def _evacuate(self, req, id, body):

View File

@ -63,7 +63,7 @@ class MigrateServerController(wsgi.Controller):
@wsgi.response(202)
@extensions.expected_errors((400, 404, 409))
@wsgi.action('os-migrateLive')
@validation.schema(migrate_server.migrate_live, "2.1", "2.24")
@validation.schema(migrate_server.migrate_live, "2.0", "2.24")
@validation.schema(migrate_server.migrate_live_v2_25, "2.25", "2.29")
@validation.schema(migrate_server.migrate_live_v2_30, "2.30")
def _migrate_live(self, req, id, body):

View File

@ -147,7 +147,7 @@ class ServerGroupController(wsgi.Controller):
@wsgi.Controller.api_version("2.1")
@extensions.expected_errors((400, 403))
@validation.schema(schema.create, "2.1", "2.14")
@validation.schema(schema.create, "2.0", "2.14")
@validation.schema(schema.create_v215, "2.15")
def create(self, req, body):
"""Creates a new server group."""