Created by: ityuhui
When a struct field in the generated c client is a C key word (e.g. continue), it should be escaped. This is implemented by the PR #4735. But #4735 introduces an issue, that is the JSON key name in request/response body is also escaped. e.g.
./model/v1_list_meta.c: if(cJSON_AddStringToObject(item, "_continue", v1_list_meta->_continue) == NULL) {
./model/v1_list_meta.c: cJSON *_continue = cJSON_GetObjectItemCaseSensitive(v1_list_metaJSON, "_continue");
This will cause logic error when API server processes the request/response body. Actually the JOSN key name should not be escaped, e.g.
./model/v1_list_meta.c: if(cJSON_AddStringToObject(item, "continue", v1_list_meta->_continue) == NULL) {
./model/v1_list_meta.c: cJSON *_continue = cJSON_GetObjectItemCaseSensitive(v1_list_metaJSON, "continue");
PR checklist
-
Read the contribution guidelines. -
If contributing template-only or documentation-only changes which will change sample output, build the project before. -
Run the shell script(s) under ./bin/
(or Windows batch scripts under.\bin\windows
) to update Petstore samples related to your fix. This is important, as CI jobs will verify all generator outputs of your HEAD commit, and these must match the expectations made by your contribution. You only need to run./bin/{LANG}-petstore.sh
,./bin/openapi3/{LANG}-petstore.sh
if updating the code or mustache templates for a language ({LANG}
) (e.g. php, ruby, python, etc). -
File the PR against the master: master
,4.3.x
,5.0.x
. Default:master
. -
Copy the technical committee to review the pull request if your PR is targeting a particular programming language.
@wing328 @zhemant