Skip to content

Fix re2 for protobuf_dot_fqn and add tests#466

Merged
timostamm merged 1 commit intoprotobuf-fqnfrom
protobuf-fqn-tests
Feb 12, 2026
Merged

Fix re2 for protobuf_dot_fqn and add tests#466
timostamm merged 1 commit intoprotobuf-fqnfrom
protobuf-fqn-tests

Conversation

@timostamm
Copy link
Member

@timostamm timostamm commented Feb 12, 2026

This adds basic tests for the rules string.protobuf_fqn and string.protobuf_dot_fqn we're adding in #465, and fixes a bug in the re2 expression for protobuf_dot_fqn.

The tests run successfully in bufbuild/protovalidate-es#131.

@github-actions
Copy link

The latest Buf updates on your PR. Results from workflow Buf CI / buf (pull_request).

BuildFormatLintBreakingUpdated (UTC)
✅ passed✅ passed✅ passed✅ passedFeb 12, 2026, 2:04 PM

id: "string.protobuf_dot_fqn"
message: "value must be a valid fully-qualified Protobuf name with a leading dot"
expression: "!rules.protobuf_dot_fqn || this == '' || this.matches('(\\\\.[A-Za-z_][A-Za-z_0-9]*)*$')"
expression: "!rules.protobuf_dot_fqn || this == '' || this.matches('^\\\\.[A-Za-z_][A-Za-z_0-9]*(\\\\.[A-Za-z_][A-Za-z_0-9]*)*$')"
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

While this.matches('(\\\\.[A-Za-z_][A-Za-z_0-9]*)*$') was just missing a start-of-line assertion, I prefer to keep the symmetry to protobuf_fqn.

Message: &cases.StringProtobufFQN{Val: "my_package.MyMessage"},
Expected: results.Success(true),
},
"protobuf_fqn/_any_Crazy_CASE_with_01234_numbers/valid": {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@timostamm timostamm merged commit 2ae41c8 into protobuf-fqn Feb 12, 2026
6 checks passed
@timostamm timostamm deleted the protobuf-fqn-tests branch February 12, 2026 14:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants