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

[poc] feat: allow upsert for write #212

Closed
wants to merge 1 commit into from
Closed
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
14 changes: 14 additions & 0 deletions docs/openapiv2/apidocs.swagger.json

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

4 changes: 4 additions & 0 deletions openfga/v1/openfga_service.proto
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import "openfga/v1/authzmodel.proto";
import "openfga/v1/errors_ignore.proto";
import "openfga/v1/openfga.proto";
import "openfga/v1/openfga_service_consistency.proto";
import "openfga/v1/openfga_upsert.proto";
import "protoc-gen-openapiv2/options/annotations.proto";
import "validate/validate.proto";

Expand Down Expand Up @@ -1162,6 +1163,9 @@ message WriteRequest {
},
(grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = {example: "\"01G5JAVJ41T49E9TT3SKVS7X1J\""}
];

// Controls whether insert only or allow upsert. Default value is UPSERT_UNSPECIFIED, which will have the same behavior as INSERT_ONLY.
UpsertPreference upsert_allowed = 5 [(validate.rules).enum.defined_only = true];
}

message WriteResponse {}
Expand Down
13 changes: 13 additions & 0 deletions openfga/v1/openfga_upsert.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
syntax = "proto3";

package openfga.v1;

// Controls whether duplicate is allowed.
enum UpsertPreference {
// Default if not set. Behavior will be the same as INSERT_ONLY.
UPSERT_UNSPECIFIED = 0;

Check failure on line 8 in openfga/v1/openfga_upsert.proto

View workflow job for this annotation

GitHub Actions / build

Enum value name "UPSERT_UNSPECIFIED" should be prefixed with "UPSERT_PREFERENCE_".
// Write failed when there are duplicate entry.
INSERT_ONLY = 100;

Check failure on line 10 in openfga/v1/openfga_upsert.proto

View workflow job for this annotation

GitHub Actions / build

Enum value name "INSERT_ONLY" should be prefixed with "UPSERT_PREFERENCE_".
// Upsert when there are existing entry.
ALLOW_UPSERT = 200;

Check failure on line 12 in openfga/v1/openfga_upsert.proto

View workflow job for this annotation

GitHub Actions / build

Enum value name "ALLOW_UPSERT" should be prefixed with "UPSERT_PREFERENCE_".
}
699 changes: 359 additions & 340 deletions proto/openfga/v1/openfga_service.pb.go

Large diffs are not rendered by default.

11 changes: 11 additions & 0 deletions proto/openfga/v1/openfga_service.pb.validate.go

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

147 changes: 147 additions & 0 deletions proto/openfga/v1/openfga_upsert.pb.go

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

36 changes: 36 additions & 0 deletions proto/openfga/v1/openfga_upsert.pb.validate.go

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

Loading