Skip to content

Built-in support for filtering and pagination in Quarkus gRPC, following Google AIPs 158 & 160 #48951

@orchestr7

Description

@orchestr7

Description

Quarkus gRPC currently leaves the implementation of filtering and pagination entirely to the user. However, these features are common requirements in almost any real-world gRPC-based API, and there are well-established conventions and standards for them, such as:

Proposal

It would be extremely valuable for Quarkus to provide built-in support for filtering and pagination in gRPC services, ideally by:

  • Supplying proto definitions for standard request fields (page_size, page_token, Filter filter etc.)
  • Offering composable protobuf messages implementing AIP 158/160 conventions, e.g. a standard Filter message.
  • Providing Java (and ideally Panache/JPA/Hibernate-integrated) helpers for parsing the standard filter expression language (like that described in AIP 160).
  • Framework-level support or code-generation for mapping filter expressions into database queries in a secure, idiomatic way.

A sample message following AIP-160 for filtering and AIP-158 for pagination:

message ListWidgetsRequest {
  int32 page_size = 1;
  string page_token = 2;
  string filter = 3;   // AIP-160 style filter
}

Or, with a helper Filter message:

message ListWidgetsRequest {
  int32 page_size = 1;
  string page_token = 2;
  Filter filter = 3;
}

Implementation ideas

For Filter it can be standard implementation, something like this:

message Filter {
    oneof filter {
        Or or = 1;
        And and = 2;
        Not not = 3;
    }
}

message Or {
    repeated Filter operands = 1;
}

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions