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

V2: Generate comments for feature options #809

Merged
merged 4 commits into from
Apr 25, 2024

Conversation

timostamm
Copy link
Member

@timostamm timostamm commented Apr 24, 2024

When a field option like jstype is set in Protobuf, we include it in the JSDoc block of the generated code. For example:

/**
 * @generated from field: int64 foo = 1 [jstype = JS_STRING];
 */
foo: string;

With this change, we also include edition features. For example:

/**
 * @generated from field: string foo = 1 [features.field_presence = IMPLICIT];
 */
foo: string;

Features can also be set as file options. We include them in the preamble comment:

// @generated from file test/features.proto (package test, edition 2023)
// option features.field_presence = EXPLICIT;

Some features can be set as message or enum options. These features are included in the JSDoc block for the generated type:

/**
 * @generated from enum test.SomeEnum
 * @generated with option features.enum_type = OPEN
 */
export enum SomeEnum {

@timostamm timostamm marked this pull request as ready for review April 24, 2024 12:33
@timostamm timostamm merged commit e0ab73e into v2 Apr 25, 2024
5 checks passed
@timostamm timostamm deleted the tstamm/generate-feature-comments branch April 25, 2024 15:11
@timostamm timostamm mentioned this pull request May 13, 2024
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.

2 participants