File tree Expand file tree Collapse file tree 3 files changed +41
-0
lines changed
betterproto/tests/inputs/import_circular_dependency Expand file tree Collapse file tree 3 files changed +41
-0
lines changed Original file line number Diff line number Diff line change
1
+ syntax = "proto3" ;
2
+
3
+ import "root.proto" ;
4
+ import "other.proto" ;
5
+
6
+ // This test-case verifies that future implementations will support circular dependencies in the generated python files.
7
+ //
8
+ // This becomes important when generating 1 python file/module per package, rather than 1 file per proto file.
9
+ //
10
+ // Scenario:
11
+ //
12
+ // The proto messages depend on each other in a non-circular way:
13
+ //
14
+ // Test -------> RootPackageMessage <--------------.
15
+ // `------------------------------------> OtherPackageMessage
16
+ //
17
+ // Test and RootPackageMessage are in different files, but belong to the same package (root):
18
+ //
19
+ // (Test -------> RootPackageMessage) <------------.
20
+ // `------------------------------------> OtherPackageMessage
21
+ //
22
+ // After grouping the packages into single files or modules, a circular dependency is created:
23
+ //
24
+ // (root: Test & RootPackageMessage) <-------> (other: OtherPackageMessage)
25
+ message Test {
26
+ RootPackageMessage message = 1 ;
27
+ other.OtherPackageMessage other = 2 ;
28
+ }
Original file line number Diff line number Diff line change
1
+ syntax = "proto3" ;
2
+
3
+ import "root.proto" ;
4
+ package other ;
5
+
6
+ message OtherPackageMessage {
7
+ RootPackageMessage rootPackageMessage = 1 ;
8
+ }
Original file line number Diff line number Diff line change
1
+ syntax = "proto3" ;
2
+
3
+ message RootPackageMessage {
4
+
5
+ }
You can’t perform that action at this time.
0 commit comments