Repository: envoyproxy/envoy
File: api/envoy/config/route/v3/route_components.proto (Protocol Buffers)

Code before:
  // Specifies the name of a key that must be present in the requested
  // ``path``'s query string.
  string name = 1 [(validate.rules).string = {min_len: 1 max_bytes: 1024}];

  oneof query_parameter_match_specifier {
    // Specifies whether a query parameter value should match against a string.
    type.matcher.v3.StringMatcher string_match = 5 [(validate.rules).message = {required: true}];

    // Specifies whether a query parameter should be present.
    bool present_match = 6;
  }
}

// Cookie matching inspects individual name/value pairs parsed from the ``Cookie`` header.
// [#next-free-field: 7]
message CookieMatcher {
  // Specifies the cookie name to evaluate.
  string name = 1 [(validate.rules).string = {min_len: 1 max_bytes: 1024}];

  oneof cookie_match_specifier {
    // Match the cookie value using :ref:`StringMatcher
    // <envoy_v3_api_msg_type.matcher.v3.StringMatcher>` semantics.
    type.matcher.v3.StringMatcher string_match = 2 [(validate.rules).message = {required: true}];

    // Match the cookie value as an integer falling within the half-open interval ``[start, end)``.
    type.v3.Int64Range range_match = 3 [(validate.rules).message = {required: true}];

    // Match solely on the presence or absence of the cookie.
    bool present_match = 4;
  }

  // Invert the match result.
  bool invert_match = 5;

  // If specified, for any cookie match rule, if the cookie match rule specified cookie
  // does not exist, this cookie value will be treated as empty.
  bool treat_missing_cookie_as_empty = 6;
}

// HTTP Internal Redirect :ref:`architecture overview <arch_overview_internal_redirects>`.
// [#next-free-field: 6]
message InternalRedirectPolicy {
  // An internal redirect is not handled, unless the number of previous internal redirects that a
  // downstream request has encountered is lower than this value.
  // In the case where a downstream request is bounced among multiple routes by internal redirect,
  // the first route that hits this threshold, or does not set :ref:`internal_redirect_policy
  // <envoy_v3_api_field_config.route.v3.RouteAction.internal_redirect_policy>`
  // will pass the redirect back to downstream.
  //
  // If not specified, at most one redirect will be followed.
  google.protobuf.UInt32Value max_internal_redirects = 1;

Review comment (suggestion):
Per our style, we will prefer no 'oneof' now.

And as the initial support for cookie matching, i think we do needn't to support so much different match mode to avoid adding features that no one will use.

So, I think we only need keep the 'name', 'string_match', 'invert_match' there.

Code after:
  // Specifies the name of a key that must be present in the requested
  // ``path``'s query string.
  string name = 1 [(validate.rules).string = {min_len: 1 max_bytes: 1024}];

  oneof query_parameter_match_specifier {
    // Specifies whether a query parameter value should match against a string.
    type.matcher.v3.StringMatcher string_match = 5 [(validate.rules).message = {required: true}];

    // Specifies whether a query parameter should be present.
    bool present_match = 6;
  }
}

// Cookie matching inspects individual name/value pairs parsed from the ``Cookie`` header.
message CookieMatcher {
  // Specifies the cookie name to evaluate.
  string name = 1 [(validate.rules).string = {min_len: 1 max_bytes: 1024}];

  // Match the cookie value using :ref:`StringMatcher
  // <envoy_v3_api_msg_type.matcher.v3.StringMatcher>` semantics.
  type.matcher.v3.StringMatcher string_match = 2 [(validate.rules).message = {required: true}];

  // Invert the match result. If the cookie is not present, the match result is false, so
  // ``invert_match`` will cause the matcher to succeed when the cookie is absent.
  bool invert_match = 3;
}

// HTTP Internal Redirect :ref:`architecture overview <arch_overview_internal_redirects>`.
// [#next-free-field: 6]
message InternalRedirectPolicy {
  // An internal redirect is not handled, unless the number of previous internal redirects that a
  // downstream request has encountered is lower than this value.
  // In the case where a downstream request is bounced among multiple routes by internal redirect,
  // the first route that hits this threshold, or does not set :ref:`internal_redirect_policy
  // <envoy_v3_api_field_config.route.v3.RouteAction.internal_redirect_policy>`
  // will pass the redirect back to downstream.
  //
  // If not specified, at most one redirect will be followed.
  google.protobuf.UInt32Value max_internal_redirects = 1;

  // Defines what upstream response codes are allowed to trigger internal redirect. If unspecified,
  // only 302 will be treated as internal redirect.
  // Only 301, 302, 303, 307 and 308 are valid values. Any other codes will be ignored.
  repeated uint32 redirect_response_codes = 2 [(validate.rules).repeated = {max_items: 5}];

  // Specifies a list of predicates that are queried when an upstream response is deemed
  // to trigger an internal redirect by all other criteria. Any predicate in the list can reject
  // the redirect, causing the response to be proxied to downstream.
  // [#extension-category: envoy.internal_redirect_predicates]
  repeated core.v3.TypedExtensionConfig predicates = 3;