DeathGun44 commented on code in PR #6158: URL: https://github.com/apache/fineract/pull/6158#discussion_r3774988708
########## integration-tests/src/test/java/org/apache/fineract/integrationtests/client/feign/helpers/LoanProductCommandsApi.java: ########## @@ -0,0 +1,60 @@ +/** + * 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.fineract.integrationtests.client.feign.helpers; + +import com.fasterxml.jackson.annotation.JsonInclude; +import feign.Headers; +import feign.Param; +import feign.RequestLine; +import org.apache.fineract.client.models.PutLoanProductsProductIdResponse; + +/** + * Loan-product updates that have to send an explicit JSON {@code null}. + * + * <p> + * {@code LoanProductWritePlatformServiceJpaRepositoryImpl} gates the update on + * {@code command.parameterExists("delinquencyBucketId")}, so clearing the bucket requires the key to be + * <em>present</em> with a null value. The generated {@code PutLoanProductsProductIdRequest} cannot express that: its + * properties are {@code @JsonInclude(USE_DEFAULTS)} and {@code ObjectMapperFactory} sets {@code NON_NULL} globally, so + * a null field is dropped from the body and the server never takes the clearing branch. + * + * <p> + * Marking the field {@code nullable} in the Swagger DTO does not help - the generator emits a plain + * {@code @Nullable Long}, not a {@code JsonNullable}, so serialisation is unchanged. A property-level + * {@code @JsonInclude(ALWAYS)} is what actually overrides the mapper default, hence this request model. + */ +@Headers({ "Accept: application/json", "Content-Type: application/json" }) +public interface LoanProductCommandsApi { Review Comment: Yes, and my comment in the file was wrong. We already do this elsewhere: DelinquencyRange.id is nullable and comes out as JsonNullable<Long>. Checked both risks: existing callers still compile (normal getter/setter stay), and swagger-brake reports no breaking change. So I'll mark the field nullable and delete this file. Good catch. -- 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]
