Skip to content

Commit 4b5b285

Browse files
authored
fix(api): validate material type (#653)
Signed-off-by: Miguel Martinez Trivino <[email protected]>
1 parent 42defc8 commit 4b5b285

File tree

3 files changed

+55
-41
lines changed

3 files changed

+55
-41
lines changed

app/controlplane/api/workflowcontract/v1/crafting_schema.pb.go

Lines changed: 37 additions & 37 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

app/controlplane/api/workflowcontract/v1/crafting_schema.pb.validate.go

Lines changed: 11 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

app/controlplane/api/workflowcontract/v1/crafting_schema.proto

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
//
2-
// Copyright 2023 The Chainloop Authors.
2+
// Copyright 2024 The Chainloop Authors.
33
//
44
// Licensed under the Apache License, Version 2.0 (the "License");
55
// you may not use this file except in compliance with the License.
@@ -51,9 +51,12 @@ message CraftingSchema {
5151
}
5252

5353
message Material {
54-
MaterialType type = 1 [(validate.rules).enum = {
55-
not_in: [0]
56-
}];
54+
MaterialType type = 1 [
55+
(validate.rules).enum = {
56+
not_in: [0]
57+
},
58+
(validate.rules).enum.defined_only = true
59+
];
5760
string name = 2 [(validate.rules).string.pattern = "^[\\w|-]+$"]; // Single word optionally separated with _ or -
5861
bool optional = 3;
5962
// If a material is set as output it will get added to the subject in the statement

0 commit comments

Comments
 (0)