Bug 1041032

Summary: [RFE][nova]: Add common framework to validate every API parameters
Product: Red Hat OpenStack Reporter: RHOS Integration <rhos-integ>
Component: openstack-novaAssignee: Jakub Ruzicka <jruzicka>
Status: CLOSED UPSTREAM QA Contact: Ami Jeain <ajeain>
Severity: low Docs Contact:
Priority: medium    
Version: unspecifiedCC: dallan, markmc, ndipanov, sgordon, yeylon
Target Milestone: Upstream M3Keywords: FutureFeature, TechPreview, Triaged
Target Release: 5.0 (RHEL 7)   
Hardware: Unspecified   
OS: Unspecified   
URL: https://blueprints.launchpad.net/nova/+spec/nova-api-validation-fw
Whiteboard: upstream_milestone_icehouse-3 upstream_status_implemented upstream_definition_approved
Fixed In Version: Doc Type: Technology Preview
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2014-03-10 00:51:29 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:

Description RHOS Integration 2013-12-12 13:27:36 UTC
Cloned from launchpad blueprint https://blueprints.launchpad.net/nova/+spec/nova-api-validation-fw.

Description:

Nova has many RESTful APIs, and not all API parameters are completely validated.
We would like to propose an API validation framework to implement comprehensive validation.
The benefits of this framework will be the followings:
* Validate every API parameters.
* Unify both message format and HTTP code of error response, if the same cause.
  ex) ".. is too short.", ".. is too long.", ".. is not integer."
* Clarify the API parameter definitions.
* Clean up codes by merging error handling methods.

This framework target is Nova v3 API, because it is new and the API compatibility issues would not happen.
On Havana release, Nova v3 API is experimental and the API will become generic in Icehouse.
There are two options for common validation feature. The one is WSME validation, the other is JSONSchema validation. Through the Icehouse summit session(https://etherpad.openstack.org/p/icehouse-summit-nova-pecan-wsme), we have gotten a consensus that Nova v3 API will be moved to Pecan + JSONSchema validation.

JSONSchema validation can work for both JSON parameters and XML parameter because
* JSONSchema library validate againste dict data(not JSON data)
* the validation is executed after the deserialization.


Specification URL (additional information):

None