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 setting protobuf extension fields by name #1095

Open
2 tasks done
jnthntatum opened this issue Dec 13, 2024 · 0 comments
Open
2 tasks done

Support for setting protobuf extension fields by name #1095

jnthntatum opened this issue Dec 13, 2024 · 0 comments

Comments

@jnthntatum
Copy link
Collaborator

PR #1002 adds syntax for specifying extension fields for select operations, but at the moment the type check and runtime steps don't consider extensions for message creation.

Feature request checklist

  • There are no issues that match the desired change
  • The change is large enough it can't be addressed with a simple Pull Request

Change

Add support for setting extension fields by fully qualified name in protobuf message struct creation. I suspect this isn't a major change, but will address separately from the parser changes to support the syntax.

Example

// Creates a new struct with the extension set:
ExampleType{
    `google.expr.proto2.test.int32_ext`: 42,
    field: "foo"
}.`google.expr.proto2.test.int32_ext` == 42

Alternatives considered

This could be implemented by macro, e.g.

proto.WithExtensionsSet(
   Example{field: "foo"},
  {"google.expr.proto2.test.int32_ext": 42}
).`google.expr.proto2.test.int32_ext` == 42

but dedicated syntax is a bit more clear and in either case there needs to be some update to type check and evaluation to fully support.

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

1 participant