Java multiple files annotation

This rule enforces that every proto file for a public API surface sets option java_multiple_files = true;, as mandated in AIP-191.

Details

This rule looks at each proto file, and complains if the java_multiple_files file annotation is not present, or set to false.

Examples

Incorrect code for this rule:

// Incorrect.
syntax = "proto3";

package google.example.v1;

// Needs `option java_multiple_files = true;`.
option java_package = "com.google.example.v1";
option java_outer_classname = "LibraryProto";

message Book {}

Correct code for this rule:

// Correct.
syntax = "proto3";

package google.example.v1;

option java_package = "com.google.example.v1";
option java_multiple_files = true;
option java_outer_classname = "LibraryProto";

message Book {}

Disabling

If you need to violate this rule, use a comment at the top of the file. Remember to also include an aip.dev/not-precedent comment explaining why.

// (-- api-linter: core::0191::java-multiple-files=disabled
//     aip.dev/not-precedent: We need to do this because reasons. --)
syntax = "proto3";

package google.example.v1;

option java_package = "com.google.example.v1";
option java_outer_classname = "LibraryProto";

message Book {}