Skip to content

Commit

Permalink
Merge pull request #66 from mterwill/optional-fields
Browse files Browse the repository at this point in the history
Support proto3 field presence (optional fields)
  • Loading branch information
sagikazarmark authored Aug 26, 2021
2 parents 0d0c416 + 2f0f114 commit 610c846
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.

## [Unreleased]

### Added

- Support for proto3 field presence (optional fields)


## [0.7.4] - 2021-07-31

Expand Down
3 changes: 3 additions & 0 deletions protoc-gen-twirp_php/internal/gen/generator.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import (
"github.com/twirphp/twirp/protoc-gen-twirp_php/templates/global"
"github.com/twirphp/twirp/protoc-gen-twirp_php/templates/service"
"google.golang.org/protobuf/compiler/protogen"
"google.golang.org/protobuf/types/pluginpb"
)

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

// Generate is the main code generator.
func Generate(plugin *protogen.Plugin, version string) error {
plugin.SupportedFeatures = uint64(pluginpb.CodeGeneratorResponse_FEATURE_PROTO3_OPTIONAL)

namespaces := map[string]bool{}

for _, file := range plugin.Files {
Expand Down

0 comments on commit 610c846

Please sign in to comment.