Method options¶
Set inside an rpc body:
rpc GetNote(GetNoteRequest) returns (GetNoteResponse) {
option (spec.rpc) = {principal: RPC_PRINCIPAL_USER};
}
spec.rest_method¶
Set on method · Type RestMethods · Number 80009
rest_method declares additional HTTP methods for this RPC's REST endpoint.
POST is always implicit on every convention REST route.
Example: option (spec.rest_method) = {methods: [REST_METHOD_GET]};
spec.rest_path¶
Set on method · Type string · Number 80008
rest_path adds an additional alias REST route for this method.
The path is relative to the origin root.
The convention path (/{package}/{Service}/{MethodName}) is always
present; rest_path creates a second route with the same HTTP methods.
Example: option (spec.rest_path) = ".well-known/openid-configuration";
spec.proof_requires¶
Set on method · Type string · Number 80010
proof_requires declares a precondition on an RPC method.
In Rust, emitted as #[kani::requires(...)].
In Java, emitted as //@ requires ... (JML).
Example: option (spec.proof_requires) = "!request.client_id.is_empty()";
spec.proof_ensures¶
Set on method · Type string · Number 80011
proof_ensures declares a postcondition on an RPC method.
In Rust, emitted as #[kani::ensures(...)].
In Java, emitted as //@ ensures ... (JML).
Example: option (spec.proof_ensures) = "response.token.len() > 0";
spec.method_collection¶
Set on method · Type MethodCollection · Number 80014
method_collection marks a collection-returning read and declares its shape.
Example: option (spec.method_collection) = {mode: COLLECTION_MODE_SNAPSHOT, max_items: 1000, order_by: ["created_at"]};
Example: option (spec.method_collection) = {mode: COLLECTION_MODE_WATCH, order_by: ["id"]};
spec.rpc¶
Set on method · Type RpcAnnotation · Number 80015
rpc declares an RPC's call surface: who calls it (principal), where it is
reachable from (exposure), its non-exclusive protocol flags, the service
identities allowed to call it, and its target namespace field.
Example: option (spec.rpc) = {principal: RPC_PRINCIPAL_SERVICE, auth_services: ["*"]};
Example: option (spec.rpc) = {principal: RPC_PRINCIPAL_USER, exposure: RPC_EXPOSURE_EXTERNAL, flags: [RPC_FLAG_AUTH_ENTITLED_USERS]};
spec.min_group_size¶
Set on method · Type int32 · Number 80016
min_group_size is the smallest result size this RPC will disclose. Stamped
by the record-map injector onto every size-only RPC of a record declaring
(spec.record).min_group_size. Not hand-written on any RPC.
spec.rest_browser¶
Set on method · Type RestBrowser · Number 80017
rest_browser makes this RPC's REST route a browser form target: a
form-urlencoded request body, and a 303 redirect instead of a JSON answer.
Example: option (spec.rest_browser) = {form_body: true, redirect_field: "redirect_url"};