Skip to content

Support Enum / Enum value options #37

@timostamm

Description

@timostamm

Protobuf has enum options. For example:

extend google.protobuf.EnumOptions {
    bool enum_opt_bool = 2001;
}

extend google.protobuf.EnumValueOptions {
    bool enum_value_opt_bool = 3001;
}


enum AnnotatedEnum {

    option (spec.enum_opt_bool) = true;

    UNSPECIFIED = 0;
    FOO = 1 [(spec.enum_value_opt_bool) = true];
}

These options should be made available in the generated code as JSON, just like field and service / method options already are.

Implementation is probably not straight-forward because there is no good place to put the data. One approach could be to use symbols to add the options to a hidden property on the TypeScript enum object.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions