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

docs:replace readable names with uuid #433

Merged
merged 1 commit into from
Nov 5, 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
2 changes: 1 addition & 1 deletion config/clients/dotnet/CHANGELOG.md.mustache
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ Updated to include support for [OpenFGA 0.3.0](https://github.com/openfga/openfg

Changes:
- [BREAKING] feat(list-objects)!: response has been changed to include the object type
e.g. response that was `{"object_ids":["roadmap"]}`, will now be `{"objects":["document:roadmap"]}`
e.g. response that was `{"object_ids":["roadmap"]}`, will now be `{"objects":["document:0192ab2a-d83f-756d-9397-c5ed9f3cb69a"]}`

Fixes:
- fix(models): update interfaces that had incorrectly optional fields to make them required
Expand Down
78 changes: 39 additions & 39 deletions config/clients/dotnet/template/OpenFgaClientTests.mustache
Original file line number Diff line number Diff line change
Expand Up @@ -604,7 +604,7 @@ public class {{appShortName}}ClientTests {
new(new TupleKey {
User = "user:81684243-9356-4421-8fbf-a4f8d36aa31b",
Relation = "viewer",
Object = "document:roadmap"
Object = "document:0192ab2a-d83f-756d-9397-c5ed9f3cb69a"
},
TupleOperation.WRITE, DateTime.Now),
},
Expand Down Expand Up @@ -662,7 +662,7 @@ public class {{appShortName}}ClientTests {
new(new TupleKey {
User = "user:81684243-9356-4421-8fbf-a4f8d36aa31b",
Relation = "viewer",
Object = "document:roadmap"
Object = "document:0192ab2a-d83f-756d-9397-c5ed9f3cb69a"
},
DateTime.Now)
}
Expand All @@ -686,7 +686,7 @@ public class {{appShortName}}ClientTests {
var body = new ClientReadRequest() {
User = "user:81684243-9356-4421-8fbf-a4f8d36aa31b",
Relation = "viewer",
Object = "document:roadmap",
Object = "document:0192ab2a-d83f-756d-9397-c5ed9f3cb69a",
};
var options = new ClientReadOptions { };
var response = await fgaClient.Read(body, options);
Expand Down Expand Up @@ -717,7 +717,7 @@ public class {{appShortName}}ClientTests {
new(new TupleKey {
User = "user:81684243-9356-4421-8fbf-a4f8d36aa31b",
Relation = "viewer",
Object = "document:roadmap"
Object = "document:0192ab2a-d83f-756d-9397-c5ed9f3cb69a"
},
DateTime.Now)
}
Expand Down Expand Up @@ -783,7 +783,7 @@ public class {{appShortName}}ClientTests {
new() {
User = "user:81684243-9356-4421-8fbf-a4f8d36aa31b",
Relation = "viewer",
Object = "document:roadmap",
Object = "document:0192ab2a-d83f-756d-9397-c5ed9f3cb69a",
}
},
Deletes = new List<ClientTupleKeyWithoutCondition>(), // should not get passed
Expand Down Expand Up @@ -828,7 +828,7 @@ public class {{appShortName}}ClientTests {
new() {
User = "user:81684243-9356-4421-8fbf-a4f8d36aa31b",
Relation = "viewer",
Object = "document:roadmap",
Object = "document:0192ab2a-d83f-756d-9397-c5ed9f3cb69a",
}
},
};
Expand Down Expand Up @@ -872,14 +872,14 @@ public class {{appShortName}}ClientTests {
new() {
User = "user:81684243-9356-4421-8fbf-a4f8d36aa31b",
Relation = "viewer",
Object = "document:roadmap",
Object = "document:0192ab2a-d83f-756d-9397-c5ed9f3cb69a",
},
},
Deletes = new List<ClientTupleKeyWithoutCondition> {
new() {
User = "user:81684243-9356-4421-8fbf-a4f8d36aa31b",
Relation = "writer",
Object = "document:roadmap",
Object = "document:0192ab2a-d83f-756d-9397-c5ed9f3cb69a",
}
},
};
Expand Down Expand Up @@ -932,7 +932,7 @@ public class {{appShortName}}ClientTests {
new() {
User = "user:81684243-9356-4421-8fbf-a4f8d36aa31b",
Relation = "viewer",
Object = "document:roadmap",
Object = "document:0192ab2a-d83f-756d-9397-c5ed9f3cb69a",
},
new() {
User = "user:81684243-9356-4421-8fbf-a4f8d36aa31b",
Expand All @@ -944,7 +944,7 @@ public class {{appShortName}}ClientTests {
new() {
User = "user:81684243-9356-4421-8fbf-a4f8d36aa31b",
Relation = "writer",
Object = "document:roadmap",
Object = "document:0192ab2a-d83f-756d-9397-c5ed9f3cb69a",
}
},
};
Expand Down Expand Up @@ -997,12 +997,12 @@ public class {{appShortName}}ClientTests {
var body = new ClientCheckRequest {
User = "user:81684243-9356-4421-8fbf-a4f8d36aa31b",
Relation = "viewer",
Object = "document:roadmap",
Object = "document:0192ab2a-d83f-756d-9397-c5ed9f3cb69a",
ContextualTuples = new List<ClientTupleKey>() {
new() {
User = "user:81684243-9356-4421-8fbf-a4f8d36aa31b",
Relation = "editor",
Object = "document:roadmap",
Object = "document:0192ab2a-d83f-756d-9397-c5ed9f3cb69a",
Condition = new RelationshipCondition() {
Name = "ViewCountLessThan200",
Context = new { Name = "Roadmap", Type = "document" }
Expand Down Expand Up @@ -1053,12 +1053,12 @@ public class {{appShortName}}ClientTests {
var body = new ClientCheckRequest {
User = "user:81684243-9356-4421-8fbf-a4f8d36aa31b",
Relation = "viewer",
Object = "document:roadmap",
Object = "document:0192ab2a-d83f-756d-9397-c5ed9f3cb69a",
ContextualTuples = new List<ClientTupleKey>() {
new() {
User = "user:81684243-9356-4421-8fbf-a4f8d36aa31b",
Relation = "editor",
Object = "document:roadmap",
Object = "document:0192ab2a-d83f-756d-9397-c5ed9f3cb69a",
Condition = new RelationshipCondition() {
Name = "ViewCountLessThan200",
Context = new { Name = "Roadmap", Type = "document" }
Expand Down Expand Up @@ -1135,36 +1135,36 @@ public class {{appShortName}}ClientTests {
new() {
User = "user:81684243-9356-4421-8fbf-a4f8d36aa31b",
Relation = "viewer",
Object = "document:roadmap",
Object = "document:0192ab2a-d83f-756d-9397-c5ed9f3cb69a",
ContextualTuples = new List<ClientTupleKey>() {
new() {
User = "user:81684243-9356-4421-8fbf-a4f8d36aa31b",
Relation = "editor",
Object = "document:roadmap",
Object = "document:0192ab2a-d83f-756d-9397-c5ed9f3cb69a",
}
},
},
new() {
User = "user:81684243-9356-4421-8fbf-a4f8d36aa31b",
Relation = "admin",
Object = "document:roadmap",
Object = "document:0192ab2a-d83f-756d-9397-c5ed9f3cb69a",
ContextualTuples = new List<ClientTupleKey>() {
new() {
User = "user:81684243-9356-4421-8fbf-a4f8d36aa31b",
Relation = "editor",
Object = "document:roadmap",
Object = "document:0192ab2a-d83f-756d-9397-c5ed9f3cb69a",
}
},
},
new() {
User = "user:81684243-9356-4421-8fbf-a4f8d36aa31b",
Relation = "creator",
Object = "document:roadmap",
Object = "document:0192ab2a-d83f-756d-9397-c5ed9f3cb69a",
},
new() {
User = "user:81684243-9356-4421-8fbf-a4f8d36aa31b",
Relation = "deleter",
Object = "document:roadmap",
Object = "document:0192ab2a-d83f-756d-9397-c5ed9f3cb69a",
}
};
var options = new ClientBatchCheckOptions {
Expand Down Expand Up @@ -1200,7 +1200,7 @@ public class {{appShortName}}ClientTests {
var mockHandler = new Mock<HttpMessageHandler>(MockBehavior.Strict);

var jsonResponse =
"{\"tree\":{\"root\":{\"name\":\"document:roadmap#owner\", \"union\":{\"nodes\":[{\"name\":\"document:roadmap#owner\", \"leaf\":{\"users\":{\"users\":[\"team:product#member\"]}}}, {\"name\":\"document:roadmap#owner\", \"leaf\":{\"tupleToUserset\":{\"tupleset\":\"document:roadmap#owner\", \"computed\":[{\"userset\":\"org:contoso#admin\"}]}}}]}}}}";
"{\"tree\":{\"root\":{\"name\":\"document:0192ab2a-d83f-756d-9397-c5ed9f3cb69a#owner\", \"union\":{\"nodes\":[{\"name\":\"document:0192ab2a-d83f-756d-9397-c5ed9f3cb69a#owner\", \"leaf\":{\"users\":{\"users\":[\"team:product#member\"]}}}, {\"name\":\"document:0192ab2a-d83f-756d-9397-c5ed9f3cb69a#owner\", \"leaf\":{\"tupleToUserset\":{\"tupleset\":\"document:0192ab2a-d83f-756d-9397-c5ed9f3cb69a#owner\", \"computed\":[{\"userset\":\"org:contoso#admin\"}]}}}]}}}}";
mockHandler.Protected()
.Setup<Task<HttpResponseMessage>>(
"SendAsync",
Expand All @@ -1220,7 +1220,7 @@ public class {{appShortName}}ClientTests {

var body = new ClientExpandRequest {
Relation = "viewer",
Object = "document:roadmap",
Object = "document:0192ab2a-d83f-756d-9397-c5ed9f3cb69a",
};
var response = await fgaClient.Expand(body, new ClientExpandOptions() {
AuthorizationModelId = "01GXSA8YR785C4FYS3C0RTG7B1",
Expand Down Expand Up @@ -1250,29 +1250,29 @@ public class {{appShortName}}ClientTests {
var mockHandler = new Mock<HttpMessageHandler>(MockBehavior.Strict);
var mockResponse = new ExpandResponse(
tree: new UsersetTree(
root: new Node(name: "document:roadmap1#owner",
root: new Node(name: "document:0192ab2a-d83f-756d-9397-c5ed9f3cb69a1#owner",
union: new Nodes(
nodes: new List<Node>() {
new Node(name: "document:roadmap2#owner",
new Node(name: "document:0192ab2a-d83f-756d-9397-c5ed9f3cb69a2#owner",
leaf: new Leaf(users: new Users(users: new List<string>() {"team:product#member"}))),
new Node(name: "document:roadmap3#owner",
new Node(name: "document:0192ab2a-d83f-756d-9397-c5ed9f3cb69a3#owner",
leaf: new Leaf(tupleToUserset: new UsersetTreeTupleToUserset(
tupleset: "document:roadmap#owner",
tupleset: "document:0192ab2a-d83f-756d-9397-c5ed9f3cb69a#owner",
computed: new List<Computed>() {new Computed(userset: "org:contoso#admin")}))),
}),
difference: new UsersetTreeDifference(
_base: new Node(name: "document:roadmap3#owner",
_base: new Node(name: "document:0192ab2a-d83f-756d-9397-c5ed9f3cb69a3#owner",
leaf: new Leaf(users: new Users(users: new List<string>() {"team:product#member"}))),
subtract: new Node(name: "document:roadmap4#owner",
subtract: new Node(name: "document:0192ab2a-d83f-756d-9397-c5ed9f3cb69a4#owner",
leaf: new Leaf(users: new Users(users: new List<string>() {"team:product#member"})))
),
intersection: new Nodes(
nodes: new List<Node>() {
new Node(name: "document:roadmap5#owner",
new Node(name: "document:0192ab2a-d83f-756d-9397-c5ed9f3cb69a5#owner",
leaf: new Leaf(users: new Users(users: new List<string>() {"team:product#commentor"}))),
new Node(name: "document:roadmap6#owner",
new Node(name: "document:0192ab2a-d83f-756d-9397-c5ed9f3cb69a6#owner",
leaf: new Leaf(tupleToUserset: new UsersetTreeTupleToUserset(
tupleset: "document:roadmap#viewer",
tupleset: "document:0192ab2a-d83f-756d-9397-c5ed9f3cb69a#viewer",
computed: new List<Computed>() {new Computed(userset: "org:contoso#owner")}))),
}))
));
Expand All @@ -1294,7 +1294,7 @@ public class {{appShortName}}ClientTests {

var body = new ClientExpandRequest {
Relation = "viewer",
Object = "document:roadmap",
Object = "document:0192ab2a-d83f-756d-9397-c5ed9f3cb69a",
};
var response = await fgaClient.Expand(body, new ClientExpandOptions {
AuthorizationModelId = "01GXSA8YR785C4FYS3C0RTG7B1",
Expand All @@ -1319,7 +1319,7 @@ public class {{appShortName}}ClientTests {
[Fact]
public async Task ListObjectsTest() {
var mockHandler = new Mock<HttpMessageHandler>(MockBehavior.Strict);
var expectedResponse = new ListObjectsResponse {Objects = new List<string> {"document:roadmap"}};
var expectedResponse = new ListObjectsResponse {Objects = new List<string> {"document:0192ab2a-d83f-756d-9397-c5ed9f3cb69a"}};
mockHandler.Protected()
.Setup<Task<HttpResponseMessage>>(
"SendAsync",
Expand Down Expand Up @@ -1349,7 +1349,7 @@ public class {{appShortName}}ClientTests {
new() {
User = "folder:product",
Relation = "parent",
Object = "document:roadmap",
Object = "document:0192ab2a-d83f-756d-9397-c5ed9f3cb69a",
},
},
};
Expand Down Expand Up @@ -1411,13 +1411,13 @@ public class {{appShortName}}ClientTests {
var body =
new ClientListRelationsRequest() {
User = "user:81684243-9356-4421-8fbf-a4f8d36aa31b",
Object = "document:roadmap",
Object = "document:0192ab2a-d83f-756d-9397-c5ed9f3cb69a",
Relations = new List<string> {"can_view", "can_edit", "can_delete", "can_rename"},
ContextualTuples = new List<ClientTupleKey>() {
new() {
User = "user:81684243-9356-4421-8fbf-a4f8d36aa31b",
Relation = "editor",
Object = "document:roadmap",
Object = "document:0192ab2a-d83f-756d-9397-c5ed9f3cb69a",
}
}
};
Expand Down Expand Up @@ -1465,7 +1465,7 @@ public class {{appShortName}}ClientTests {
var body =
new ClientListRelationsRequest() {
User = "user:81684243-9356-4421-8fbf-a4f8d36aa31b",
Object = "document:roadmap",
Object = "document:0192ab2a-d83f-756d-9397-c5ed9f3cb69a",
Relations = new List<string> {},
};

Expand Down Expand Up @@ -1553,7 +1553,7 @@ public class {{appShortName}}ClientTests {
new() {
User = "folder:product",
Relation = "parent",
Object = "document:roadmap",
Object = "document:0192ab2a-d83f-756d-9397-c5ed9f3cb69a",
},
},
Context = new { ViewCount = 100 }
Expand Down Expand Up @@ -1650,7 +1650,7 @@ public class {{appShortName}}ClientTests {
var body = new List<ClientAssertion>() {new ClientAssertion() {
User = "user:81684243-9356-4421-8fbf-a4f8d36aa31b",
Relation = "viewer",
Object = "document:roadmap",
Object = "document:0192ab2a-d83f-756d-9397-c5ed9f3cb69a",
Expectation = true,
}};

Expand Down
Loading
Loading