Skip to content

Commit

Permalink
Support optional fields
Browse files Browse the repository at this point in the history
No changes are required beyond setting this flag as twirphp doesn't
interact with message types at all.

Fixes:

    example.proto: is a proto3 file that contains optional fields, but code generator protoc-gen-twirp_php hasn't been updated to support optional fields in proto3. Please ask the owner of this code generator to support proto3 optional.
  • Loading branch information
mterwill committed Aug 23, 2021
1 parent 0d0c416 commit 8993ac6
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ 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
2 changes: 2 additions & 0 deletions protoc-gen-twirp_php/internal/gen/generator.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,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 8993ac6

Please sign in to comment.