Skip to content

Commit 610c846

Browse files
Merge pull request #66 from mterwill/optional-fields
Support proto3 field presence (optional fields)
2 parents 0d0c416 + 2f0f114 commit 610c846

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed

CHANGELOG.md

+4
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,10 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
99

1010
## [Unreleased]
1111

12+
### Added
13+
14+
- Support for proto3 field presence (optional fields)
15+
1216

1317
## [0.7.4] - 2021-07-31
1418

protoc-gen-twirp_php/internal/gen/generator.go

+3
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import (
99
"github.com/twirphp/twirp/protoc-gen-twirp_php/templates/global"
1010
"github.com/twirphp/twirp/protoc-gen-twirp_php/templates/service"
1111
"google.golang.org/protobuf/compiler/protogen"
12+
"google.golang.org/protobuf/types/pluginpb"
1213
)
1314

1415
const twirpVersion = "v5.3.0"
@@ -30,6 +31,8 @@ type globalFileData struct {
3031

3132
// Generate is the main code generator.
3233
func Generate(plugin *protogen.Plugin, version string) error {
34+
plugin.SupportedFeatures = uint64(pluginpb.CodeGeneratorResponse_FEATURE_PROTO3_OPTIONAL)
35+
3336
namespaces := map[string]bool{}
3437

3538
for _, file := range plugin.Files {

0 commit comments

Comments
 (0)