Skip to content

Commit

Permalink
allow % character in tag value (#2777)
Browse files Browse the repository at this point in the history
Signed-off-by: craman <[email protected]>
Co-authored-by: craman <[email protected]>
  • Loading branch information
chandrasekhar1996 and craman authored Oct 25, 2024
1 parent 04d5ae1 commit a1478eb
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 5 deletions.
4 changes: 2 additions & 2 deletions clients/go/zms/zms_schema.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions core/zms/src/main/java/com/yahoo/athenz/zms/ZMSSchema.java
Original file line number Diff line number Diff line change
Expand Up @@ -94,11 +94,11 @@ private static Schema build() {

sb.stringType("TagValue")
.comment("TagValue to contain generic string patterns")
.pattern("[a-zA-Z0-9_:,\\/][a-zA-Z0-9_:,\\/-]*");
.pattern("[a-zA-Z0-9_:,\\/][a-zA-Z0-9_:%,\\/-]*");

sb.stringType("TagCompoundValue")
.comment("A compound value of TagValue")
.pattern("([a-zA-Z0-9_:,\\/][a-zA-Z0-9_:,\\/-]*\\.)*[a-zA-Z0-9_:,\\/][a-zA-Z0-9_:,\\/-]*");
.pattern("([a-zA-Z0-9_:,\\/][a-zA-Z0-9_:%,\\/-]*\\.)*[a-zA-Z0-9_:,\\/][a-zA-Z0-9_:%,\\/-]*");

sb.structType("TagValueList")
.arrayField("list", "TagCompoundValue", false, "list of tag values");
Expand Down
2 changes: 1 addition & 1 deletion core/zms/src/main/rdl/Names.tdl
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ type AuthorityKeywords String (pattern="({AuthorityKeyword},)*{AuthorityKeyword}
type TagKey String (pattern="({SimpleName}[:\\.])*{SimpleName}");

//TagValue to contain generic string patterns
type TagValue String (pattern="[a-zA-Z0-9_:,\\/][a-zA-Z0-9_:,\\/-]*");
type TagValue String (pattern="[a-zA-Z0-9_:,\\/][a-zA-Z0-9_:%,\\/-]*");

//A compound value of TagValue
type TagCompoundValue String (pattern="({TagValue}\\.)*{TagValue}");
Expand Down
4 changes: 4 additions & 0 deletions core/zms/src/test/java/com/yahoo/athenz/zms/ZMSCoreTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -2707,6 +2707,10 @@ public void testTagValueList() {
tvl = new TagValueList().setList(Collections.singletonList("/homes/home/"));
resultTvl = validator.validate(tvl, "TagValueList");
assertTrue(resultTvl.valid);

tvl = new TagValueList().setList(Collections.singletonList("/home%test"));
resultTvl = validator.validate(tvl, "TagValueList");
assertTrue(resultTvl.valid);
}

private UserAuthorityAttributeMap getUserAuthorityAttributeMapForTest() {
Expand Down

0 comments on commit a1478eb

Please sign in to comment.