Skip to content
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 Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Main config
OPENFGA_DOCKER_TAG = v1.5.3
OPEN_API_REF ?= 2b164f5813a735bf0bb76fb39bd35b3bb29196ed
OPEN_API_REF ?= f33cb24bcd9707c5fba8cbbc4a4441ab24a3442d
OPEN_API_URL = https://raw.githubusercontent.com/openfga/api/${OPEN_API_REF}/docs/openapiv2/apidocs.swagger.json
OPENAPI_GENERATOR_CLI_DOCKER_TAG = v6.4.0
NODE_DOCKER_TAG = 20-alpine
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1440,7 +1440,6 @@ public class {{appShortName}}ClientTests {
}

},
ExcludedUsers = new List<ObjectOrUserset>()
};
mockHandler.Protected()
.Setup<Task<HttpResponseMessage>>(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -544,7 +544,6 @@ const response = await fgaClient.listUsers({
}, options);

// response.users = [{object: {type: "user", id: "81684243-9356-4421-8fbf-a4f8d36aa31b"}}, {userset: { type: "user" }}, ...]
// response.excluded_users = [ {object: {type: "user", id: "4a455e27-d15a-4434-82e0-136f9c2aa4cf"}}, ... ]
```

#### Assertions
Expand Down
1 change: 0 additions & 1 deletion config/clients/dotnet/template/api_test.mustache
Original file line number Diff line number Diff line change
Expand Up @@ -1484,7 +1484,6 @@ namespace {{testPackageName}}.Api {
}

},
ExcludedUsers = new List<ObjectOrUserset>()
};
mockHandler.Protected()
.Setup<Task<HttpResponseMessage>>(
Expand Down
3 changes: 1 addition & 2 deletions config/clients/go/template/README_calling_api.mustache
Original file line number Diff line number Diff line change
Expand Up @@ -597,7 +597,7 @@ userFilters := []openfga.UserTypeFilter{{ Type: "user" }}
// userFilters := []openfga.UserTypeFilter{{ Type: "team", Relation: openfga.PtrString("member") }}

requestBody := ClientListUsersRequest{
Object: openfga.Object{
Object: openfga.FgaObject{
Type: "document",
Id: "roadmap",
},
Expand All @@ -621,7 +621,6 @@ data, err := fgaClient.ListRelations(context.Background()).
Execute()

// response.users = [{object: {type: "user", id: "81684243-9356-4421-8fbf-a4f8d36aa31b"}}, {userset: { type: "user" }}, ...]
// response.excluded_users = [ {object: {type: "user", id: "4a455e27-d15a-4434-82e0-136f9c2aa4cf"}}, ... ]
```

### Assertions
Expand Down
6 changes: 1 addition & 5 deletions config/clients/go/template/api_test.mustache
Original file line number Diff line number Diff line change
Expand Up @@ -882,7 +882,7 @@ func Test{{appShortName}}Api(t *testing.T) {
test := TestDefinition{
Name: "ListUsers",
// A real API would not return all these for the filter provided, these are just for test purposes
JsonResponse: `{"excluded_users":null,"users":[{"object":{"id":"81684243-9356-4421-8fbf-a4f8d36aa31b","type":"user"}},{"userset":{"id":"fga","relation":"member","type":"team"}},{"wildcard":{"type":"user"}}]}`,
JsonResponse: `{"users":[{"object":{"id":"81684243-9356-4421-8fbf-a4f8d36aa31b","type":"user"}},{"userset":{"id":"fga","relation":"member","type":"team"}},{"wildcard":{"type":"user"}}]}`,
ResponseStatus: http.StatusOK,
Method: http.MethodPost,
RequestPath: "list-users",
Expand Down Expand Up @@ -963,10 +963,6 @@ func Test{{appShortName}}Api(t *testing.T) {
if got.Users[2].GetWildcard().Type != expectedResponse.Users[2].GetWildcard().Type {
t.Fatalf("{{appShortName}}%v().Execute() = %v, want %v (%v)", test.Name, got.Users[2], expectedResponse.Users[2], "wildcard: { type: \"user\" }")
}

if len(got.ExcludedUsers) != len(expectedResponse.ExcludedUsers) {
t.Fatalf("{{appShortName}}%v().Execute() = %v, want %v", test.Name, got.GetExcludedUsers(), expectedResponse.GetExcludedUsers())
}
})

t.Run("Check with 400 error", func(t *testing.T) {
Expand Down
6 changes: 1 addition & 5 deletions config/clients/go/template/client/client_test.mustache
Original file line number Diff line number Diff line change
Expand Up @@ -2431,7 +2431,7 @@ func Test{{appShortName}}Client(t *testing.T) {
test := TestDefinition{
Name: "ListUsers",
// A real API would not return all these for the filter provided, these are just for test purposes
JsonResponse: `{"excluded_users":null,"users":[{"object":{"id":"81684243-9356-4421-8fbf-a4f8d36aa31b","type":"user"}},{"userset":{"id":"fga","relation":"member","type":"team"}},{"wildcard":{"type":"user"}}]}`,
JsonResponse: `{"users":[{"object":{"id":"81684243-9356-4421-8fbf-a4f8d36aa31b","type":"user"}},{"userset":{"id":"fga","relation":"member","type":"team"}},{"wildcard":{"type":"user"}}]}`,
ResponseStatus: http.StatusOK,
Method: http.MethodPost,
RequestPath: "list-users",
Expand Down Expand Up @@ -2510,10 +2510,6 @@ func Test{{appShortName}}Client(t *testing.T) {
t.Fatalf("{{appShortName}}%v().Execute() = %v, want %v (%v)", test.Name, got.Users[2], expectedResponse.Users[2], "wildcard: { type: \"user\" }")
}

if len(got.ExcludedUsers) != len(expectedResponse.ExcludedUsers) {
t.Fatalf("{{appShortName}}%v().Execute() = %v, want %v", test.Name, got.GetExcludedUsers(), expectedResponse.GetExcludedUsers())
}

// ListUsers without options should work
_, err = fgaClient.ListUsers(context.Background()).Body(requestBody).Execute()
if err != nil {
Expand Down
1 change: 0 additions & 1 deletion config/clients/java/template/README_calling_api.mustache
Original file line number Diff line number Diff line change
Expand Up @@ -564,7 +564,6 @@ var options = new ClientListUsersOptions()
var response = fgaClient.listUsers(request, options).get();

// response.getUsers() = [{object: {type: "user", id: "81684243-9356-4421-8fbf-a4f8d36aa31b"}}, {userset: { type: "user" }}, ...]
// response.getExcludedUsers = [ {object: {type: "user", id: "4a455e27-d15a-4434-82e0-136f9c2aa4cf"}}, ... ]
```

#### Assertions
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@ public class ClientListUsersResponse extends ListUsersResponse {
this.rawResponse = apiResponse.getRawResponse();
ListUsersResponse response = apiResponse.getData();
this.setUsers(response.getUsers());
this.setExcludedUsers(response.getExcludedUsers());

}

public int getStatusCode() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2330,7 +2330,7 @@ public class OpenFgaClientTest {
.withBody(is(expectedBody))
.doReturn(
200,
"{\"excluded_users\":null,\"users\":[{\"object\":{\"id\":\"81684243-9356-4421-8fbf-a4f8d36aa31b\",\"type\":\"user\"}},{\"userset\":{\"id\":\"fga\",\"relation\":\"member\",\"type\":\"team\"}},{\"wildcard\":{\"type\":\"user\"}}]}");
"{\"users\":[{\"object\":{\"id\":\"81684243-9356-4421-8fbf-a4f8d36aa31b\",\"type\":\"user\"}},{\"userset\":{\"id\":\"fga\",\"relation\":\"member\",\"type\":\"team\"}},{\"wildcard\":{\"type\":\"user\"}}]}");

ClientListUsersRequest request = new ClientListUsersRequest()
._object(new FgaObject().type(DEFAULT_TYPE).id(DEFAULT_ID))
Expand All @@ -2356,8 +2356,6 @@ public class OpenFgaClientTest {
new UsersetUser().type("team").id("fga").relation("member")),
new User().wildcard(new TypedWildcard().type("user"))),
response.getUsers());

assertNull(response.getExcludedUsers());
}

/**
Expand Down
1 change: 0 additions & 1 deletion config/clients/js/template/README_calling_api.mustache
Original file line number Diff line number Diff line change
Expand Up @@ -462,7 +462,6 @@ const response = await fgaClient.listUsers({
}, options);

// response.users = [{object: {type: "user", id: "81684243-9356-4421-8fbf-a4f8d36aa31b"}}, {userset: { type: "user" }}, ...]
// response.excluded_users = [ {object: {type: "user", id: "4a455e27-d15a-4434-82e0-136f9c2aa4cf"}}, ... ]
```

#### Assertions
Expand Down
29 changes: 2 additions & 27 deletions config/clients/js/template/tests/client.test.ts.mustache
Original file line number Diff line number Diff line change
Expand Up @@ -769,19 +769,8 @@ describe("{{appTitleCaseName}} Client", () => {
wildcard: {
type: "employee"
}
}],
excluded_users: [{
object: {
type: "user",
id: "76cebb86-6569-4440-b653-db3525a85831"
},
}, {
userset: {
type: "team",
id: "marketing",
relation: "member"
},
}] };
}]
};
const scope = nocks.listUsers(baseConfig.storeId!, mockedResponse);

expect(scope.isDone()).toBe(false);
Expand Down Expand Up @@ -832,20 +821,6 @@ describe("{{appTitleCaseName}} Client", () => {
type: "employee"
}
});
expect(response.excluded_users).toHaveLength(mockedResponse.excluded_users.length);
expect(response.excluded_users[0]).toMatchObject({
object: {
type: "user",
id: "76cebb86-6569-4440-b653-db3525a85831"
},
});
expect(response.excluded_users[1]).toMatchObject({
userset: {
type: "team",
id: "marketing",
relation: "member"
},
});
expect(response).toEqual(mockedResponse);
});
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -721,7 +721,6 @@ async with OpenFgaClient(configuration) as api_client:
response = await api_client.list_users(request, options)

