Skip to content

Commit

Permalink
feat: add support for contextual tuples in assertions API (#185)
Browse files Browse the repository at this point in the history
* Revert "Reverting contextual tuples in assertions API (#157) (#167)"

This reverts commit 5b0b494.

* undo go.mod changes

* amend API descriptions

* run make

* apply suggestion
  • Loading branch information
miparnisari committed Aug 7, 2024
1 parent 7e5be7b commit c96ec77
Show file tree
Hide file tree
Showing 4 changed files with 1,630 additions and 1,566 deletions.
12 changes: 10 additions & 2 deletions docs/openapiv2/apidocs.swagger.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 9 additions & 5 deletions openfga/v1/openfga_service.proto
Original file line number Diff line number Diff line change
Expand Up @@ -561,8 +561,8 @@ service OpenFGAService {
description:
"The WriteAssertions API will upsert new assertions for an authorization model id, "
"or overwrite the existing ones. An assertion is an object that contains a "
"tuple key, and the expectation of whether a call to the Check API of that tuple key "
"will return true or false. "
"tuple key, the expectation of whether a call to the Check API of that tuple key "
"will return true or false, and optionally a list of contextual tuples."
responses: {
key: "204"
value: {
Expand All @@ -584,9 +584,7 @@ service OpenFGAService {
operation_id: "ReadAssertions"
description:
"The ReadAssertions API will return, for a given authorization model id, "
"all the assertions stored for it. An assertion is an object that contains a "
"tuple key, and the expectation of whether a call to the Check API of that tuple key "
"will return true or false. "
"all the assertions stored for it. "
};
}

Expand Down Expand Up @@ -1588,6 +1586,12 @@ message Assertion {
json_name = "expectation",
(google.api.field_behavior) = REQUIRED
];

repeated TupleKey contextual_tuples = 3 [
json_name = "contextual_tuples",
(validate.rules).repeated.max_items = 20,
(grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = {maximum: 20}
];
}

message Assertions {
Expand Down
Loading

0 comments on commit c96ec77

Please sign in to comment.