Skip to content

Commit fc9c429

Browse files
authored
docs: enhance the API protobuf documentation (#33)
1 parent fc186e7 commit fc9c429

17 files changed

+313
-211
lines changed

api/openapiv2/authorizer/accesscontroller/v1alpha1/check_service.swagger.json

+25-14
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
"paths": {
1919
"/authorizer/access-controller/v1alpha1/check": {
2020
"get": {
21-
"summary": "Check performs an authorization check.",
21+
"summary": "Check performs an access-control check by looking up if a specific subject\nis related to an object.",
2222
"operationId": "CheckService_Check",
2323
"responses": {
2424
"200": {
@@ -37,35 +37,35 @@
3737
"parameters": [
3838
{
3939
"name": "namespace",
40-
"description": "The namespace to evaluate the check.\n\nNote: If you use the Expand API and the check\nevaluates a RelationTuple specifying a SubjectSet as\nsubject or due to a rewrite rule in a namespace config\nthis check request may involve other namespaces automatically.",
40+
"description": "The namespace to evaluate the check within.",
4141
"in": "query",
4242
"required": false,
4343
"type": "string"
4444
},
4545
{
4646
"name": "object",
47-
"description": "The related object in this check.",
47+
"description": "The object to check.",
4848
"in": "query",
4949
"required": false,
5050
"type": "string"
5151
},
5252
{
5353
"name": "relation",
54-
"description": "The relation between the Object and the Subject.",
54+
"description": "The relation between the object and the subject.",
5555
"in": "query",
5656
"required": false,
5757
"type": "string"
5858
},
5959
{
6060
"name": "subject.id",
61-
"description": "A concrete id of the subject.",
61+
"description": "A concrete subject id string for the subject.",
6262
"in": "query",
6363
"required": false,
6464
"type": "string"
6565
},
6666
{
6767
"name": "subject.set.namespace",
68-
"description": "The namespace of the object and relation\nreferenced in this subject set.",
68+
"description": "The namespace of the object and relation referenced in this SubjectSet.",
6969
"in": "query",
7070
"required": false,
7171
"type": "string"
@@ -79,7 +79,14 @@
7979
},
8080
{
8181
"name": "subject.set.relation",
82-
"description": "The relation to the object by the subjects.",
82+
"description": "The relation between the object and the subject(s).",
83+
"in": "query",
84+
"required": false,
85+
"type": "string"
86+
},
87+
{
88+
"name": "snaptoken",
89+
"description": "Optional. The snapshot token that encodes the evaluation timestamp that this request will be evaluated no earlier than.\n\nIf no snapshot token is provided the check request is evaluated against the most recently replicated version of the relation\ntuple storage. Leaving an empty snapshot token will reflect the latest changes, but it may incur a read penalty because the\nreads have to be directed toward the leaseholder of the replica that serves the data.\n\nWe call requests without a snapshot token a content-change check, because such requests require a round-trip read but return\nthe most recent writes and are thus good candidates for checking real-time content changes before an object is persisted.",
8390
"in": "query",
8491
"required": false,
8592
"type": "string"
@@ -127,7 +134,11 @@
127134
"properties": {
128135
"allowed": {
129136
"type": "boolean",
130-
"description": "Whether the specified subject is\nrelated to the requested object.\n\nIt is false by default if no ACL matches."
137+
"description": "A boolean indicating if the specified subject is related to the requested object.\n\nIt is false by default if no ACL matches."
138+
},
139+
"snaptoken": {
140+
"type": "string",
141+
"description": "A snapshot token encoding the snapshot evaluation timestamp that the request was evaluated at."
131142
}
132143
},
133144
"description": "The response for a CheckService.Check rpc."
@@ -137,32 +148,32 @@
137148
"properties": {
138149
"id": {
139150
"type": "string",
140-
"description": "A concrete id of the subject."
151+
"description": "A concrete subject id string for the subject."
141152
},
142153
"set": {
143154
"$ref": "#/definitions/v1alpha1SubjectSet",
144-
"description": "A subject set that expands to more Subjects\n(used for inheritance)."
155+
"description": "A SubjectSet that expands to more Subjects."
145156
}
146157
},
147-
"description": "Subject is either a concrete subject id or\na subject set expanding to more Subjects."
158+
"description": "Subject is either a concrete subject id string or\na SubjectSet expanding to more Subjects."
148159
},
149160
"v1alpha1SubjectSet": {
150161
"type": "object",
151162
"properties": {
152163
"namespace": {
153164
"type": "string",
154-
"description": "The namespace of the object and relation\nreferenced in this subject set."
165+
"description": "The namespace of the object and relation referenced in this SubjectSet."
155166
},
156167
"object": {
157168
"type": "string",
158169
"description": "The object selected by the subjects."
159170
},
160171
"relation": {
161172
"type": "string",
162-
"description": "The relation to the object by the subjects."
173+
"description": "The relation between the object and the subject(s)."
163174
}
164175
},
165-
"description": "SubjectSet refers to all subjects which have\nthe same `relation` to an `object`.\nIt is also used for inheritance."
176+
"description": "A SubjectSet refers to all subjects which have the same\nrelation to an object."
166177
}
167178
}
168179
}

api/openapiv2/authorizer/accesscontroller/v1alpha1/expand_service.swagger.json

+8-8
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@
5252
"properties": {
5353
"tree": {
5454
"$ref": "#/definitions/v1alpha1SubjectTree",
55-
"description": "The tree the requested subject set expands to.\nThe requested subject set is the subject of the root.\n\nThis field can be nil in some circumstances."
55+
"description": "The tree the requested SubjectSet expands to. The requested\nSubjectSet is the subject of the root.\n\nThis field can be nil in some circumstances."
5656
}
5757
},
5858
"description": "The response for an ExpandService.Expand rpc."
@@ -66,39 +66,39 @@
6666
"NODE_TYPE_LEAF"
6767
],
6868
"default": "NODE_TYPE_UNSPECIFIED",
69-
"description": " - NODE_TYPE_UNION: This node expands to a union of all children.\n - NODE_TYPE_INTERSECTION: This node expands to an intersection of the children.\n - NODE_TYPE_LEAF: This node is a leaf and contains no children.\nIts subject is a `SubjectID` unless `max_depth` was reached."
69+
"description": "An enumeration defining types of nodes within a SubjectTree.\n\n - NODE_TYPE_UNION: A node type which expands to a union of all children.\n - NODE_TYPE_INTERSECTION: A node type which expands to an intersection of the children.\n - NODE_TYPE_LEAF: A node type which is a leaf and contains no children.\n\nIts Subject is a subject id string unless the maximum call depth was reached."
7070
},
7171
"v1alpha1Subject": {
7272
"type": "object",
7373
"properties": {
7474
"id": {
7575
"type": "string",
76-
"description": "A concrete id of the subject."
76+
"description": "A concrete subject id string for the subject."
7777
},
7878
"set": {
7979
"$ref": "#/definitions/v1alpha1SubjectSet",
80-
"description": "A subject set that expands to more Subjects\n(used for inheritance)."
80+
"description": "A SubjectSet that expands to more Subjects."
8181
}
8282
},
83-
"description": "Subject is either a concrete subject id or\na subject set expanding to more Subjects."
83+
"description": "Subject is either a concrete subject id string or\na SubjectSet expanding to more Subjects."
8484
},
8585
"v1alpha1SubjectSet": {
8686
"type": "object",
8787
"properties": {
8888
"namespace": {
8989
"type": "string",
90-
"description": "The namespace of the object and relation\nreferenced in this subject set."
90+
"description": "The namespace of the object and relation referenced in this SubjectSet."
9191
},
9292
"object": {
9393
"type": "string",
9494
"description": "The object selected by the subjects."
9595
},
9696
"relation": {
9797
"type": "string",
98-
"description": "The relation to the object by the subjects."
98+
"description": "The relation between the object and the subject(s)."
9999
}
100100
},
101-
"description": "SubjectSet refers to all subjects which have\nthe same `relation` to an `object`.\nIt is also used for inheritance."
101+
"description": "A SubjectSet refers to all subjects which have the same\nrelation to an object."
102102
},
103103
"v1alpha1SubjectTree": {
104104
"type": "object",

api/openapiv2/authorizer/accesscontroller/v1alpha1/namespace_service.swagger.json

+37-19
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@
3737
"parameters": [
3838
{
3939
"name": "namespace",
40+
"description": "The namespace whose config should be read.",
4041
"in": "query",
4142
"required": false,
4243
"type": "string"
@@ -47,8 +48,8 @@
4748
]
4849
},
4950
"put": {
50-
"summary": "WriteConfig upserts a namespace configuration. If the namespace config already exists,\nthe existing one is overwritten.",
51-
"description": "If the new namespace config removes an existing relation, there must not be any relation\ntuples that reference it. Otherwise a FAILED_PRECONDITION status is returned. To migrate\naway from a relation, please move all existing relation tuples referencing it over to the\nnew relation and then delete the old relation once all tuples have been migrated.",
51+
"summary": "WriteConfig upserts a namespace configuration.",
52+
"description": "If the namespace config already exists, the existing one is overwritten. If the new\nnamespace config removes an existing relation, there must not be any relation tuples\nthat reference it. Otherwise a FAILED_PRECONDITION status is returned.\n\nTo migrate away from a relation, please move all existing relation tuples referencing\nit over to the new relation and then delete the old relation once all tuples have been\nmigrated.",
5253
"operationId": "NamespaceConfigService_WriteConfig",
5354
"responses": {
5455
"200": {
@@ -82,7 +83,8 @@
8283
},
8384
"definitions": {
8485
"ChildThis": {
85-
"type": "object"
86+
"type": "object",
87+
"description": "This references the defined relation directly."
8688
},
8789
"SetOperationChild": {
8890
"type": "object",
@@ -145,30 +147,36 @@
145147
"relation": {
146148
"type": "string"
147149
}
148-
}
150+
},
151+
"description": "Computes the set of subjects that have the included relation within the\nsame namespace.\n\nThis is useful to follow relations between an object and subject within\nthe same namespace. If you want anyone with an 'editor' relation to also\nhave 'viewer' this would be a good fit."
149152
},
150153
"v1alpha1NamespaceConfig": {
151154
"type": "object",
152155
"properties": {
153156
"name": {
154-
"type": "string"
157+
"type": "string",
158+
"description": "The name of the namespace."
155159
},
156160
"relations": {
157161
"type": "array",
158162
"items": {
159163
"$ref": "#/definitions/v1alpha1Relation"
160-
}
164+
},
165+
"description": "The relations that this namespace defines."
161166
}
162-
}
167+
},
168+
"description": "A namespace config defines the relations that exist between objects and subjects in\nin a namespace."
163169
},
164170
"v1alpha1ReadConfigResponse": {
165171
"type": "object",
166172
"properties": {
167173
"namespace": {
168-
"type": "string"
174+
"type": "string",
175+
"description": "The namespace of the config."
169176
},
170177
"config": {
171-
"$ref": "#/definitions/v1alpha1NamespaceConfig"
178+
"$ref": "#/definitions/v1alpha1NamespaceConfig",
179+
"description": "The namespace config for the given namespace."
172180
}
173181
},
174182
"description": "The response for a NamespaceConfigService.ReadConfig rpc."
@@ -177,23 +185,29 @@
177185
"type": "object",
178186
"properties": {
179187
"name": {
180-
"type": "string"
188+
"type": "string",
189+
"description": "The name of the relation (e.g. viewer, editor, or member)."
181190
},
182191
"rewrite": {
183-
"$ref": "#/definitions/v1alpha1Rewrite"
192+
"$ref": "#/definitions/v1alpha1Rewrite",
193+
"description": "The rewrite rule for this relation, or nil if it references itself."
184194
}
185-
}
195+
},
196+
"description": "A Relation defines a type of relationship between an object and subject.\n\nRelations can have rewrite rules that specify how the relation is\ncomputed relative to other relations defined within the same namespace\nor across other namespaces."
186197
},
187198
"v1alpha1Rewrite": {
188199
"type": "object",
189200
"properties": {
190201
"union": {
191-
"$ref": "#/definitions/v1alpha1SetOperation"
202+
"$ref": "#/definitions/v1alpha1SetOperation",
203+
"description": "Joins the children of the rewrite via set union."
192204
},
193205
"intersection": {
194-
"$ref": "#/definitions/v1alpha1SetOperation"
206+
"$ref": "#/definitions/v1alpha1SetOperation",
207+
"description": "Joins the children of the rewrite via set intersection."
195208
}
196-
}
209+
},
210+
"description": "Rewrites define sub-expressions that combine operations such as union or intersection. A rewrite\nsub-expression can be recursive and thus allows arbitrary logical expressions to be constructed."
197211
},
198212
"v1alpha1SetOperation": {
199213
"type": "object",
@@ -210,18 +224,22 @@
210224
"type": "object",
211225
"properties": {
212226
"tupleset": {
213-
"$ref": "#/definitions/TupleToSubjectsetTupleset"
227+
"$ref": "#/definitions/TupleToSubjectsetTupleset",
228+
"description": "A tupleset defining the relation tuples that relate to the set of subjects that\nthis TupleToSubjectset applies to."
214229
},
215230
"computedSubjectset": {
216-
"$ref": "#/definitions/v1alpha1ComputedSubjectset"
231+
"$ref": "#/definitions/v1alpha1ComputedSubjectset",
232+
"description": "The computed set of subjects that are looked up based on the expanded tupleset."
217233
}
218-
}
234+
},
235+
"description": "Computes a tupleset from the input object, fetches relation tuples matching the\ntupleset, and computes the set of subjects from every fetched relation tuple.\n\nThis is useful to lookup relations in other namespaces or to create complex hierarchies\nbetween objects in multiple namespaces."
219236
},
220237
"v1alpha1WriteConfigRequest": {
221238
"type": "object",
222239
"properties": {
223240
"config": {
224-
"$ref": "#/definitions/v1alpha1NamespaceConfig"
241+
"$ref": "#/definitions/v1alpha1NamespaceConfig",
242+
"description": "The namespace config to upsert."
225243
}
226244
},
227245
"description": "The request for a NamespaceConfigService.WriteConfig rpc."

0 commit comments

Comments
 (0)