Bug fix for API and implementation not aligned

API and code not aligned with spec in api-ref.

Change-Id: I24a85f0f2d2ea38b6f8c388328d5a95f7b12e311
Closes-bug: #1639726
This commit is contained in:
chesterkuo 2016-11-17 20:29:55 -05:00
parent 9d8e7b704a
commit 852e37668b
2 changed files with 19 additions and 8 deletions

View File

@ -35,6 +35,9 @@ class Version(base.APIBase):
'min_version': {
'validate': types.Text.validate
},
'max_version': {
'validate': types.Text.validate
},
'status': {
'validate': types.Text.validate
},
@ -63,8 +66,8 @@ class RootBase(base.APIBase):
'versions': {
'validate': types.List(types.Custom(Version)).validate
},
'default_version': {
'validate': types.Custom(Version).validate
'name': {
'validate': types.Text.validate
},
}
@ -73,8 +76,7 @@ class RootBase(base.APIBase):
root = RootBase()
root.name = "OpenStack Valence API"
root.description = "Valence is an OpenStack project"
root.versions = [Version.convert('v1', '1.0', True)]
root.default_version = Version.convert('v1', '1.0', True)
root.versions = [Version.convert('v1', '', True)]
return root
@ -82,7 +84,7 @@ class Root(Resource):
def get(self):
obj = RootBase.convert()
return json.dumps(obj, default=lambda o: o.as_dict())
return json.loads(json.dumps(obj, default=lambda o: o.as_dict()))
class PODMProxy(Resource):

View File

@ -56,6 +56,9 @@ class V1Base(base.APIBase):
'flavors': {
'validate': types.List(types.Custom(link.Link)).validate
},
'systems': {
'validate': types.List(types.Custom(link.Link)).validate
},
}
@staticmethod
@ -72,10 +75,10 @@ class V1Base(base.APIBase):
bookmark=True, type='text/html')]
v1.media_types = [MediaType(base='application/json',
type='application/vnd.openstack.valence.v1+json')]
v1.nodes = [link.Link.make_link('self', v1_base_url + '/nodes',
v1.nodes = [link.Link.make_link('self', v1_base_url,
'nodes', ''),
link.Link.make_link('bookmark',
v1_base_url + '/nodes',
v1_base_url,
'nodes', '',
bookmark=True)]
v1.storages = [link.Link.make_link('self', v1_base_url,
@ -90,6 +93,12 @@ class V1Base(base.APIBase):
v1_base_url,
'flavors', '',
bookmark=True)]
v1.systems = [link.Link.make_link('self', v1_base_url,
'systems', ''),
link.Link.make_link('bookmark',
v1_base_url,
'systems', '',
bookmark=True)]
return v1
@ -97,4 +106,4 @@ class V1(Resource):
def get(self):
vobj = V1Base.convert()
return json.dumps(vobj, default=lambda o: o.as_dict())
return json.loads(json.dumps(vobj, default=lambda o: o.as_dict()))