Skip to content

Commit

Permalink
Re-order tuple-related fields (#97)
Browse files Browse the repository at this point in the history
* re-order fields on TupleKey

* mark fields as required where applicable
  • Loading branch information
jpadilla authored Sep 29, 2023
1 parent c3a581f commit dba5895
Show file tree
Hide file tree
Showing 7 changed files with 1,768 additions and 1,736 deletions.
49 changes: 34 additions & 15 deletions docs/openapiv2/apidocs.swagger.json

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

25 changes: 14 additions & 11 deletions openfga/v1/openfga.proto
Original file line number Diff line number Diff line change
Expand Up @@ -44,18 +44,17 @@ message RelationshipCondition {
}

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

string relation = 2 [
(google.api.field_behavior) = REQUIRED,
(validate.rules).string = {
pattern: "^[^:#@\\s]{1,50}$",
ignore_empty: true
Expand All @@ -66,11 +65,15 @@ message TupleKey {
}
];

string user = 3 [
(validate.rules).string = {max_bytes: 512},
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: 512,
example: "\"user:anne\""
max_length: 256,
example: "\"document:2021-budget\""
}
];

Expand Down
25 changes: 16 additions & 9 deletions openfga/v1/openfga_service.proto
Original file line number Diff line number Diff line change
Expand Up @@ -859,6 +859,7 @@ message ReadResponse {

message WriteRequestTupleKey {
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,
Expand All @@ -867,6 +868,7 @@ message WriteRequestTupleKey {
];

string relation = 2 [
(google.api.field_behavior) = REQUIRED,
(validate.rules).string = {
pattern: "^[^:#@\\s]{1,50}$",
ignore_empty: true
Expand All @@ -878,6 +880,7 @@ message WriteRequestTupleKey {
];

string object = 3 [
(google.api.field_behavior) = REQUIRED,
(validate.rules).string = {
pattern: "^[^\\s]{2,256}$",
ignore_empty: true
Expand Down Expand Up @@ -962,6 +965,7 @@ message CheckRequest {

message CheckRequestTupleKey {
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,
Expand All @@ -970,6 +974,7 @@ message CheckRequestTupleKey {
];

string relation = 2 [
(google.api.field_behavior) = REQUIRED,
(validate.rules).string = {
pattern: "^[^:#@\\s]{1,50}$",
ignore_empty: true
Expand All @@ -981,6 +986,7 @@ message CheckRequestTupleKey {
];

string object = 3 [
(google.api.field_behavior) = REQUIRED,
(validate.rules).string = {
pattern: "^[^\\s]{2,256}$",
ignore_empty: true
Expand Down Expand Up @@ -1024,25 +1030,26 @@ message ExpandRequest {
}

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

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

0 comments on commit dba5895

Please sign in to comment.