...

Source file src/github.com/grpc-ecosystem/grpc-gateway/v2/internal/codegenerator/supported_features.go

Documentation: github.com/grpc-ecosystem/grpc-gateway/v2/internal/codegenerator

     1  package codegenerator
     2  
     3  import (
     4  	"google.golang.org/protobuf/compiler/protogen"
     5  	"google.golang.org/protobuf/types/pluginpb"
     6  )
     7  
     8  func supportedCodeGeneratorFeatures() uint64 {
     9  	// Enable support for optional keyword in proto3.
    10  	return uint64(pluginpb.CodeGeneratorResponse_FEATURE_PROTO3_OPTIONAL)
    11  }
    12  
    13  // SetSupportedFeaturesOnPluginGen sets supported proto3 features
    14  // on protogen.Plugin.
    15  func SetSupportedFeaturesOnPluginGen(gen *protogen.Plugin) {
    16  	gen.SupportedFeatures = supportedCodeGeneratorFeatures()
    17  }
    18  
    19  // SetSupportedFeaturesOnCodeGeneratorResponse sets supported proto3 features
    20  // on pluginpb.CodeGeneratorResponse.
    21  func SetSupportedFeaturesOnCodeGeneratorResponse(resp *pluginpb.CodeGeneratorResponse) {
    22  	sf := supportedCodeGeneratorFeatures()
    23  	resp.SupportedFeatures = &sf
    24  }
    25  

View as plain text