To build and run this tool you will need the following tools:
To build the standalone jar run the following command from the repository root:
mvn package
To run the unit tests execute the following command:
mvn test
After performing the build, to run the converter using compute.v1.json
as a
sample input (included in this repository) run the following command from the
repository root:
java \
-jar target/disco-to-proto3-converter-0.0.1-SNAPSHOT-jar-with-dependencies.jar \
--discovery_doc_path=src/test/resources/google/cloud/compute/v1/compute.v1.json \
--output_file_path=google/cloud/compute/v1/compute.proto \
--enums_as_strings=True
Check the google/cloud/compute/v1
directory for the converted compute.proto
file.
The converter can also be used from Bazel via the proto_from_disco
bazel rule
like the following:
load(
"@com_google_disco_to_proto3_converter//rules_gapic:disco_to_proto.bzl",
"proto_from_disco",
)
proto_from_disco(
name = "compute",
src = "//:src/test/resources/compute.v1.json",
)
This is not an officially supported Google product