V3 API Validation
This blueprint is meant to track progress of standardizing the API validation of Keystone. Previous, there have been multiple ways to validate resources when interacting with the Keystone API. Utilizing a common validator will enforce API consistency across the resources in Keystone as well as ensure consistency when adding extensions to Keystone.
One possible way to do this would be with jsonschema, which can be used to validate request bodies and throw validation exceptions when validation fails. To do this, we can add a validation module to Keystone that consists of a wrapper function. The wrapper will handle loading the schema and validate the request body against the validator object. In addition to the validator module, schemas will have to be created that essentially model the Identity V3 API spec. Once a schema is created and accepted, it shouldn't have to change. Actually implementing the validator on resource create and update methods should consist of adding a method wrapper to the create and update methods of the resource. The method decorator can be the validator and it can take a couple parameters, 1.) the resource schema to validate the request against and 2.) the kwarg to pull the request body out of.
When adding new extensions, if the extension wants to use the validator against it's API, a schema for the extension should be committed with the extension.
The the above is one possible way to enforce a validator in Keystone.
(stevemar) what resources do you intend to validate using the schema in juno vs beyond?
will this be v3 specific?
Blueprint information
- Status:
- Complete
- Approver:
- None
- Priority:
- Medium
- Drafter:
- Lance Bragstad
- Direction:
- Needs approval
- Assignee:
- Lance Bragstad
- Definition:
- New
- Series goal:
- Accepted for juno
- Implementation:
- Implemented
- Milestone target:
- 2014.2
- Started by
- Dolph Mathews
- Completed by
- Dolph Mathews
Related branches
Related bugs
Sprints
Whiteboard
Previously blocked by tempest producing random strings and calling them URLs (this bp will cause those strings to be validated as URLs in Keystone. which will fail): https:/
Addressed by: https:/
Propose api-validation blueprint
Gerrit topic: https:/
Addressed by: https:/
Initial implementation of validator
Addressed by: https:/
Implement validation on Assignment V3 resources
Gerrit topic: https:/
Addressed by: https:/
Implement validation on Catalog V3 resources
Gerrit topic: https:/
Addressed by: https:/
Implement validation on Credential V3
Addressed by: https:/
Implement validation on Policy V3 API
Addressed by: https:/
Implement validation on Trust V3 API
Gerrit topic: https:/
Addressed by: https:/
Add string id type validation
Addressed by: https:/
Make BaseValidationT
Addressed by: https:/
Fixes syntax error in tests
Addressed by: https:/
Splits generic validation tests from model tests
Addressed by: https:/
Adds a dependency on jsd
Addressed by: https:/
Makes domain_id required for projects
Addressed by: https:/
Convert projects from embeded JSON to jsd schemas
Addressed by: https:/
Initial attempt at lazy configs - ugly
Addressed by: https:/
Adds tests that show how update with validation works
Gerrit topic: https:/
Gerrit topic: https:/
Gerrit topic: https:/
Addressed by: https:/
Implement validation on the Identity V3 API