diff --git a/tutorials/template/README.md.template b/tutorials/template/README.md.template new file mode 100644 index 000000000..0771b70ba --- /dev/null +++ b/tutorials/template/README.md.template @@ -0,0 +1,36 @@ +# My HoloHub Tutorial + +Provide a splash image highlighting your tutorial. + +## Overview + +Provide a one-sentence summary of your tutorial's purpose and operations. + +## Description + +Provide a detailed summary of your project. Include any necessary background +for the average HoloHub user to understand the general purpose of your project. +Include any diagrams that are helpful for understanding functionality. + +## Data + +Give an overview of any datasets that will be used in your project. + +## Requirements + +List any platform requirements that a user must have before trying to build and run +your project. Requirements could include hardware or software. + +## Tutorial Instructions + +Provide a step-by-step walkthrough of your tutorial and link to any accompanying +tutorial documents. If the tutorial depends on runnable commands, include them +here. + +```bash + +``` + +## Acknowledgements + +Cite any methods or collaborators here. diff --git a/tutorials/template/metadata.json.template b/tutorials/template/metadata.json.template new file mode 100644 index 000000000..c33a18a39 --- /dev/null +++ b/tutorials/template/metadata.json.template @@ -0,0 +1,34 @@ +{ + "tutorial": { + "name": "My Tutorial", + "description": "Demonstrates how to use Holoscan in a certain fashion.", + "authors": [ + { + "name": "John Doe", + "affiliation": "My Institution" + } + ], + "language": "C++", + "version": "0.1.0", + "changelog": { + "0.1.0": "Initial Release" + }, + "holoscan_sdk": { + "minimum_required_version": "1.0.3", + "tested_versions": [ + "1.0.3" + ] + }, + "platforms": [ + "amd64", + "arm64" + ], + "tags": [ + "Sensor", + "Processing", + "Tutorial" + ], + "ranking": 1, + "dependencies": {} + } +} diff --git a/utilities/metadata_validator.py b/utilities/metadata_validator.py index 0b03e0739..e348bce98 100644 --- a/utilities/metadata_validator.py +++ b/utilities/metadata_validator.py @@ -32,7 +32,10 @@ def validate_json(json_data, directory): registry = Registry().with_resource(base_schema["$id"], DRAFT4.create_resource(base_schema)) with open(directory + "/metadata.schema.json", "r") as file: - execute_api_schema = json.load(file) + try: + execute_api_schema = json.load(file) + except json.decoder.JSONDecodeError as err: + return False, err validator = Draft4Validator(execute_api_schema, registry=registry) try: @@ -74,7 +77,13 @@ def validate_json_directory(directory, ignore_patterns=[], metadata_is_required: # Check if the metadata is valid for name in glob.glob(current_wdir + "/" + directory + "/**/metadata.json", recursive=True): with open(name, "r") as file: - jsonData = json.load(file) + try: + jsonData = json.load(file) + except json.decoder.JSONDecodeError: + print("ERROR:" + name + ": invalid") + exit_code = 1 + continue + is_valid, msg = validate_json(jsonData, directory) if is_valid: print(name + ": valid") @@ -91,6 +100,8 @@ def validate_json_directory(directory, ignore_patterns=[], metadata_is_required: exit_code_op = validate_json_directory("operators", ignore_patterns=["template"]) exit_code_extensions = validate_json_directory("gxf_extensions", ignore_patterns=["utils"]) exit_code_applications = validate_json_directory("applications", ignore_patterns=["template"]) - exit_code_tutorials = validate_json_directory("tutorials", metadata_is_required=False) + exit_code_tutorials = validate_json_directory( + "tutorials", ignore_patterns=["template"], metadata_is_required=False + ) sys.exit(max(exit_code_op, exit_code_extensions, exit_code_applications, exit_code_tutorials))