Skip to content
This repository has been archived by the owner on Jun 20, 2024. It is now read-only.

Commit

Permalink
Setting the flag which claims that we support proto3 optional fields (#…
Browse files Browse the repository at this point in the history
…104)

Co-authored-by: Chrusty <>
  • Loading branch information
chrusty authored Dec 15, 2021
1 parent 284d269 commit 48d4fd9
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions internal/converter/converter.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import (
"github.com/chrusty/protoc-gen-jsonschema/internal/protos"
"github.com/sirupsen/logrus"
"github.com/xeipuuv/gojsonschema"
gengo "google.golang.org/protobuf/cmd/protoc-gen-go/internal_gengo"
"google.golang.org/protobuf/proto"
descriptor "google.golang.org/protobuf/types/descriptorpb"
plugin "google.golang.org/protobuf/types/pluginpb"
Expand Down Expand Up @@ -360,6 +361,11 @@ func (c *Converter) convert(request *plugin.CodeGeneratorRequest) (*plugin.CodeG
response.File = append(response.File, converted...)
}
}

// This is required in order to "support" optional proto3 fields:
// https://chromium.googlesource.com/external/github.com/protocolbuffers/protobuf/+/refs/heads/master/docs/implementing_proto3_presence.md
response.SupportedFeatures = &gengo.SupportedFeatures

return response, nil
}

Expand Down

0 comments on commit 48d4fd9

Please sign in to comment.