Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor(write): normalize deletes field to TupleKeyWithoutCondition #116

Merged
merged 1 commit into from
Nov 22, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 [
(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 @@
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 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 @@
(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.WriteRequestTupleKeys" 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.WriteRequestTupleKeys" to "openfga.v1.WriteRequestDeletes".

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