Created by: ityuhui
@wing328 @zhemant @michelealbano
When the query parameter in a API request is type of "integer" or "boolean", if its value is 0
or false
, the current code does not send the query parameter to the API server.
e.g.
if (gracePeriodSeconds) <--- if gracePeriodSeconds == 0, the below code will be ignored.
{
keyQuery_gracePeriodSeconds = strdup("gracePeriodSeconds");
valueQuery_gracePeriodSeconds = calloc(1,MAX_NUMBER_LENGTH);
snprintf(valueQuery_gracePeriodSeconds, MAX_NUMBER_LENGTH, "%d", gracePeriodSeconds);
keyPairQuery_gracePeriodSeconds = keyValuePair_create(keyQuery_gracePeriodSeconds, valueQuery_gracePeriodSeconds);
list_addElement(localVarQueryParameters,keyPairQuery_gracePeriodSeconds);
}
This PR changes the code to:
if (1) // Always send integer parameters to the API server
{
keyQuery_gracePeriodSeconds = strdup("gracePeriodSeconds");
valueQuery_gracePeriodSeconds = calloc(1,MAX_NUMBER_LENGTH);
snprintf(valueQuery_gracePeriodSeconds, MAX_NUMBER_LENGTH, "%d", gracePeriodSeconds);
keyPairQuery_gracePeriodSeconds = keyValuePair_create(keyQuery_gracePeriodSeconds, valueQuery_gracePeriodSeconds);
list_addElement(localVarQueryParameters,keyPairQuery_gracePeriodSeconds);
}
This issue comes from https://github.com/kubernetes-client/c/issues/158
PR checklist
-
Read the contribution guidelines. -
Pull Request title clearly describes the work in the pull request and Pull Request description provides details about how to validate the work. Missing information here may result in delayed response from the community. -
Run the following to build the project and update samples: ./mvnw clean package ./bin/generate-samples.sh ./bin/utils/export_docs_generators.sh
./bin/generate-samples.sh bin/configs/java*
. For Windows users, please run the script in Git BASH. -
File the PR against the correct branch: master
(6.3.0) (minor release - breaking changes with fallbacks),7.0.x
(breaking changes without fallbacks) -
If your PR is targeting a particular programming language, @mention the technical committee members, so they are more likely to review the pull request.