diff --git a/docuploader/__main__.py b/docuploader/__main__.py index 852d50d..732a77a 100644 --- a/docuploader/__main__.py +++ b/docuploader/__main__.py @@ -89,7 +89,16 @@ def upload( metadata = metadata_pb2.Metadata() text_format.Merge(metadata_path.read_text(), metadata) - # TODO: Validate that the minimum metadata is set. + + # Validating metadata for required fields + + # TODO: Do additional validiation + if not metadata.name: + raise Exception("Metadata field 'name' is required.") + if not metadata.version: + raise Exception("Metadata field 'version' is required.") + if not metadata.language: + raise Exception("Metadata field 'language' is required.") docuploader.log.success( f"Looks like we're uploading {metadata.name} version {metadata.version} for {metadata.language}." @@ -102,13 +111,9 @@ def upload( with tempfile.NamedTemporaryFile() as fh: fh.close() tar_filename = fh.name - docuploader.tar.compress(documentation_path, tar_filename) - docuploader.log.success(f"Cool, I have those tarred up.") - docuploader.log.info(f"Okay, I'm sending them to the cloud™ now.") - destination_name = ( f"{metadata.language}-{metadata.name}-{metadata.version}.tar.gz" ) diff --git a/docuploader/protos/metadata.proto b/docuploader/protos/metadata.proto index 89d5dec..bcc8da9 100644 --- a/docuploader/protos/metadata.proto +++ b/docuploader/protos/metadata.proto @@ -33,7 +33,7 @@ message Metadata { string version = 3; // The (programming) language. While this isn't enforced with an enum, you - // should use one of the following strings: python, node, ruby, dotnet, + // should use one of the following strings: python, nodejs, ruby, dotnet, // java, go, php, cpp. In some cases you might need to use something else, // consult googleapis-dot-dev-team@ for guidance. string language = 4;