bszabo97 commented on code in PR #1682: URL: https://github.com/apache/solr/pull/1682#discussion_r1224103038
########## solr/core/src/java/org/apache/solr/handler/admin/api/GetSchemaFieldAPI.java: ########## @@ -0,0 +1,255 @@ +package org.apache.solr.handler.admin.api; + +import static org.apache.solr.client.solrj.impl.BinaryResponseParser.BINARY_CONTENT_TYPE_V2; + +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; +import java.util.Map; +import javax.inject.Inject; +import javax.ws.rs.GET; +import javax.ws.rs.Path; +import javax.ws.rs.PathParam; +import javax.ws.rs.Produces; +import javax.ws.rs.core.MediaType; +import org.apache.solr.common.MapWriter; +import org.apache.solr.common.SolrException; +import org.apache.solr.common.cloud.SolrClassLoader; +import org.apache.solr.common.params.SolrParams; +import org.apache.solr.common.util.NamedList; +import org.apache.solr.common.util.SimpleOrderedMap; +import org.apache.solr.core.PluginInfo; +import org.apache.solr.jersey.PermissionName; +import org.apache.solr.jersey.SolrJerseyResponse; +import org.apache.solr.pkg.PackageListeningClassLoader; +import org.apache.solr.schema.IndexSchema; +import org.apache.solr.security.PermissionNameProvider; + +public class GetSchemaFieldAPI extends GetSchemaAPI { + + private final SolrParams params; + + @Inject + public GetSchemaFieldAPI(IndexSchema indexSchema, SolrParams params) { + super(indexSchema); + this.params = params; + } + + @GET + @Path("/fields") + @Produces({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, BINARY_CONTENT_TYPE_V2}) + @PermissionName(PermissionNameProvider.Name.SCHEMA_READ_PERM) + public SchemaListFieldsResponse listSchemaFields() { + SchemaListFieldsResponse response = instantiateJerseyResponse(SchemaListFieldsResponse.class); + final String realName = "fields"; + + response.fields = listAllFieldsOfType(realName, params); + + return response; + } + + public static class SchemaListFieldsResponse extends SolrJerseyResponse { + @JsonProperty("fields") + public Object fields; Review Comment: To be honest I used the type `Object` since I have seen that the call `propertyValues.get()` returns an Object and did not really knew if there could be any possible scenarios where this is not a `List`... But the tests also suggest that this should always be an `ArrayList` so I will go ahead and change it everywhere -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: issues-unsubscr...@solr.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: issues-unsubscr...@solr.apache.org For additional commands, e-mail: issues-h...@solr.apache.org