Skip to content

Conversation

@suda
Copy link

@suda suda commented Nov 25, 2025

This PR adds the option to generate the optional fields in protobuf emitter:

model Message {
  @field(1) requiredField: string;
  @field(2) optionalField?: int32;
}

With emit-optional: false (default):

message Message {
  string requiredField = 1;
  int32 optionalField = 2;
}

With emit-optional: true:

message Message {
  string requiredField = 1;
  optional int32 optionalField = 2;
}

This is another attempt to get this implemented after #4100 #4311 #4312 by @w01fgang. I tried to follow @witemple-msft
c suggestion to use the built-in optionality and added the emit-optional that defaults to the current behavior.

@suda
Copy link
Author

suda commented Nov 25, 2025

@microsoft-github-policy-service agree

@microsoft-github-policy-service microsoft-github-policy-service bot added the stale Mark a PR that hasn't been recently updated and will be closed. label Dec 26, 2025
@microsoft-github-policy-service
Copy link
Contributor

Hi @@suda. Your PR has had no update for 30 days and it is marked as a stale PR. If it is not updated within 30 days, the PR will automatically be closed. If you want to refresh the PR, please remove the stale label.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

emitter:protobuf The protobuf emitter stale Mark a PR that hasn't been recently updated and will be closed.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant