From d530ee6ceb229b859b7f7414942a2e4480788c9a Mon Sep 17 00:00:00 2001 From: Mike Fridman Date: Thu, 24 Oct 2024 20:02:37 -0400 Subject: [PATCH 1/3] Allow setting spdx_license_id in module upload --- buf/registry/module/v1/commit.proto | 6 ++++++ buf/registry/module/v1/upload_service.proto | 3 +++ 2 files changed, 9 insertions(+) diff --git a/buf/registry/module/v1/commit.proto b/buf/registry/module/v1/commit.proto index d298a36f..a1eef5aa 100644 --- a/buf/registry/module/v1/commit.proto +++ b/buf/registry/module/v1/commit.proto @@ -75,4 +75,10 @@ message Commit { (buf.validate.field).string.max_len = 255, (buf.validate.field).ignore = IGNORE_IF_UNPOPULATED ]; + // The SPDX License Identifier of the Commit. + // + // May be empty if the SPDX License Identifier was not explicitly set during upload, if the + // license file was not present, or if it was not possible to detect the SPDX License Identifier + // from the license file. + string spdx_license_id = 8; } diff --git a/buf/registry/module/v1/upload_service.proto b/buf/registry/module/v1/upload_service.proto index 13ac5859..57083961 100644 --- a/buf/registry/module/v1/upload_service.proto +++ b/buf/registry/module/v1/upload_service.proto @@ -61,6 +61,9 @@ message UploadRequest { (buf.validate.field).string.max_len = 255, (buf.validate.field).ignore = IGNORE_IF_UNPOPULATED ]; + // The SPDX License Identifier. If this field is not set, the SPDX License Identifier will be + // detected from the license file, if present. + string spdx_license_id = 5; } // The Contents of all references. repeated Content contents = 1 [(buf.validate.field).repeated.min_items = 1]; From 63248009ab00901a950a85257bf40c802c5ee769 Mon Sep 17 00:00:00 2001 From: bufdev Date: Thu, 31 Oct 2024 11:03:38 -0400 Subject: [PATCH 2/3] Updates --- buf/registry/module/v1/commit.proto | 6 +++++- buf/registry/module/v1/upload_service.proto | 6 +++++- buf/registry/module/v1beta1/commit.proto | 10 ++++++++++ buf/registry/module/v1beta1/upload_service.proto | 7 +++++++ 4 files changed, 27 insertions(+), 2 deletions(-) diff --git a/buf/registry/module/v1/commit.proto b/buf/registry/module/v1/commit.proto index a1eef5aa..ab2fc621 100644 --- a/buf/registry/module/v1/commit.proto +++ b/buf/registry/module/v1/commit.proto @@ -80,5 +80,9 @@ message Commit { // May be empty if the SPDX License Identifier was not explicitly set during upload, if the // license file was not present, or if it was not possible to detect the SPDX License Identifier // from the license file. - string spdx_license_id = 8; + string spdx_license_id = 8 [ + (buf.validate.field).string.min_len = 1, + (buf.validate.field).string.pattern = "^[a-zA-Z0-9-.]+$", + (buf.validate.field).ignore = IGNORE_IF_UNPOPULATED + ]; } diff --git a/buf/registry/module/v1/upload_service.proto b/buf/registry/module/v1/upload_service.proto index 57083961..c4418c8f 100644 --- a/buf/registry/module/v1/upload_service.proto +++ b/buf/registry/module/v1/upload_service.proto @@ -63,7 +63,11 @@ message UploadRequest { ]; // The SPDX License Identifier. If this field is not set, the SPDX License Identifier will be // detected from the license file, if present. - string spdx_license_id = 5; + string spdx_license_id = 5 [ + (buf.validate.field).string.min_len = 1, + (buf.validate.field).string.pattern = "^[a-zA-Z0-9-.]+$", + (buf.validate.field).ignore = IGNORE_IF_UNPOPULATED + ]; } // The Contents of all references. repeated Content contents = 1 [(buf.validate.field).repeated.min_items = 1]; diff --git a/buf/registry/module/v1beta1/commit.proto b/buf/registry/module/v1beta1/commit.proto index 5a8e6d26..0161cf36 100644 --- a/buf/registry/module/v1beta1/commit.proto +++ b/buf/registry/module/v1beta1/commit.proto @@ -75,4 +75,14 @@ message Commit { (buf.validate.field).string.max_len = 255, (buf.validate.field).ignore = IGNORE_IF_UNPOPULATED ]; + // The SPDX License Identifier of the Commit. + // + // May be empty if the SPDX License Identifier was not explicitly set during upload, if the + // license file was not present, or if it was not possible to detect the SPDX License Identifier + // from the license file. + string spdx_license_id = 8 [ + (buf.validate.field).string.min_len = 1, + (buf.validate.field).string.pattern = "^[a-zA-Z0-9-.]+$", + (buf.validate.field).ignore = IGNORE_IF_UNPOPULATED + ]; } diff --git a/buf/registry/module/v1beta1/upload_service.proto b/buf/registry/module/v1beta1/upload_service.proto index 2333365e..9fbc0ace 100644 --- a/buf/registry/module/v1beta1/upload_service.proto +++ b/buf/registry/module/v1beta1/upload_service.proto @@ -74,6 +74,13 @@ message UploadRequest { (buf.validate.field).string.max_len = 255, (buf.validate.field).ignore = IGNORE_IF_UNPOPULATED ]; + // The SPDX License Identifier. If this field is not set, the SPDX License Identifier will be + // detected from the license file, if present. + string spdx_license_id = 5 [ + (buf.validate.field).string.min_len = 1, + (buf.validate.field).string.pattern = "^[a-zA-Z0-9-.]+$", + (buf.validate.field).ignore = IGNORE_IF_UNPOPULATED + ]; } // The Contents of all references. repeated Content contents = 1 [(buf.validate.field).repeated.min_items = 1]; From 03ff80131a1e1d682f405b4efbfdddc70db841b9 Mon Sep 17 00:00:00 2001 From: bufdev Date: Thu, 31 Oct 2024 11:09:04 -0400 Subject: [PATCH 3/3] Update regex --- buf/registry/module/v1/commit.proto | 2 +- buf/registry/module/v1/upload_service.proto | 2 +- buf/registry/module/v1beta1/commit.proto | 2 +- buf/registry/module/v1beta1/upload_service.proto | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/buf/registry/module/v1/commit.proto b/buf/registry/module/v1/commit.proto index ab2fc621..646c68fa 100644 --- a/buf/registry/module/v1/commit.proto +++ b/buf/registry/module/v1/commit.proto @@ -82,7 +82,7 @@ message Commit { // from the license file. string spdx_license_id = 8 [ (buf.validate.field).string.min_len = 1, - (buf.validate.field).string.pattern = "^[a-zA-Z0-9-.]+$", + (buf.validate.field).string.pattern = "^[a-zA-Z0-9-.+]+$", (buf.validate.field).ignore = IGNORE_IF_UNPOPULATED ]; } diff --git a/buf/registry/module/v1/upload_service.proto b/buf/registry/module/v1/upload_service.proto index c4418c8f..e21f5677 100644 --- a/buf/registry/module/v1/upload_service.proto +++ b/buf/registry/module/v1/upload_service.proto @@ -65,7 +65,7 @@ message UploadRequest { // detected from the license file, if present. string spdx_license_id = 5 [ (buf.validate.field).string.min_len = 1, - (buf.validate.field).string.pattern = "^[a-zA-Z0-9-.]+$", + (buf.validate.field).string.pattern = "^[a-zA-Z0-9-.+]+$", (buf.validate.field).ignore = IGNORE_IF_UNPOPULATED ]; } diff --git a/buf/registry/module/v1beta1/commit.proto b/buf/registry/module/v1beta1/commit.proto index 0161cf36..2a2d6277 100644 --- a/buf/registry/module/v1beta1/commit.proto +++ b/buf/registry/module/v1beta1/commit.proto @@ -82,7 +82,7 @@ message Commit { // from the license file. string spdx_license_id = 8 [ (buf.validate.field).string.min_len = 1, - (buf.validate.field).string.pattern = "^[a-zA-Z0-9-.]+$", + (buf.validate.field).string.pattern = "^[a-zA-Z0-9-.+]+$", (buf.validate.field).ignore = IGNORE_IF_UNPOPULATED ]; } diff --git a/buf/registry/module/v1beta1/upload_service.proto b/buf/registry/module/v1beta1/upload_service.proto index 9fbc0ace..b2f5549e 100644 --- a/buf/registry/module/v1beta1/upload_service.proto +++ b/buf/registry/module/v1beta1/upload_service.proto @@ -78,7 +78,7 @@ message UploadRequest { // detected from the license file, if present. string spdx_license_id = 5 [ (buf.validate.field).string.min_len = 1, - (buf.validate.field).string.pattern = "^[a-zA-Z0-9-.]+$", + (buf.validate.field).string.pattern = "^[a-zA-Z0-9-.+]+$", (buf.validate.field).ignore = IGNORE_IF_UNPOPULATED ]; }