Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Check whether scalar fields are empty in (buf.validate.oneof).required #75

Closed

Conversation

oliversun9
Copy link
Contributor

@oliversun9 oliversun9 commented Nov 1, 2023

We used to check whether a scalar field is present when enforcing (buf.validate.oneof).required,
while checking whether a scalar field is not empty when enforcing (buf.validate.field).required.

This PR updates (buf.validate.oneof).required's semantics to check a scalar field is not empty (as opposed to present) in (buf.validate.oneof).required.

Conformance tests are updated in bufbuild/protovalidate#123

return validationErr
}
if presentFieldDescriptor.Kind() == protoreflect.GroupKind || presentFieldDescriptor.Kind() == protoreflect.MessageKind {
if !msg.Get(presentFieldDescriptor).Message().IsValid() {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

IsValid checks this case

@oliversun9 oliversun9 requested a review from rodaine November 1, 2023 16:34
@oliversun9 oliversun9 closed this Nov 1, 2023
@rodaine rodaine deleted the osun/required-mean-the-samething-for-field-and-oneof branch May 16, 2024 22:03
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.

1 participant