Skip to content

API Improvements in Experimental #102

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

Merged
merged 3 commits into from
May 3, 2024
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
39 changes: 39 additions & 0 deletions authzed/api/v1/error_reason.proto
Original file line number Diff line number Diff line change
Expand Up @@ -314,4 +314,43 @@ enum ErrorReason {
// }
// }
ERROR_REASON_TOO_MANY_CHECKS_IN_REQUEST = 21;

// The request's specified limit is too large.
//
// Example of an ErrorInfo:
//
// {
// "reason": "ERROR_REASON_EXCEEDS_MAXIMUM_ALLOWABLE_LIMIT",
// "domain": "authzed.com",
// "metadata": {
// "limit_provided": "525",
// "maximum_limit_allowed": "500",
// }
// }
ERROR_REASON_EXCEEDS_MAXIMUM_ALLOWABLE_LIMIT = 22;

// The request failed because the provided filter was invalid in some way.
//
// Example of an ErrorInfo:
//
// {
// "reason": "ERROR_REASON_INVALID_FILTER",
// "domain": "authzed.com",
// "metadata": {
// "filter": "...",
// }
// }
ERROR_REASON_INVALID_FILTER = 23;

// The request failed because too many concurrent updates were attempted
// against the in-memory datastore.
//
// Example of an ErrorInfo:
//
// {
// "reason": "ERROR_REASON_INMEMORY_TOO_MANY_CONCURRENT_UPDATES",
// "domain": "authzed.com",
// "metadata": {}
// }
ERROR_REASON_INMEMORY_TOO_MANY_CONCURRENT_UPDATES = 24;
}
48 changes: 31 additions & 17 deletions authzed/api/v1/experimental_service.proto
Original file line number Diff line number Diff line change
Expand Up @@ -207,57 +207,64 @@
ZedToken read_at = 3;
}

// ExpSchemaFilter is a filter that can be applied to the schema on reflection.
message ExpSchemaFilter {
enum KindFilter {
KIND_FILTER_UNSPECIFIED = 0;
KIND_FILTER_DEFINITION = 1;
KIND_FILTER_CAVEAT = 2;
KIND_FILTER_RELATION = 3;
KIND_FILTER_PERMISSION = 4;
}

// optional_definition_name_match is a regex that is matched against the definition or caveat name.
// If not specified, will be ignored.
// optional_definition_name_match is a regex that is matched against the definition name.
string optional_definition_name_match = 1;

// optional_relation_or_permission_name_match is a regex that is matched against the relation or permission name.
// If not specified, will be ignored.
string optional_relation_or_permission_name_match = 2;
// optional_caveat_name_match is a regex that is matched against the caveat name.
string optional_caveat_name_match = 2;

Check failure on line 216 in authzed/api/v1/experimental_service.proto

View workflow job for this annotation

GitHub Actions / Lint & Publish Draft/Branch

Field "2" with name "optional_caveat_name_match" on message "ExpSchemaFilter" changed option "json_name" from "optionalRelationOrPermissionNameMatch" to "optionalCaveatNameMatch".

Check failure on line 216 in authzed/api/v1/experimental_service.proto

View workflow job for this annotation

GitHub Actions / Lint & Publish Draft/Branch

Field "2" on message "ExpSchemaFilter" changed name from "optional_relation_or_permission_name_match" to "optional_caveat_name_match".

// optional_relation_name_match is a regex that is matched against the relation name.
string optional_relation_name_match = 3;

Check failure on line 219 in authzed/api/v1/experimental_service.proto

View workflow job for this annotation

GitHub Actions / Lint & Publish Draft/Branch

Field "3" with name "optional_relation_name_match" on message "ExpSchemaFilter" changed option "json_name" from "kindFilters" to "optionalRelationNameMatch".

Check failure on line 219 in authzed/api/v1/experimental_service.proto

View workflow job for this annotation

GitHub Actions / Lint & Publish Draft/Branch

Field "3" on message "ExpSchemaFilter" changed label from "repeated" to "optional".

Check failure on line 219 in authzed/api/v1/experimental_service.proto

View workflow job for this annotation

GitHub Actions / Lint & Publish Draft/Branch

Field "3" on message "ExpSchemaFilter" changed type from "enum" to "string". See https://developers.google.com/protocol-buffers/docs/proto3#updating for wire compatibility rules and https://developers.google.com/protocol-buffers/docs/proto3#json for JSON compatibility rules.

Check failure on line 219 in authzed/api/v1/experimental_service.proto

View workflow job for this annotation

GitHub Actions / Lint & Publish Draft/Branch

Field "3" on message "ExpSchemaFilter" changed name from "kind_filters" to "optional_relation_name_match".

// kind_filters is a list of kinds to filter on. If not specified, will be ignored. If multiple are specified,
// the filter will be applied in an OR fashion.
repeated KindFilter kind_filters = 3;
// optional_permission_name_match is a regex that is matched against the permission name.
string optional_permission_name_match = 4;
}

// ExpDefinition is the representation of a definition in the schema.
message ExpDefinition {
string name = 1;

// comment is a human-readable comments on the definition. Will include
// delimiter characters.
string comment = 2;

repeated ExpRelation relations = 3;
repeated ExpPermission permissions = 4;
}

// ExpCaveat is the representation of a caveat in the schema.
message ExpCaveat {
string name = 1;

// comment is a human-readable comments on the caveat. Will include
// delimiter characters.
string comment = 2;

repeated ExpCaveatParameter parameters = 3;
string expression = 4;
}

// ExpCaveatParameter is the representation of a parameter in a caveat.
message ExpCaveatParameter {
string name = 1;

// type is the type of the parameter. Will be a string representing the
// type, e.g. `int` or `list<string>`
string type = 2;
string parent_caveat_name = 3;
}

// ExpRelation is the representation of a relation in the schema.
message ExpRelation {
string name = 1;
string comment = 2;
string parent_definition_name = 3;
repeated ExpTypeReference subject_types = 4;
}

// ExpTypeReference is the representation of a type reference in the schema.
message ExpTypeReference {
// subject_definition_name is the name of the subject's definition.
string subject_definition_name = 1;
Expand All @@ -277,8 +284,12 @@
}
}

// ExpPermission is the representation of a permission in the schema.
message ExpPermission {
string name = 1;

// comment is a human-readable comments on the permission. Will include
// delimiter characters.
string comment = 2;
string parent_definition_name = 3;
}
Expand All @@ -293,14 +304,16 @@
string optional_definition_name_match = 3;
}

// ExpRelationReference is a reference to a relation in the schema.
message ExpRelationReference {
string definition_name = 1;
string relation_name = 2;
}

// ExpPermissionReference is a reference to a permission in the schema.
message ExpPermissionReference {
string definition_name = 1;
string relation_name = 2;
string permission_name = 2;

Check failure on line 316 in authzed/api/v1/experimental_service.proto

View workflow job for this annotation

GitHub Actions / Lint & Publish Draft/Branch

Field "2" with name "permission_name" on message "ExpPermissionReference" changed option "json_name" from "relationName" to "permissionName".

Check failure on line 316 in authzed/api/v1/experimental_service.proto

View workflow job for this annotation

GitHub Actions / Lint & Publish Draft/Branch

Field "2" on message "ExpPermissionReference" changed name from "relation_name" to "permission_name".
}

message ExperimentalComputablePermissionsResponse {
Expand Down Expand Up @@ -344,6 +357,7 @@
string previous_type = 2;
}

// ExpSchemaDiff is the representation of a diff between two schemas.
message ExpSchemaDiff {
oneof diff {
ExpDefinition definition_added = 1;
Expand Down
Loading