Skip to content

Commit

Permalink
Fix Map Lookup Introspection Endpoints and update doc for Globally Ca…
Browse files Browse the repository at this point in the history
…ched Lookups (#17436)

Map Lookup Introspection API endpoints /keys and /values no longer return an invalid JSON object.
Also, update documentation to clarify the version returned by the /version introspection endpoint.

---------

Co-authored-by: Ashwin Tumma <[email protected]>
  • Loading branch information
ashwintumma23 and Ashwin Tumma authored Oct 30, 2024
1 parent 21e7e5c commit d5bb7de
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion docs/querying/lookups-cached-global.md
Original file line number Diff line number Diff line change
Expand Up @@ -384,4 +384,4 @@ The JDBC lookups will poll a database to populate its local cache. If the `tsCol

## Introspection

Globally cached lookups have introspection points at `/keys` and `/values` which return a complete set of the keys and values (respectively) in the lookup. Introspection to `/` returns the entire map. Introspection to `/version` returns the version indicator for the lookup.
Globally cached lookups have introspection points at `/keys` and `/values`, which return the complete set of keys and values respectively in the lookup as a JSON object. Introspection to `/` returns the entire map as a JSON object. Introspection to `/version` provides the internal version indicating when the lookup cache was last updated. See [Introspect A Lookup](./lookups.md#Introspect a Lookup) for examples.
Original file line number Diff line number Diff line change
Expand Up @@ -145,15 +145,15 @@ public MapLookupIntrospectionHandler(Map<String, String> map)
@Produces(MediaType.APPLICATION_JSON)
public Response getKeys()
{
return Response.ok(map.keySet().toString()).build();
return Response.ok(map.keySet()).build();
}

@GET
@Path("/values")
@Produces(MediaType.APPLICATION_JSON)
public Response getValues()
{
return Response.ok(map.values().toString()).build();
return Response.ok(map.values()).build();
}

@GET
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ public void testGetKey()
.accept(MediaType.APPLICATION_JSON)
.get(ClientResponse.class);
String s = resp.getEntity(String.class);
Assert.assertEquals("[key, key2]", s);
Assert.assertEquals("[\"key\",\"key2\"]", s);
Assert.assertEquals(200, resp.getStatus());
}

Expand All @@ -166,7 +166,7 @@ public void testGetValue()
.accept(MediaType.APPLICATION_JSON)
.get(ClientResponse.class);
String s = resp.getEntity(String.class);
Assert.assertEquals("[value, value2]", s);
Assert.assertEquals("[\"value\",\"value2\"]", s);
Assert.assertEquals(200, resp.getStatus());
}

Expand Down

0 comments on commit d5bb7de

Please sign in to comment.