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: Add DescEnum.value #927

Merged
merged 3 commits into from
Jul 8, 2024
Merged

V2: Add DescEnum.value #927

merged 3 commits into from
Jul 8, 2024

Conversation

timostamm
Copy link
Member

Similar to DescMessage.field, which allows lookup of field descriptors by local name, this adds DescEnum.value to allow lookup of enum value descriptors by numeric value:

import type { DescEnumValue } from "@bufbuild/protobuf";
import type { PhoneType, PhoneTypeSchema } from "./gen/example_pb";

const value: DescEnumValue = PhoneTypeSchema.value[PhoneType.MOBILE];

Signed-off-by: Timo Stamm <ts@timostamm.de>
@timostamm timostamm marked this pull request as ready for review July 8, 2024 09:16
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