KEYCLOAK-2767: Should return a primitive if possible.

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.
This commit is contained in:
Guus der Kinderen 2016-04-07 13:19:29 +02:00
parent 6dc1194247
commit be578684b9
No known key found for this signature in database
GPG key ID: C96AB56D670B5AE0
3 changed files with 4 additions and 5 deletions

View file

@ -29,7 +29,6 @@ import javax.ws.rs.QueryParam;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
import java.util.List;
import java.util.Map;
public interface UsersResource {
@ -55,7 +54,7 @@ public interface UsersResource {
@Path("count")
@GET
@Produces(MediaType.APPLICATION_JSON)
Map<String, Integer> count();
Integer count();
@Path("{id}")
UserResource get(@PathParam("id") String id);

View file

@ -685,10 +685,10 @@ public class UsersResource {
@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")

View file

@ -235,7 +235,7 @@ public class UserTest extends AbstractClientTest {
public void count() {
createUsers();
Integer count = realm.users().count().get("count");
Integer count = realm.users().count();
assertEquals(9, count.intValue());
}