Skip to content

Commit

Permalink
Related-Bug: #1639704 - Added generation of objectList file which hol…
Browse files Browse the repository at this point in the history
…ds the list of all the identifiers. For use in RBAC config.

Change-Id: Ie8746cc7df25ace10a8e7699471c0767ddf917b8
  • Loading branch information
manojgn committed Nov 28, 2016
1 parent 6d8ed0a commit 5b0014f
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions json_schemagen.py
Expand Up @@ -18,6 +18,7 @@ def __init__(self, parser, type_map, identifiers, metadata):
self._type_count = {}
#map which will hold the schema for the types which will be generated below
self._json_type_map = {}
self._objectsList = []

#For mapping the js data type given the ctype or jtype
def _getJSDataType (self,type):
Expand Down Expand Up @@ -142,8 +143,14 @@ def Generate(self, dirname):
for ctype in self._type_map.values():
self._GenerateTypeMap(ctype)
for ident in self._identifier_map.values():
self._objectsList.append(ident._name)
filename = os.path.join(dirname, ident._name + "-schema.json")
self._GenerateJavascriptSchema(ident, filename)
#Generate the file containing the list of all identfiers/objects
objFileName = os.path.join(dirname, "objectList.json")
objFile = self._parser.makeFile(objFileName)
objJson = {"objects":self._objectsList}
objFile.write(json.dumps(objJson,indent=4))
print "Done!"
print "Schemas generated under directory: " + dirname

0 comments on commit 5b0014f

Please sign in to comment.