Skip to content

Commit

Permalink
refactor(write): normalize deletes field to TupleKeyWithoutCondition (
Browse files Browse the repository at this point in the history
  • Loading branch information
jon-whit authored Nov 22, 2023
1 parent c85ea63 commit 7161d70
Show file tree
Hide file tree
Showing 7 changed files with 2,588 additions and 2,050 deletions.
48 changes: 44 additions & 4 deletions docs/openapiv2/apidocs.swagger.json

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

35 changes: 35 additions & 0 deletions openfga/v1/openfga.proto
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,41 @@ message RelationshipCondition {
google.protobuf.Struct context = 2 [(google.api.field_behavior) = REQUIRED];
}

message TupleKeyWithoutCondition {
string user = 1 [
(google.api.field_behavior) = REQUIRED,
(validate.rules).string = {max_bytes: 512},
(grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = {
max_length: 512,
example: "\"user:anne\""
}
];

string relation = 2 [
(google.api.field_behavior) = REQUIRED,
(validate.rules).string = {
pattern: "^[^:#@\\s]{1,50}$",
ignore_empty: true
},
(grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = {
max_length: 50,
example: "\"reader\""
}
];

string object = 3 [
(google.api.field_behavior) = REQUIRED,
(validate.rules).string = {
pattern: "^[^\\s]{2,256}$",
ignore_empty: true
},
(grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = {
max_length: 256,
example: "\"document:2021-budget\""
}
];
}

message TupleKey {
string user = 1 [

Check failure on line 82 in openfga/v1/openfga.proto

View workflow job for this annotation

GitHub Actions / build

Field "1" with name "user" on message "TupleKey" changed option "json_name" from "object" to "user".

Check failure on line 82 in openfga/v1/openfga.proto

View workflow job for this annotation

GitHub Actions / build

Field "1" on message "TupleKey" changed name from "object" to "user".
(google.api.field_behavior) = REQUIRED,
Expand Down
15 changes: 12 additions & 3 deletions openfga/v1/openfga_service.proto
Original file line number Diff line number Diff line change
Expand Up @@ -898,7 +898,7 @@ message WriteRequestTupleKey {
RelationshipCondition condition = 4;
}

message WriteRequestTupleKeys {
message WriteRequestWrites {
repeated WriteRequestTupleKey tuple_keys = 1 [
json_name = "tuple_keys",
(google.api.field_behavior) = REQUIRED,
Expand All @@ -907,6 +907,15 @@ message WriteRequestTupleKeys {
];
}

message WriteRequestDeletes {
repeated TupleKeyWithoutCondition tuple_keys = 1 [
json_name = "tuple_keys",
(google.api.field_behavior) = REQUIRED,
(validate.rules).repeated.min_items = 1,
(grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = {minimum: 1}
];
}

message WriteRequest {
string store_id = 1 [
json_name = "store_id",
Expand All @@ -915,9 +924,9 @@ message WriteRequest {
(grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = {example: "\"01YCP46JKYM8FJCQ37NMBYHE5X\""}
];

WriteRequestTupleKeys writes = 2;
WriteRequestWrites writes = 2;

Check failure on line 927 in openfga/v1/openfga_service.proto

View workflow job for this annotation

GitHub Actions / build

Field "2" on message "WriteRequest" changed type from "openfga.v1.TupleKeys" to "openfga.v1.WriteRequestWrites".

WriteRequestTupleKeys deletes = 3;
WriteRequestDeletes deletes = 3;

Check failure on line 929 in openfga/v1/openfga_service.proto

View workflow job for this annotation

GitHub Actions / build

Field "3" on message "WriteRequest" changed type from "openfga.v1.TupleKeys" to "openfga.v1.WriteRequestDeletes".

string authorization_model_id = 4 [
json_name = "authorization_model_id",
Expand Down
Loading

0 comments on commit 7161d70

Please sign in to comment.