diff --git a/valence/api/root.py b/valence/api/root.py index 587c860..dd2c78a 100644 --- a/valence/api/root.py +++ b/valence/api/root.py @@ -36,6 +36,9 @@ class Version(base.APIBase): 'min_version': { 'validate': types.Text.validate }, + 'max_version': { + 'validate': types.Text.validate + }, 'status': { 'validate': types.Text.validate }, @@ -64,8 +67,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 }, } @@ -74,8 +77,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 @@ -83,7 +85,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): diff --git a/valence/api/v1/version.py b/valence/api/v1/version.py index ec7524d..69b111e 100644 --- a/valence/api/v1/version.py +++ b/valence/api/v1/version.py @@ -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()))