Validation of input parameters through JSON Schema
Nova, Cinder and Keystone have used JSON Schema to validate input parameters in start of operation itself instead of going ahead and reported error after error occurs.
We should follow same in Manila.
Nova JSON Schema Validation::
## Validation:
def validate(self, *args, **kwargs):
try:
except jsonschema.
# NOTE: For whole OpenStack message consistency, this error
# message has been written as the similar format of WSME.
if len(ex.path) > 0:
else:
raise exception.
except TypeError as ex:
# NOTE: If passing non string value to patternProperties parameter,
# TypeError happens. Here is for catching the TypeError.
detail = six.text_type(ex)
raise exception.
## At API layer:
https:/
@validation
def _create_
"""Backup a server instance.
https:/
Cinder JSON Schema Validation:
[1] https:/
[2] https:/
Blueprint information
- Status:
- Started
- Approver:
- Goutham Pacha Ravi
- Priority:
- Low
- Drafter:
- Dongdong Pei
- Direction:
- Approved
- Assignee:
- Stephen Finucane
- Definition:
- Approved
- Series goal:
- None
- Implementation:
- Started
- Milestone target:
- dalmatian-rc1
- Started by
- Goutham Pacha Ravi
- Completed by
Related branches
Related bugs
Sprints
Whiteboard
Gerrit topic: https:/
Addressed by: https:/
Add json schema validation for Manila APIs
Gerrit topic: https:/
Addressed by: https:/
api: Add validation middleware
Addressed by: https:/
api: Add schemas for resource_locks
Addressed by: https:/
api: Add descriptions to API schemas
Addressed by: https:/
tests: Ensure APIs have schemas
Addressed by: https:/
tests: Ensure API schemas are actually valid
Addressed by: https:/
api: Add schemas for availability_zones
Addressed by: https:/
api: Add rst->md conversion
Gerrit topic: https:/
Addressed by: https:/
api: Add schemas for messages
Addressed by: https:/
api: Add schemas for messages