forked from loafle/openapi-generator-original
C-Libcurl client: fix enum model generation (#5604)
The "..._parseFromJSON" template was buggy because the name of the _e type used was not the same than the generated. See the first argument of "..._convertToJSON" to see that the _e type used there was not the same
This commit is contained in:
parent
9a03850828
commit
e26a4222c7
@ -48,8 +48,8 @@ fail:
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
{{classFilename}}_{{classname}}_e {{classFilename}}_{{classname}}_parseFromJSON(cJSON *{{classname}}JSON) {
|
{{projectName}}_{{classVarName}}_{{enumName}}_e {{classFilename}}_{{classname}}_parseFromJSON(cJSON *{{classname}}JSON) {
|
||||||
{{classFilename}}_{{classname}}_e *{{classname}} = NULL;
|
{{projectName}}_{{classVarName}}_{{enumName}}_e *{{classname}} = NULL;
|
||||||
{{#isEnum}}
|
{{#isEnum}}
|
||||||
{{#isNumeric}}
|
{{#isNumeric}}
|
||||||
cJSON *{{{classname}}}Var = cJSON_GetObjectItemCaseSensitive({{classname}}JSON, "{{{classname}}}");
|
cJSON *{{{classname}}}Var = cJSON_GetObjectItemCaseSensitive({{classname}}JSON, "{{{classname}}}");
|
||||||
@ -59,7 +59,7 @@ fail:
|
|||||||
}
|
}
|
||||||
{{/isNumeric}}
|
{{/isNumeric}}
|
||||||
{{#isString}}
|
{{#isString}}
|
||||||
{{classFilename}}_{{{classname}}}_e {{classname}}Variable;
|
{{projectName}}_{{classVarName}}_{{enumName}}_e {{classname}}Variable;
|
||||||
cJSON *{{{classname}}}Var = cJSON_GetObjectItemCaseSensitive({{classname}}JSON, "{{{classname}}}");
|
cJSON *{{{classname}}}Var = cJSON_GetObjectItemCaseSensitive({{classname}}JSON, "{{{classname}}}");
|
||||||
if(!cJSON_IsString({{{classname}}}Var) || ({{{classname}}}Var->valuestring == NULL)){
|
if(!cJSON_IsString({{{classname}}}Var) || ({{{classname}}}Var->valuestring == NULL)){
|
||||||
goto end;
|
goto end;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user