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

Expand buf lint PROTOVALIDATE rule to lint example and shared rules #3317

Draft
wants to merge 16 commits into
base: main
Choose a base branch
from

Conversation

oliversun9
Copy link
Contributor

@oliversun9 oliversun9 commented Sep 13, 2024

Not mergable (see go.mod)

Also WIP for a few TODOs and testing.

This updates the PROTOVALIDATE rule in buf lint for two new features:

  • For the protovalidate example feature (this feature is on main but not released yet), check:
    • example values satisfy the constraints (builtin + cel)
    • if no constraint is defined on the field, an example value should not be present
  • For the shared rules feature (not merged yet), check:
    • a shared rule compiles (the expression defined on buf.validate.*Rules compiles)
    • example values also satisfy any shared rule defined

responseWriter bufcheckserverutil.ResponseWriter,
request bufcheckserverutil.Request,
) error {
// TODO: refactor so that add func is no longer needed
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This can be done in a separate PR. This PR will maintain the status quo.

)
}

func checkConstraintsForField(
adder *adder,
fieldConstraints *validate.FieldConstraints,
// TODO: fix wording
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Going to fix

Copy link
Contributor

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

BuildFormatLintBreakingUpdated (UTC)
✅ passed✅ passed✅ passed✅ passedSep 13, 2024, 10:10 PM

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