You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
consul/internal/resource/protoc-gen-json-shim/main.go

31 lines
785 B

// Copyright (c) HashiCorp, Inc.
// SPDX-License-Identifier: BUSL-1.1
package main
import (
"flag"
"google.golang.org/protobuf/compiler/protogen"
plugin "google.golang.org/protobuf/types/pluginpb"
"github.com/hashicorp/consul/internal/resource/protoc-gen-json-shim/internal/generate"
)
var (
file = flag.String("file", "-", "where to load data from")
)
// This file is responsible for generating a JSON marhsal/unmarshal overwrite for proto
// structs which allows Kubernetes CRDs to get created directly from the proto-types.
func main() {
flag.Parse()
protogen.Options{
ParamFunc: flag.CommandLine.Set,
}.Run(func(gp *protogen.Plugin) error {
gp.SupportedFeatures = uint64(plugin.CodeGeneratorResponse_FEATURE_PROTO3_OPTIONAL)
return generate.Generate(gp)
})
}