gerlowskija commented on code in PR #1682:
URL: https://github.com/apache/solr/pull/1682#discussion_r1244150135
##########
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 {
Review Comment:
FYI @bszabo97
It looks like inheriting from GetSchemaAPI causes a minor warning when you
enable "strict validation" of Jersey resources. ("Strict validation" is
governed by a setting in JerseyApplications.java. It's disabled by default for
speed reasons, but it's useful to enable it from time to time in dev as a way
to lint the JAX-RS code a bit. This bug in particular was caught by @stillalex
- kudos to him!)
```
[[FATAL] A resource model has ambiguous (sub-)resource method for HTTP
method GET and input mime-types as defined by"@Consumes" and "@Produces"
annotations at Java methods public
org.apache.solr.handler.admin.api.GetSchemaAPI$SchemaInfoResponse
org.apache.solr.handler.admin.api.GetSchemaAPI.getSchemaInfo() and public
org.apache.solr.handler.admin.api.GetSchemaAPI$SchemaInfoResponse
org.apache.solr.handler.admin.api.GetSchemaAPI.getSchemaInfo() at matching
regular expression /(cores|collections)/([^/]+)/schema. These two methods
produces and consumes exactly the same mime-types and therefore their
invocation as a resource methods will always fail.;
source='org.glassfish.jersey.server.model.RuntimeResource@4272ba2e', [FATAL] A
resource model has ambiguous (sub-)resource method for HTTP method GET and
input mime-types as defined by"@Consumes" and "@Produces" annotations at Java
methods public
org.apache.solr.handler.admin.api.GetSchemaAPI$SchemaSimilarityResponse
org.apache.solr.hand
ler.admin.api.GetSchemaAPI.getSchemaSimilarity() and public
org.apache.solr.handler.admin.api.GetSchemaAPI$SchemaSimilarityResponse
org.apache.solr.handler.admin.api.GetSchemaAPI.getSchemaSimilarity() at
matching regular expression /similarity. These two methods produces and
consumes exactly the same mime-types and therefore their invocation as a
resource methods will always fail.;
source='org.glassfish.jersey.server.model.RuntimeResource@4651ba9d', [FATAL] A
resource model has ambiguous (sub-)resource method for HTTP method GET and
input mime-types as defined by"@Consumes" and "@Produces" annotations at Java
methods public
org.apache.solr.handler.admin.api.GetSchemaAPI$SchemaUniqueKeyResponse
org.apache.solr.handler.admin.api.GetSchemaAPI.getSchemaUniqueKey() and public
org.apache.solr.handler.admin.api.GetSchemaAPI$SchemaUniqueKeyResponse
org.apache.solr.handler.admin.api.GetSchemaAPI.getSchemaUniqueKey() at matching
regular expression /uniquekey. These two methods produces and co
nsumes exactly the same mime-types and therefore their invocation as a
resource methods will always fail.;
source='org.glassfish.jersey.server.model.RuntimeResource@10595d07', [FATAL] A
resource model has ambiguous (sub-)resource method for HTTP method GET and
input mime-types as defined by"@Consumes" and "@Produces" annotations at Java
methods public
org.apache.solr.handler.admin.api.GetSchemaAPI$SchemaVersionResponse
org.apache.solr.handler.admin.api.GetSchemaAPI.getSchemaVersion() and public
org.apache.solr.handler.admin.api.GetSchemaAPI$SchemaVersionResponse
org.apache.solr.handler.admin.api.GetSchemaAPI.getSchemaVersion() at matching
regular expression /version. These two methods produces and consumes exactly
the same mime-types and therefore their invocation as a resource methods will
always fail.;
source='org.glassfish.jersey.server.model.RuntimeResource@733752b1', [FATAL] A
resource model has ambiguous (sub-)resource method for HTTP method GET and
input mime-types as defined
by"@Consumes" and "@Produces" annotations at Java methods public
org.apache.solr.handler.admin.api.GetSchemaAPI$SchemaNameResponse
org.apache.solr.handler.admin.api.GetSchemaAPI.getSchemaName() throws
java.lang.Exception and public
org.apache.solr.handler.admin.api.GetSchemaAPI$SchemaNameResponse
org.apache.solr.handler.admin.api.GetSchemaAPI.getSchemaName() throws
java.lang.Exception at matching regular expression /name. These two methods
produces and consumes exactly the same mime-types and therefore their
invocation as a resource methods will always fail.;
source='org.glassfish.jersey.server.model.RuntimeResource@24433533']
at
org.glassfish.jersey.server.ApplicationHandler.initialize(ApplicationHandler.java:375)
~[?:?]
at
org.glassfish.jersey.server.ApplicationHandler.lambda$initialize$1(ApplicationHandler.java:297)
~[?:?]
at org.glassfish.jersey.internal.Errors.process(Errors.java:292) ~[?:?]
at org.glassfish.jersey.internal.Errors.process(Errors.java:274) ~[?:?]
at
org.glassfish.jersey.internal.Errors.processWithException(Errors.java:232)
~[?:?]
at
org.glassfish.jersey.server.ApplicationHandler.initialize(ApplicationHandler.java:296)
~[?:?]
at
org.glassfish.jersey.server.ApplicationHandler.<init>(ApplicationHandler.java:261)
~[?:?]
at
org.glassfish.jersey.server.ApplicationHandler.<init>(ApplicationHandler.java:236)
~[?:?]
at org.apache.solr.core.SolrCore.lambda$new$2(SolrCore.java:1155) ~[?:?]
```
In short - GetSchemaFieldAPI inherits all of the endpoints that GetSchemaAPI
offers, and Jersey complains because under normal circumstances you don't want
multiple registrations for the same endpoint (as they'd shadow one another).
I'll take care of this when I go to backport shortly, but figured I'd
mention it here as a heads up to anyone that reads this.
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]