Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3,758 changes: 3,758 additions & 0 deletions integration/options-types-only/google/protobuf/descriptor.ts

Large diffs are not rendered by default.

11 changes: 11 additions & 0 deletions integration/options-types-only/options-test.ts
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 added integration/options-types-only/options.bin
Binary file not shown.
75 changes: 75 additions & 0 deletions integration/options-types-only/options.proto
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";
}
}
Loading