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

Generated JSON types should include @deprecated in doc comment like the main types #971

Closed
ngbrown opened this issue Sep 13, 2024 · 1 comment · Fixed by #975
Closed
Labels
Feature New feature or request

Comments

@ngbrown
Copy link

ngbrown commented Sep 13, 2024

When the protoc-gen-es plugin is ran with the json_types=true option, the generated jsdoc comment does not currently include @deprecated when the proto field is marked as deprecated ([deprecated = true]) while the main types do.

The generated JSON type should include @deprecated in the jsdoc comment as well.

@bufbuild/buf: 1.41.0
@bufbuild/protoc-gen-es: 2.0.0

@timostamm
Copy link
Member

That's a good call. Currently, we generate this JSDoc block for a JSON type for a message:

/**
 * JSON type for the message example.User.
 */

We don't include the original comment, a @deprecated tag, or the @generated from ... annotation that we generate for the primary type for a message.

The same is likely true for enumerations, and probably also for fields. Repeating all comments increases the size of the generated files - not ideal, but they are all types, and having comments available all the time is most likely worth it.

The only thing that's still unclear to me is how we can effectively let users know about the distinction between the primary type, and the JSON type if we no longer have the single, short comment.

@timostamm timostamm added the Feature New feature or request label Sep 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Feature New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants