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

Support for generating TSDoc content from the message and field level comments in the Protobuf definition #23

Closed
dteirney opened this issue Jan 17, 2020 · 5 comments

Comments

@dteirney
Copy link

Hello,

Has there been any thought around using the comments for the protobuf message and field definitions to generate TSDoc comments for the generated typescript?

We'd love to be able to have the field comments from the proto files available for devs within VS Code and other editors. Many IDEs and documentation generators support comments using the TSDoc format.

Many of our proto definitions follow both comment guidelines for Uber prototool and Google Documentation AIP. It would be awesome for those comments to come along for the ride with the TS that's generated, similar to the comments that are generated with the Google GAPIC typescript generator.

Thanks!
David

@stephenh
Copy link
Owner

@dteirney sure, that makes a lot of sense. The ts-poet code generator library that ts-proto uses supports outputting comments, I just hadn't bothered hooking that up yet. If you'd like to take a crack at it, that'd be great.

Most of the ts-poet addFunction/addProperty calls take builders that accept a "javaDoc" parameter for outputting comments, and the incoming CodeGenerationRequest (forget the exact name) protos from the protoc compiler should have .comment-type fields that are easily accessible.

(Somewhat of a small disclaimer, the latest ts-poet release, v3, doesn't use this same builder api anymore, so if you dig too much into ts-poet, just note that ts-proto is still on the v2 ts-poet api.)

I can probably sneak this in to at some point too.

@n3rdyme
Copy link

n3rdyme commented Feb 15, 2020

@dteirney see #31

@stephenh
Copy link
Owner

This is merged to master and will go out in the next release, which will be next-day-ish or so. Going to go ahead and close. Thanks @n3rdyme ! That was actually more involved than I thought it was going to be, with the index-based/etc. encoding of the comments in the protobuf file.

@dteirney
Copy link
Author

@n3rdyme thanks! Will test once the next release goes out.

@stephenh
Copy link
Owner

@dteirney version 1.11.0 is out with this change. :-)

zfy0701 added a commit to sentioxyz/ts-proto that referenced this issue Jan 5, 2023
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

No branches or pull requests

3 participants