Versioned packages

This rule enforces that API-specific protos use versioned packages, as mandated in AIP-215.


This rule examines the proto package and complains if it does not end something that appears to be a version component, such as v1 or v1beta. It also permits proto packages ending in type or master.


Incorrect code for this rule:

// Incorrect.
// Incorrect.

Correct code for this rule:

// Correct.

Known issues

This rule blindly assumes that the proto it is looking at is for an individual API (unless it ends in type). It will therefore complain about protos where the lack of a version is proper (such as google.longrunning, for example). This rule should be disabled in this situation.


If you need to violate this rule, place the comment above the package statement. Remember to also include an comment explaining why.

// (-- api-linter: core::0215::versioned-packages=disabled
// We need to do this because reasons. --)