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

Commit 48d4fd9

Browse files
authored
Setting the flag which claims that we support proto3 optional fields (#104)
Co-authored-by: Chrusty <>
1 parent 284d269 commit 48d4fd9

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

internal/converter/converter.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import (
1313
"github.com/chrusty/protoc-gen-jsonschema/internal/protos"
1414
"github.com/sirupsen/logrus"
1515
"github.com/xeipuuv/gojsonschema"
16+
gengo "google.golang.org/protobuf/cmd/protoc-gen-go/internal_gengo"
1617
"google.golang.org/protobuf/proto"
1718
descriptor "google.golang.org/protobuf/types/descriptorpb"
1819
plugin "google.golang.org/protobuf/types/pluginpb"
@@ -360,6 +361,11 @@ func (c *Converter) convert(request *plugin.CodeGeneratorRequest) (*plugin.CodeG
360361
response.File = append(response.File, converted...)
361362
}
362363
}
364+
365+
// This is required in order to "support" optional proto3 fields:
366+
// https://chromium.googlesource.com/external/github.com/protocolbuffers/protobuf/+/refs/heads/master/docs/implementing_proto3_presence.md
367+
response.SupportedFeatures = &gengo.SupportedFeatures
368+
363369
return response, nil
364370
}
365371

0 commit comments

Comments
 (0)