gerlowskija commented on code in PR #4171: URL: https://github.com/apache/solr/pull/4171#discussion_r2877969017
########## solr/api/src/java/org/apache/solr/client/api/model/NodeHealthResponse.java: ########## @@ -0,0 +1,30 @@ +/* + * 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.solr.client.api.model; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Response body for the '/api/node/health' endpoint. */ +public class NodeHealthResponse extends SolrJerseyResponse { + + @JsonProperty public String status; + + @JsonProperty public String message; + + @JsonProperty("num_cores_unhealthy") + public Long numCoresUnhealthy; Review Comment: `Long` is important - it allows the value to be null and omitted from responses entirely. That's not just a theoretical distinction either - the code in HealthCheckHandler sets this conditionally today! ``` if (unhealthyCores > 0) { rsp.add(STATUS, FAILURE); rsp.add("num_cores_unhealthy", unhealthyCores); rsp.setException( new SolrException( SolrException.ErrorCode.SERVICE_UNAVAILABLE, unhealthyCores + " out of " + coreContainer.getNumAllCores() + " replicas are currently initializing or recovering")); return; } ``` If @dsmiley has a good reason why it's not warranted in this case, then ignore me. But in general I've been using `Long`, `Integer`, `Float`, etc. in these Response objects any time that it's conceivable that a response might omit the value entirely, which seems true in this case. -- 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]
