Skip to content

Support protovalidate validation #259

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

Merged
merged 83 commits into from
Dec 20, 2024

Conversation

andrewparmet
Copy link
Collaborator

@andrewparmet andrewparmet commented May 12, 2024

Right now the validator eagerly converts the protokt message to a protobuf DynamicMessage. With bufbuild/protovalidate-java#132, this can change to supply a wrapper around the protokt message that only converts as requested by the validator.

Not sure if this module belongs at the top level or in third-party. In that case, maybe the gRPC modules also belong in third-party. For example, supposing protokt one day supports the Connect protocol, that would also go in third-party, but it feels like a sibling to gRPC.

Fixes #207.

@andrewparmet andrewparmet requested a review from ogolberg May 13, 2024 03:01
@andrewparmet andrewparmet changed the title support protovalidate validation Support protovalidate validation Dec 16, 2024
Comment on lines +67 to +75
val output = command(runner).runCommand(projectRoot.toPath())
println(output.stderr)

assertThat(output.stderr).contains("CONFORMANCE SUITE PASSED")
val matches = " (\\d+) unexpected failures".toRegex().findAll(output.stderr).toList()
// the current implementation runs two conformance suites
assertThat(matches).hasSize(2)
matches.forEach { assertThat(it.groupValues[1].toInt()).isEqualTo(0) }
assertThat(output.exitCode).isEqualTo(0)
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Just some cleanup.

@@ -0,0 +1,283 @@
standard_constraints/ignore_empty:
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Whelp, gotta start somewhere. We were "fully" conformant until 0.8.0.

- proto2/wrapped/uint32/valid
- proto2/wrapped/uint64/invalid
- proto2/wrapped/uint64/valid
- proto3/bool/invalid
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I'm most concerned about the proto3 tests below this point since we don't support proto2 or edition 2023.

@andrewparmet andrewparmet merged commit db30a7d into open-toast:main Dec 20, 2024
37 checks passed
@andrewparmet andrewparmet deleted the protokt-protovalidate branch December 20, 2024 21:06
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.

Support proto validation
2 participants