-
Notifications
You must be signed in to change notification settings - Fork 349
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This PR aims to fix a conflict that is created between two options that results in code that fails to compile. Please note that this is not an attempt to fix the underlying problem, which I have explained in a TODO comment in the code for posterity. I also created new tests to capture any regressions. --------- Co-authored-by: semantic-release-bot <semantic-release-bot@martynus.net>
- Loading branch information
1 parent
23bb2f8
commit 064665f
Showing
10 changed files
with
4,311 additions
and
1 deletion.
There are no files selected for viewing
3,758 changes: 3,758 additions & 0 deletions
3,758
integration/options-types-only/google/protobuf/descriptor.ts
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import { protoMetadata } from "./options"; | ||
|
||
describe("options", () => { | ||
it("compiles", () => { | ||
expect(protoMetadata).not.toBeUndefined(); | ||
}); | ||
|
||
it("has the right options", () => { | ||
expect(protoMetadata.options?.messages?.["MyMessage"]?.options?.["my_message_option"]).toBe(1234); | ||
}); | ||
}); |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
syntax = "proto3"; | ||
|
||
import "google/protobuf/descriptor.proto"; | ||
import "something/something.proto"; | ||
|
||
extend google.protobuf.FileOptions { | ||
optional string my_file_option = 50000; | ||
} | ||
|
||
extend google.protobuf.MessageOptions { | ||
optional int32 my_message_option = 50001; | ||
} | ||
|
||
extend google.protobuf.FieldOptions { | ||
optional float my_field_option = 50002; | ||
} | ||
|
||
extend google.protobuf.OneofOptions { | ||
optional int64 my_oneof_option = 50003; | ||
} | ||
|
||
extend google.protobuf.EnumOptions { | ||
optional bool my_enum_option = 50004; | ||
} | ||
|
||
extend google.protobuf.EnumValueOptions { | ||
optional uint32 my_enum_value_option = 50005; | ||
} | ||
|
||
extend google.protobuf.ServiceOptions { | ||
optional MyEnum my_service_option = 50006; | ||
} | ||
|
||
extend google.protobuf.MethodOptions { | ||
optional MyMessage my_method_option = 50007; | ||
} | ||
|
||
option (my_file_option) = "Hello world!"; | ||
|
||
message MyMessage { | ||
option (my_message_option) = 1234; | ||
|
||
optional int32 foo = 1 [(my_field_option) = 4.5]; | ||
optional int32 foo_2 = 2 [(something.something) = { | ||
hello: "world"; | ||
foo: [123, 345]; | ||
}]; | ||
optional string bar = 3; | ||
oneof qux { | ||
option (my_oneof_option) = 42; | ||
|
||
string quux = 4; | ||
} | ||
} | ||
|
||
enum MyEnum { | ||
option (my_enum_option) = true; | ||
|
||
FOO = 0 [(my_enum_value_option) = 321]; | ||
BAR = 1; | ||
} | ||
|
||
message RequestType {} | ||
message ResponseType {} | ||
|
||
service MyService { | ||
option (my_service_option) = FOO; | ||
|
||
rpc MyMethod(RequestType) returns(ResponseType) { | ||
option (my_method_option).foo = 150; | ||
option (my_method_option).foo_2 = 150; | ||
option (my_method_option).bar = "Some string"; | ||
option (my_method_option).quux = "Some string"; | ||
} | ||
} |
Oops, something went wrong.