diff --git a/internal/examples/proto/buf.lock b/internal/examples/proto/buf.lock index 5bfbdad..2e09afb 100644 --- a/internal/examples/proto/buf.lock +++ b/internal/examples/proto/buf.lock @@ -4,7 +4,4 @@ deps: - remote: buf.build owner: googleapis repository: googleapis - branch: main - commit: d1a849b8f8304950832335723096e954 - digest: b1-zJkwX0YeOp1Wa0Jaj_RqMLa2-oEzePH6PJEK8aaMeI4= - create_time: 2021-08-26T15:07:19.652533Z + commit: 8d7204855ec14631a499bd7393ce1970 diff --git a/internal/examples/proto/gen/json/ExampleAnnotations.json b/internal/examples/proto/gen/json/einride_bigquery_example_v1_exampleannotations.json similarity index 100% rename from internal/examples/proto/gen/json/ExampleAnnotations.json rename to internal/examples/proto/gen/json/einride_bigquery_example_v1_exampleannotations.json diff --git a/internal/examples/proto/gen/json/ExampleDateTime.json b/internal/examples/proto/gen/json/einride_bigquery_example_v1_exampledatetime.json similarity index 100% rename from internal/examples/proto/gen/json/ExampleDateTime.json rename to internal/examples/proto/gen/json/einride_bigquery_example_v1_exampledatetime.json diff --git a/internal/examples/proto/gen/json/ExampleEnum.json b/internal/examples/proto/gen/json/einride_bigquery_example_v1_exampleenum.json similarity index 100% rename from internal/examples/proto/gen/json/ExampleEnum.json rename to internal/examples/proto/gen/json/einride_bigquery_example_v1_exampleenum.json diff --git a/internal/examples/proto/gen/json/ExampleList.json b/internal/examples/proto/gen/json/einride_bigquery_example_v1_examplelist.json similarity index 100% rename from internal/examples/proto/gen/json/ExampleList.json rename to internal/examples/proto/gen/json/einride_bigquery_example_v1_examplelist.json diff --git a/internal/examples/proto/gen/json/ExampleMap.json b/internal/examples/proto/gen/json/einride_bigquery_example_v1_examplemap.json similarity index 100% rename from internal/examples/proto/gen/json/ExampleMap.json rename to internal/examples/proto/gen/json/einride_bigquery_example_v1_examplemap.json diff --git a/internal/examples/proto/gen/json/ExampleOneof.json b/internal/examples/proto/gen/json/einride_bigquery_example_v1_exampleoneof.json similarity index 100% rename from internal/examples/proto/gen/json/ExampleOneof.json rename to internal/examples/proto/gen/json/einride_bigquery_example_v1_exampleoneof.json diff --git a/internal/examples/proto/gen/json/ExampleWrappers.json b/internal/examples/proto/gen/json/einride_bigquery_example_v1_examplewrappers.json similarity index 100% rename from internal/examples/proto/gen/json/ExampleWrappers.json rename to internal/examples/proto/gen/json/einride_bigquery_example_v1_examplewrappers.json diff --git a/internal/examples/proto/gen/json/DogecoinTransaction.json b/internal/examples/proto/gen/json/einride_bigquery_public_v1_dogecointransaction.json similarity index 100% rename from internal/examples/proto/gen/json/DogecoinTransaction.json rename to internal/examples/proto/gen/json/einride_bigquery_public_v1_dogecointransaction.json diff --git a/internal/examples/proto/gen/json/FilmLocation.json b/internal/examples/proto/gen/json/einride_bigquery_public_v1_filmlocation.json similarity index 100% rename from internal/examples/proto/gen/json/FilmLocation.json rename to internal/examples/proto/gen/json/einride_bigquery_public_v1_filmlocation.json diff --git a/internal/examples/proto/gen/json/HackerNewsStory.json b/internal/examples/proto/gen/json/einride_bigquery_public_v1_hackernewsstory.json similarity index 100% rename from internal/examples/proto/gen/json/HackerNewsStory.json rename to internal/examples/proto/gen/json/einride_bigquery_public_v1_hackernewsstory.json diff --git a/internal/examples/proto/gen/json/HistoricSevereStorm.json b/internal/examples/proto/gen/json/einride_bigquery_public_v1_historicseverestorm.json similarity index 100% rename from internal/examples/proto/gen/json/HistoricSevereStorm.json rename to internal/examples/proto/gen/json/einride_bigquery_public_v1_historicseverestorm.json diff --git a/internal/examples/proto/gen/json/LondonBicycleRental.json b/internal/examples/proto/gen/json/einride_bigquery_public_v1_londonbicyclerental.json similarity index 100% rename from internal/examples/proto/gen/json/LondonBicycleRental.json rename to internal/examples/proto/gen/json/einride_bigquery_public_v1_londonbicyclerental.json diff --git a/internal/examples/proto/gen/json/LondonBicycleStation.json b/internal/examples/proto/gen/json/einride_bigquery_public_v1_londonbicyclestation.json similarity index 100% rename from internal/examples/proto/gen/json/LondonBicycleStation.json rename to internal/examples/proto/gen/json/einride_bigquery_public_v1_londonbicyclestation.json diff --git a/internal/examples/proto/gen/json/SanFransiscoTransitStopTime.json b/internal/examples/proto/gen/json/einride_bigquery_public_v1_sanfransiscotransitstoptime.json similarity index 100% rename from internal/examples/proto/gen/json/SanFransiscoTransitStopTime.json rename to internal/examples/proto/gen/json/einride_bigquery_public_v1_sanfransiscotransitstoptime.json diff --git a/internal/examples/proto/gen/json/WhosOnFirstGeoJson.json b/internal/examples/proto/gen/json/einride_bigquery_public_v1_whosonfirstgeojson.json similarity index 100% rename from internal/examples/proto/gen/json/WhosOnFirstGeoJson.json rename to internal/examples/proto/gen/json/einride_bigquery_public_v1_whosonfirstgeojson.json diff --git a/protoc-gen-bq-json-schema/genjson/message.go b/protoc-gen-bq-json-schema/genjson/message.go index 1876148..55cc714 100644 --- a/protoc-gen-bq-json-schema/genjson/message.go +++ b/protoc-gen-bq-json-schema/genjson/message.go @@ -2,13 +2,15 @@ package genjson import ( "fmt" + "strings" "go.einride.tech/protobuf-bigquery/encoding/jsonbq" "google.golang.org/protobuf/compiler/protogen" ) func GenerateSchemaFile(gen *protogen.Plugin, msg *protogen.Message, config Config) error { - g := gen.NewGeneratedFile(fmt.Sprintf("%s.json", msg.Desc.Name()), "") + filename := strings.ReplaceAll(strings.ToLower(string(msg.Desc.FullName())), ".", "_") + g := gen.NewGeneratedFile(fmt.Sprintf("%s.json", filename), "") schema := config.SchemaOptions.InferMessageSchema(msg.Desc) jsonOpt := jsonbq.MarshalOptions{} if config.Format {