# response.users = [{object: {type: "user", id: "81684243-9356-4421-8fbf-a4f8d36aa31b"}}, {userset: { type: "user" }}, ...]
# response.excluded_users = [ {object: {type: "user", id: "4a455e27-d15a-4434-82e0-136f9c2aa4cf"}}, ... ]
```

#### Assertions
Expand Down
1 change: 0 additions & 1 deletion config/clients/python/template/api_test.mustache
Original file line number Diff line number Diff line change
Expand Up @@ -387,7 +387,6 @@ class {{#operations}}Test{{classname}}(IsolatedAsyncioTestCase):
"""

response_body = """{
"excluded_users": [],
"users": [
{
"object": {
Expand Down
1 change: 0 additions & 1 deletion config/clients/python/template/api_test_sync.mustache
Original file line number Diff line number Diff line change
Expand Up @@ -390,7 +390,6 @@ class TestOpenFgaApiSync(IsolatedAsyncioTestCase):
"""

response_body = """{
"excluded_users": [],
"users": [
{
"object": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2039,7 +2039,6 @@ class TestOpenFgaClient(IsolatedAsyncioTestCase):
"""

response_body = """{
"excluded_users": [],
"users": [
{
"object": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2039,7 +2039,6 @@ class TestOpenFgaClient(IsolatedAsyncioTestCase):
"""

response_body = """{
"excluded_users": [],
"users": [
{
"object": {
Expand Down