Skip to content

Export generated validate proto artifacts - #152

Merged
timostamm merged 5 commits into
bufbuild:mainfrom
newyankeecodeshop:export_validate_gen
Sep 3, 2026
Merged

Export generated validate proto artifacts#152
timostamm merged 5 commits into
bufbuild:mainfrom
newyankeecodeshop:export_validate_gen

Conversation

@newyankeecodeshop

@newyankeecodeshop newyankeecodeshop commented May 21, 2026

Copy link
Copy Markdown
Contributor

This PR implements the feature request described by #151.

The generated file buf/validate/validate_pb.ts is now available as an export from @bufbuild/protovalidate/gen. The full import is @bufbuild/protovalidate/gen/buf/validate/validate_pb.js.

@CLAassistant

CLAassistant commented May 21, 2026

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

@newyankeecodeshop

Copy link
Copy Markdown
Contributor Author

Any time for a review @timostamm @jonbodner-buf ?

@timostamm

Copy link
Copy Markdown
Member

Thanks for the PR!

It fails CI for two reasons:

  1. We use @arethetypeswrong/cli to verify exports, and it doesn't support wildcards, unfortunately.
  2. The modification to the example is overwritten by buf generate, and we generate in CI and check for diffs to make sure that the generated code does not drift.

To land this, the best way forward is to drop the change to the example for now, and fix the exports so that attw passes. You should be able to run npm run all to effectively do the same thing as CI.

Please also see #151 (comment) for details, especially the file extension for the exports, which should be .js for best portability.

@newyankeecodeshop

Copy link
Copy Markdown
Contributor Author

Thanks @timostamm I have implemented the two changes you recommend. I could not get attw to pass because the "Node10" resolution is failing. I don't think this export can be supported under that module resolution, but it is also deprecated and being removed in TypeScript 7. What should I do?

"@bufbuild/protovalidate/gen/buf/validate/validate_pb.js"

node10: 💀 Resolution failed
node16 (from CJS): 🟢 (CJS)
node16 (from ESM): 🟢 (ESM)
bundler: 🟢 

@timostamm

Copy link
Copy Markdown
Member

TS 7 support is a different bridge to cross.

Node10 resolution can be satisfied via typesVersions, see https://github.com/bufbuild/protobuf-es/blob/6d0c4448cd4fc17751099603f5c60a08dfe4a5be/packages/protobuf/package.json#L125 for an example.

@timostamm timostamm left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

We'll need to do some more testing before we can release it, but let's get this merged!

@timostamm
timostamm merged commit 8ea3740 into bufbuild:main Sep 3, 2026
14 checks passed
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.

3 participants