Fix Map Lookup Introspection Endpoints and update doc for Globally Cached 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 <ashwin.tumma@salesforce.com>
This commit is contained in:
Ashwin Tumma 2024-10-30 08:23:22 -07:00 committed by GitHub
parent 21e7e5cddd
commit d5bb7de5cf
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 5 additions and 5 deletions

View File

@ -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.

View File

@ -145,7 +145,7 @@ public class MapLookupExtractorFactory implements LookupExtractorFactory
@Produces(MediaType.APPLICATION_JSON)
public Response getKeys()
{
return Response.ok(map.keySet().toString()).build();
return Response.ok(map.keySet()).build();
}
@GET
@ -153,7 +153,7 @@ public class MapLookupExtractorFactory implements LookupExtractorFactory
@Produces(MediaType.APPLICATION_JSON)
public Response getValues()
{
return Response.ok(map.values().toString()).build();
return Response.ok(map.values()).build();
}
@GET

View File

@ -152,7 +152,7 @@ public class LookupIntrospectionResourceTest
.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());
}
@ -166,7 +166,7 @@ public class LookupIntrospectionResourceTest
.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());
}