Skip to content

Commit

Permalink
KEYCLOAK-2767: Should return a primitive if possible.
Browse files Browse the repository at this point in the history
A JSON primitive is valid JSON. There is no need to construct a JSON object
just for the sake of being JSON complient. This keeps things nice and simple.
  • Loading branch information
guusdk committed Apr 7, 2016
1 parent 6dc1194 commit be57868
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 5 deletions.
Expand Up @@ -29,7 +29,6 @@
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
import java.util.List;
import java.util.Map;

public interface UsersResource {

Expand All @@ -55,7 +54,7 @@ List<UserRepresentation> search(@QueryParam("search") String search,
@Path("count")
@GET
@Produces(MediaType.APPLICATION_JSON)
Map<String, Integer> count();
Integer count();

@Path("{id}")
UserResource get(@PathParam("id") String id);
Expand Down
Expand Up @@ -685,10 +685,10 @@ public List<UserRepresentation> getUsers(@QueryParam("search") String search,
@GET
@NoCache
@Produces(MediaType.APPLICATION_JSON)
public Map<String, Integer> getUsersCount() {
public Integer getUsersCount() {
auth.requireView();

return Collections.singletonMap("count", session.users().getUsersCount(realm));
return session.users().getUsersCount(realm);
}

@Path("{id}/role-mappings")
Expand Down
Expand Up @@ -235,7 +235,7 @@ public void search() {
public void count() {
createUsers();

Integer count = realm.users().count().get("count");
Integer count = realm.users().count();
assertEquals(9, count.intValue());
}

Expand Down

0 comments on commit be57868

Please sign in to comment.