diff --git a/JsonGenerator/GenerateDocs.bat b/JsonGenerator/GenerateDocs.bat index 2d8dfb4..2f096ba 100755 --- a/JsonGenerator/GenerateDocs.bat +++ b/JsonGenerator/GenerateDocs.bat @@ -31,7 +31,7 @@ if not exist JsonGenerator.py ( exit /b 0 ) -set COMMAND=python JsonGenerator.py --docs -i ../../Source/interfaces/json -j ../../Source/interfaces -o doc +set COMMAND=python JsonGenerator.py --docs -i ../../Source/interfaces/json -i ../../Source/interfaces/qa_json -j ../../Source/interfaces -j ../../Source/qa_interfaces -I ../../Source -o doc if "%1"=="" ( echo Usage %0 [JSONFILE] OR [DIRECTORY] diff --git a/JsonGenerator/GenerateDocs.sh b/JsonGenerator/GenerateDocs.sh index 84918a9..350ff78 100755 --- a/JsonGenerator/GenerateDocs.sh +++ b/JsonGenerator/GenerateDocs.sh @@ -28,7 +28,7 @@ command -v ./JsonGenerator.py >/dev/null 2>&1 || { echo >&2 "JsonGenerator.py is not available. Aborting."; exit 1; } -if [ -d ]; then +if [ $# -eq 1 ] && [ -d $1 ]; then files=`find $1 -name "*Plugin.json"` elif [ $# -gt 0 ]; then files=$@ @@ -40,6 +40,6 @@ fi echo "Generating Plugin markdown documentation..." -./JsonGenerator.py --docs -i ../../ThunderInterfaces/jsonrpc -j ../../ThunderInterfaces/interfaces -I ../../Thunder/Source -o doc --verbose $files +./JsonGenerator.py --docs -i ../../ThunderInterfaces/jsonrpc -i ../../ThunderInterfaces/qa_jsonrpc -j ../../ThunderInterfaces/interfaces -j ../../ThunderInterfaces/qa_interfaces -I ../../Thunder/Source -o doc --verbose $files echo "Complete." diff --git a/JsonGenerator/source/documentation_generator.py b/JsonGenerator/source/documentation_generator.py index 8e930db..70a7708 100644 --- a/JsonGenerator/source/documentation_generator.py +++ b/JsonGenerator/source/documentation_generator.py @@ -90,6 +90,8 @@ def _TableObj(name, obj, parentName="", parent=None, prefix="", parentOptional=F obsolete = obj["obsolete"] if "obsolete" in obj else False restricted = obj.get("range") + name = name.replace(' ','-') + if parent and not optional: if parent["type"] == "object": optional = ("required" not in parent and len(parent["properties"]) > 1) or ( @@ -333,8 +335,13 @@ def MethodDump(method, props, classname, section, header, is_notification=False, if "name" not in props["index"][0] or "example" not in props["index"][0]: raise DocumentationError("'%s': index field requires 'name' and 'example' properties" % method) + if "type" not in props["index"][0]: + props["index"][0]["type"] = "string" + if props["index"][1] and ("type" not in props["index"][1]): + props["index"][1]["type"] = "string" + extra_paragraph = "> The *%s* argument shall be passed as the index to the property, e.g. ``%s.1.%s@<%s>``." % ( - props["index"][0]["name"].lower(), classname, method, props["index"][0]["name"].lower()) + props["index"][0]["name"].lower(), classname, method, props["index"][0]["name"].lower().replace(' ', '-')) if props["index"][0] and props["index"][0].get("optional") and props["index"][1] and props["index"][1].get("optional"): extra_paragraph += " The index is optional." diff --git a/JsonGenerator/source/json_loader.py b/JsonGenerator/source/json_loader.py index ac50c11..d651d98 100644 --- a/JsonGenerator/source/json_loader.py +++ b/JsonGenerator/source/json_loader.py @@ -1211,8 +1211,6 @@ def Scan(pairs): # Need to prepend with 'file:' for jsonref to load an external file.. ref = v.split("#") if "#" in v else [v,""] - assert include_paths - ref_file = None if "{interfacedir}" in ref[0]: @@ -1250,8 +1248,6 @@ def Scan(pairs): elif v.endswith(".h") or v.endswith(".h#"): ref = v.replace("#", "").replace("{cppinterfacedir}", "{interfacedir}") - assert cpp_include_paths - ref_file = None if "{interfacedir}" in ref: @@ -1262,10 +1258,20 @@ def Scan(pairs): ref_file = rf break else: - log.Info("failed to include '%s', file not found" %rf); + log.Info("failed to include '%s', file not found" %rf) + + if not ref_file and "{currentdir}" in ref: + rf = ref.replace("{currentdir}", os.path.dirname(file)) + if os.path.exists(rf): + ref_file = rf + + if not ref_file: + rf = os.path.dirname(file) + os.sep + ref + if os.path.exists(rf): + ref_file = rf if ref_file: - log.Info("including C++ header '%s'..." % rf); + log.Info("including C++ header '%s'..." % ref_file) cppif, _ = header_loader.LoadInterface(ref_file, log, True, header_include_paths) if cppif: @@ -1303,9 +1309,6 @@ def Scan(pairs): def Load(log, path, if_dirs = [], cpp_if_dirs = [], include_paths = []): temp_files = [] - if_dirs.append(os.path.dirname(path)) - cpp_if_dirs.append(os.path.dirname(path)) - if path.endswith(".h"): schemas, additional_includes = header_loader.LoadInterface(path, log, False, include_paths) else: