diff --git a/betterproto/tests/inputs/import_circular_dependency/import_circular_dependency.proto b/betterproto/tests/inputs/import_circular_dependency/import_circular_dependency.proto new file mode 100644 index 0000000..589d14f --- /dev/null +++ b/betterproto/tests/inputs/import_circular_dependency/import_circular_dependency.proto @@ -0,0 +1,28 @@ +syntax = "proto3"; + +import "root.proto"; +import "other.proto"; + +// This test-case verifies that future implementations will support circular dependencies in the generated python files. +// +// This becomes important when generating 1 python file/module per package, rather than 1 file per proto file. +// +// Scenario: +// +// The proto messages depend on each other in a non-circular way: +// +// Test -------> RootPackageMessage <--------------. +// `------------------------------------> OtherPackageMessage +// +// Test and RootPackageMessage are in different files, but belong to the same package (root): +// +// (Test -------> RootPackageMessage) <------------. +// `------------------------------------> OtherPackageMessage +// +// After grouping the packages into single files or modules, a circular dependency is created: +// +// (root: Test & RootPackageMessage) <-------> (other: OtherPackageMessage) +message Test { + RootPackageMessage message = 1; + other.OtherPackageMessage other =2; +} diff --git a/betterproto/tests/inputs/import_circular_dependency/other.proto b/betterproto/tests/inputs/import_circular_dependency/other.proto new file mode 100644 index 0000000..2b936a9 --- /dev/null +++ b/betterproto/tests/inputs/import_circular_dependency/other.proto @@ -0,0 +1,8 @@ +syntax = "proto3"; + +import "root.proto"; +package other; + +message OtherPackageMessage { + RootPackageMessage rootPackageMessage = 1; +} diff --git a/betterproto/tests/inputs/import_circular_dependency/root.proto b/betterproto/tests/inputs/import_circular_dependency/root.proto new file mode 100644 index 0000000..63d15bf --- /dev/null +++ b/betterproto/tests/inputs/import_circular_dependency/root.proto @@ -0,0 +1,5 @@ +syntax = "proto3"; + +message RootPackageMessage { + +}