Jump to: navigation, search

Difference between revisions of "Glance-api-v2-refactor-schemas"

 
m (Text replace - "__NOTOC__" to "")
 
(One intermediate revision by one other user not shown)
Line 1: Line 1:
__NOTOC__
+
 
 
In the glance v2 api, schemas are used to communicate the expected format and attributes of image objects, access record objects, and image tags. These schemas are specific to v2. They are not used by v1 and would likely be changed in any future version. However, they presently live in project-global namespace. And they are served up by a single monolithic API object which is therefore required to know about all schemas.
 
In the glance v2 api, schemas are used to communicate the expected format and attributes of image objects, access record objects, and image tags. These schemas are specific to v2. They are not used by v1 and would likely be changed in any future version. However, they presently live in project-global namespace. And they are served up by a single monolithic API object which is therefore required to know about all schemas.
  
 
This blueprint proposes to refactor schemas to individual objects and move them under the glance/api/v2 library umbrella. To make room, other libraries in glance.api.v2 may need to be moved around as well.
 
This blueprint proposes to refactor schemas to individual objects and move them under the glance/api/v2 library umbrella. To make room, other libraries in glance.api.v2 may need to be moved around as well.
 
Sample library structure:
 
 
 
<pre><nowiki>
 
glance/
 
  api/
 
    v2/
 
      router.py
 
      resources/ # move wsgi resource modules to here
 
        images.py
 
        image_tags.py
 
        image_data.py
 
        image_access.py
 
        schemas.py
 
        ...
 
      schemas/  # move schemas to objects that live in these modules
 
        image.py
 
        image_access.py
 
        image_tags.py
 
        ...
 
      ...
 
</nowiki></pre>
 
 
 
Schema objects would have methods to get the raw text of the schema and to validate objects.
 
They would be instantiated directly in the schemas resource and in the various deserializers
 
to access their functionality.
 

Latest revision as of 23:29, 17 February 2013

In the glance v2 api, schemas are used to communicate the expected format and attributes of image objects, access record objects, and image tags. These schemas are specific to v2. They are not used by v1 and would likely be changed in any future version. However, they presently live in project-global namespace. And they are served up by a single monolithic API object which is therefore required to know about all schemas.

This blueprint proposes to refactor schemas to individual objects and move them under the glance/api/v2 library umbrella. To make room, other libraries in glance.api.v2 may need to be moved around as well.