Skip to content

Commit 8e9616c

Browse files
authored
Merge pull request #102 from josephschorr/exp-api-improve
API Improvements in Experimental
2 parents 767f6e4 + 60b27da commit 8e9616c

2 files changed

Lines changed: 70 additions & 17 deletions

File tree

authzed/api/v1/error_reason.proto

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -314,4 +314,43 @@ enum ErrorReason {
314314
// }
315315
// }
316316
ERROR_REASON_TOO_MANY_CHECKS_IN_REQUEST = 21;
317+
318+
// The request's specified limit is too large.
319+
//
320+
// Example of an ErrorInfo:
321+
//
322+
// {
323+
// "reason": "ERROR_REASON_EXCEEDS_MAXIMUM_ALLOWABLE_LIMIT",
324+
// "domain": "authzed.com",
325+
// "metadata": {
326+
// "limit_provided": "525",
327+
// "maximum_limit_allowed": "500",
328+
// }
329+
// }
330+
ERROR_REASON_EXCEEDS_MAXIMUM_ALLOWABLE_LIMIT = 22;
331+
332+
// The request failed because the provided filter was invalid in some way.
333+
//
334+
// Example of an ErrorInfo:
335+
//
336+
// {
337+
// "reason": "ERROR_REASON_INVALID_FILTER",
338+
// "domain": "authzed.com",
339+
// "metadata": {
340+
// "filter": "...",
341+
// }
342+
// }
343+
ERROR_REASON_INVALID_FILTER = 23;
344+
345+
// The request failed because too many concurrent updates were attempted
346+
// against the in-memory datastore.
347+
//
348+
// Example of an ErrorInfo:
349+
//
350+
// {
351+
// "reason": "ERROR_REASON_INMEMORY_TOO_MANY_CONCURRENT_UPDATES",
352+
// "domain": "authzed.com",
353+
// "metadata": {}
354+
// }
355+
ERROR_REASON_INMEMORY_TOO_MANY_CONCURRENT_UPDATES = 24;
317356
}

authzed/api/v1/experimental_service.proto

Lines changed: 31 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -207,57 +207,64 @@ message ExperimentalReflectSchemaResponse {
207207
ZedToken read_at = 3;
208208
}
209209

210+
// ExpSchemaFilter is a filter that can be applied to the schema on reflection.
210211
message ExpSchemaFilter {
211-
enum KindFilter {
212-
KIND_FILTER_UNSPECIFIED = 0;
213-
KIND_FILTER_DEFINITION = 1;
214-
KIND_FILTER_CAVEAT = 2;
215-
KIND_FILTER_RELATION = 3;
216-
KIND_FILTER_PERMISSION = 4;
217-
}
218-
219-
// optional_definition_name_match is a regex that is matched against the definition or caveat name.
220-
// If not specified, will be ignored.
212+
// optional_definition_name_match is a regex that is matched against the definition name.
221213
string optional_definition_name_match = 1;
222214

223-
// optional_relation_or_permission_name_match is a regex that is matched against the relation or permission name.
224-
// If not specified, will be ignored.
225-
string optional_relation_or_permission_name_match = 2;
215+
// optional_caveat_name_match is a regex that is matched against the caveat name.
216+
string optional_caveat_name_match = 2;
217+
218+
// optional_relation_name_match is a regex that is matched against the relation name.
219+
string optional_relation_name_match = 3;
226220

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

225+
// ExpDefinition is the representation of a definition in the schema.
232226
message ExpDefinition {
233227
string name = 1;
228+
229+
// comment is a human-readable comments on the definition. Will include
230+
// delimiter characters.
234231
string comment = 2;
235232

236233
repeated ExpRelation relations = 3;
237234
repeated ExpPermission permissions = 4;
238235
}
239236

237+
// ExpCaveat is the representation of a caveat in the schema.
240238
message ExpCaveat {
241239
string name = 1;
240+
241+
// comment is a human-readable comments on the caveat. Will include
242+
// delimiter characters.
242243
string comment = 2;
243244

244245
repeated ExpCaveatParameter parameters = 3;
245246
string expression = 4;
246247
}
247248

249+
// ExpCaveatParameter is the representation of a parameter in a caveat.
248250
message ExpCaveatParameter {
249251
string name = 1;
252+
253+
// type is the type of the parameter. Will be a string representing the
254+
// type, e.g. `int` or `list<string>`
250255
string type = 2;
251256
string parent_caveat_name = 3;
252257
}
253258

259+
// ExpRelation is the representation of a relation in the schema.
254260
message ExpRelation {
255261
string name = 1;
256262
string comment = 2;
257263
string parent_definition_name = 3;
258264
repeated ExpTypeReference subject_types = 4;
259265
}
260266

267+
// ExpTypeReference is the representation of a type reference in the schema.
261268
message ExpTypeReference {
262269
// subject_definition_name is the name of the subject's definition.
263270
string subject_definition_name = 1;
@@ -277,8 +284,12 @@ message ExpTypeReference {
277284
}
278285
}
279286

287+
// ExpPermission is the representation of a permission in the schema.
280288
message ExpPermission {
281289
string name = 1;
290+
291+
// comment is a human-readable comments on the permission. Will include
292+
// delimiter characters.
282293
string comment = 2;
283294
string parent_definition_name = 3;
284295
}
@@ -293,14 +304,16 @@ message ExperimentalComputablePermissionsRequest {
293304
string optional_definition_name_match = 3;
294305
}
295306

307+
// ExpRelationReference is a reference to a relation in the schema.
296308
message ExpRelationReference {
297309
string definition_name = 1;
298310
string relation_name = 2;
299311
}
300312

313+
// ExpPermissionReference is a reference to a permission in the schema.
301314
message ExpPermissionReference {
302315
string definition_name = 1;
303-
string relation_name = 2;
316+
string permission_name = 2;
304317
}
305318

306319
message ExperimentalComputablePermissionsResponse {
@@ -344,6 +357,7 @@ message ExpCaveatParameterTypeChange {
344357
string previous_type = 2;
345358
}
346359

360+
// ExpSchemaDiff is the representation of a diff between two schemas.
347361
message ExpSchemaDiff {
348362
oneof diff {
349363
ExpDefinition definition_added = 1;

0 commit comments

Comments
 (0)