yashmayya commented on code in PR #18631:
URL: https://github.com/apache/pinot/pull/18631#discussion_r3331091543
##########
pinot-controller/src/main/java/org/apache/pinot/controller/api/resources/PinotAccessControlUserRestletResource.java:
##########
@@ -115,7 +115,8 @@ public String listUsers() {
@Authorize(targetType = TargetType.CLUSTER, action =
Actions.Cluster.GET_USER)
@ApiOperation(value = "Get an user in cluster", notes = "Get an user in
cluster")
public String getUser(@PathParam("username") String username,
- @ApiParam(value = "CONTROLLER|SERVER|BROKER") @QueryParam("component")
String componentTypeStr) {
+ @ApiParam(value = "CONTROLLER|SERVER|BROKER", required = true)
@QueryParam("component")
Review Comment:
`required = true` on a JAX-RS `@QueryParam` is just Swagger doc metadata —
it doesn't make the framework reject a missing `component`. So the underlying
bug still reproduces: with no `component`, `validateComponentType` returns null
and `getUser` NPEs on `componentType.name()`. #18606 adds the actual guard that
returns a clean 400.
##########
pinot-controller/src/test/java/org/apache/pinot/controller/api/resources/PinotAccessControlUserRestletResourceSwaggerTest.java:
##########
@@ -0,0 +1,67 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.pinot.controller.api.resources;
+
+import io.swagger.annotations.ApiParam;
+import java.lang.annotation.Annotation;
+import java.lang.reflect.Method;
+import javax.ws.rs.QueryParam;
+import org.testng.annotations.Test;
+
+import static org.testng.Assert.assertNotNull;
+import static org.testng.Assert.assertTrue;
+
+
+public class PinotAccessControlUserRestletResourceSwaggerTest {
+
+ @Test
+ public void testUserComponentQueryParamIsRequired()
Review Comment:
This reflection test is basically identical to the one #18606 adds, and both
PRs edit the same three annotations on the same file — they'll conflict.
Another reason to fold this into #18606.
--
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]