Merge "Bug fix for API and implementation not aligned"

This commit is contained in:
Jenkins 2016-11-21 18:27:23 +00:00 committed by Gerrit Code Review
commit 3e9721f030
2 changed files with 19 additions and 8 deletions

View File

@ -36,6 +36,9 @@ class Version(base.APIBase):
'min_version': { 'min_version': {
'validate': types.Text.validate 'validate': types.Text.validate
}, },
'max_version': {
'validate': types.Text.validate
},
'status': { 'status': {
'validate': types.Text.validate 'validate': types.Text.validate
}, },
@ -64,8 +67,8 @@ class RootBase(base.APIBase):
'versions': { 'versions': {
'validate': types.List(types.Custom(Version)).validate 'validate': types.List(types.Custom(Version)).validate
}, },
'default_version': { 'name': {
'validate': types.Custom(Version).validate 'validate': types.Text.validate
}, },
} }
@ -74,8 +77,7 @@ class RootBase(base.APIBase):
root = RootBase() root = RootBase()
root.name = "OpenStack Valence API" root.name = "OpenStack Valence API"
root.description = "Valence is an OpenStack project" root.description = "Valence is an OpenStack project"
root.versions = [Version.convert('v1', '1.0', True)] root.versions = [Version.convert('v1', '', True)]
root.default_version = Version.convert('v1', '1.0', True)
return root return root
@ -83,7 +85,7 @@ class Root(Resource):
def get(self): def get(self):
obj = RootBase.convert() 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): class PODMProxy(Resource):

View File

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