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
@suda
Copy link
Author

suda commented Dec 29, 2025

@timotheeguerin I see you seem to commit most to the protobuf emitter. Is there anything else I should do to proceed with review/merge of this PR?

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.

1 participant