mirror of
https://github.com/open5gs/open5gs.git
synced 2026-05-05 15:24:14 +00:00
[SBI] Fixed openapitools MAP generation (#2103)
MAP was generated incorrectly because {{#items}}..{{#items}} was
missing.
Because of this, If scpInfo has scpPort, NRF crashes.
This commit is contained in:
parent
1d8324af9f
commit
ce668c556c
437 changed files with 111103 additions and 906 deletions
|
|
@ -427,20 +427,20 @@ cJSON *OpenAPI_{{classname}}_convertToJSON(OpenAPI_{{classname}}_t *{{classname}
|
|||
|
||||
OpenAPI_lnode_t *{{{name}}}_node;
|
||||
OpenAPI_list_for_each({{{classname}}}->{{{name}}}, {{{name}}}_node) {
|
||||
{{#items}}
|
||||
{{#isString}}
|
||||
{{#items}}
|
||||
{{#isString}}
|
||||
if (cJSON_AddStringToObject({{{name}}}, "", (char*){{{name}}}_node->data) == NULL) {
|
||||
ogs_error("OpenAPI_{{classname}}_convertToJSON() failed [{{{name}}}]");
|
||||
goto end;
|
||||
}
|
||||
{{/isString}}
|
||||
{{#isBoolean}}
|
||||
{{/isString}}
|
||||
{{#isBoolean}}
|
||||
if (cJSON_AddBoolToObject({{{name}}}, "", *(cJSON_bool *){{{name}}}_node->data) == NULL) {
|
||||
ogs_error("OpenAPI_{{classname}}_convertToJSON() failed [{{{name}}}]");
|
||||
goto end;
|
||||
}
|
||||
{{/isBoolean}}
|
||||
{{#isNumeric}}
|
||||
{{/isBoolean}}
|
||||
{{#isNumeric}}
|
||||
if (cJSON_AddNumberToObject({{{name}}}, "", *(double *){{{name}}}_node->data) == NULL) {
|
||||
ogs_error("OpenAPI_{{classname}}_convertToJSON() failed [{{{name}}}]");
|
||||
goto end;
|
||||
|
|
@ -506,27 +506,28 @@ cJSON *OpenAPI_{{classname}}_convertToJSON(OpenAPI_{{classname}}_t *{{classname}
|
|||
if ({{{classname}}}->{{{name}}}) {
|
||||
OpenAPI_list_for_each({{{classname}}}->{{{name}}}, {{{name}}}_node) {
|
||||
OpenAPI_map_t *localKeyValue = (OpenAPI_map_t*){{{name}}}_node->data;
|
||||
{{#isPrimitiveType}}
|
||||
{{#isString}}
|
||||
{{#items}}
|
||||
{{#isPrimitiveType}}
|
||||
{{#isString}}
|
||||
if (cJSON_AddStringToObject(localMapObject, localKeyValue->key, (char*)localKeyValue->value) == NULL) {
|
||||
ogs_error("OpenAPI_{{classname}}_convertToJSON() failed [{{{name}}}]");
|
||||
goto end;
|
||||
}
|
||||
{{/isString}}
|
||||
{{#isNumeric}}
|
||||
{{/isString}}
|
||||
{{#isNumeric}}
|
||||
if (cJSON_AddNumberToObject(localMapObject, localKeyValue->key, *(double *)localKeyValue->value) == NULL) {
|
||||
ogs_error("OpenAPI_{{classname}}_convertToJSON() failed [{{{name}}}]");
|
||||
goto end;
|
||||
}
|
||||
{{/isNumeric}}
|
||||
{{#isBoolean}}
|
||||
{{/isNumeric}}
|
||||
{{#isBoolean}}
|
||||
if (cJSON_AddBoolToObject(localMapObject, localKeyValue->key, *(cJSON_bool *)localKeyValue->value) == NULL) {
|
||||
ogs_error("OpenAPI_{{classname}}_convertToJSON() failed [{{{name}}}]");
|
||||
goto end;
|
||||
}
|
||||
{{/isBoolean}}
|
||||
{{/isPrimitiveType}}
|
||||
{{^isPrimitiveType}}
|
||||
{{/isBoolean}}
|
||||
{{/isPrimitiveType}}
|
||||
{{^isPrimitiveType}}
|
||||
cJSON *itemLocal = localKeyValue->value ?
|
||||
OpenAPI_{{complexType}}_convertToJSON(localKeyValue->value) :
|
||||
cJSON_CreateNull();
|
||||
|
|
@ -534,8 +535,9 @@ cJSON *OpenAPI_{{classname}}_convertToJSON(OpenAPI_{{classname}}_t *{{classname}
|
|||
ogs_error("OpenAPI_{{classname}}_convertToJSON() failed [{{{name}}}]");
|
||||
goto end;
|
||||
}
|
||||
cJSON_AddItemToObject({{{name}}}, localKeyValue->key, itemLocal);
|
||||
{{/isPrimitiveType}}
|
||||
cJSON_AddItemToObject(localMapObject, localKeyValue->key, itemLocal);
|
||||
{{/isPrimitiveType}}
|
||||
{{/items}}
|
||||
}
|
||||
}
|
||||
{{/isMap}}
|
||||
|
|
@ -728,21 +730,21 @@ OpenAPI_{{classname}}_t *OpenAPI_{{classname}}_parseFromJSON(cJSON *{{classname}
|
|||
ogs_error("OpenAPI_{{classname}}_parseFromJSON() failed [{{{name}}}]");
|
||||
goto end;
|
||||
}
|
||||
OpenAPI_list_add({{{name}}}List , ogs_strdup({{{name}}}_local->valuestring));
|
||||
OpenAPI_list_add({{{name}}}List, ogs_strdup({{{name}}}_local->valuestring));
|
||||
{{/isString}}
|
||||
{{#isNumeric}}
|
||||
if (!cJSON_IsNumber({{{name}}}_local)) {
|
||||
ogs_error("OpenAPI_{{classname}}_parseFromJSON() failed [{{{name}}}]");
|
||||
goto end;
|
||||
}
|
||||
OpenAPI_list_add({{{name}}}List , &{{{name}}}_local->valuedouble);
|
||||
OpenAPI_list_add({{{name}}}List, &{{{name}}}_local->valuedouble);
|
||||
{{/isNumeric}}
|
||||
{{#isBoolean}}
|
||||
if (!cJSON_IsBool({{{name}}}_local)) {
|
||||
ogs_error("OpenAPI_{{classname}}_parseFromJSON() failed [{{{name}}}]");
|
||||
goto end;
|
||||
}
|
||||
OpenAPI_list_add({{{name}}}List , {{{name}}}_local->valueint);
|
||||
OpenAPI_list_add({{{name}}}List, {{{name}}}_local->valueint);
|
||||
{{/isBoolean}}
|
||||
{{/items}}
|
||||
}
|
||||
|
|
@ -818,6 +820,7 @@ OpenAPI_{{classname}}_t *OpenAPI_{{classname}}_parseFromJSON(cJSON *{{classname}
|
|||
OpenAPI_map_t *localMapKeyPair = NULL;
|
||||
cJSON_ArrayForEach({{{name}}}_local_map, {{{name}}}) {
|
||||
cJSON *localMapObject = {{{name}}}_local_map;
|
||||
{{#items}}
|
||||
{{#isPrimitiveType}}
|
||||
{{#isString}}
|
||||
if (!cJSON_IsString(localMapObject)) {
|
||||
|
|
@ -842,17 +845,18 @@ OpenAPI_{{classname}}_t *OpenAPI_{{classname}}_parseFromJSON(cJSON *{{classname}
|
|||
{{/isNumeric}}
|
||||
{{/isPrimitiveType}}
|
||||
{{^isPrimitiveType}}
|
||||
if (cJSON_IsObject({{{name}}}_local_map)) {
|
||||
if (cJSON_IsObject(localMapObject)) {
|
||||
localMapKeyPair = OpenAPI_map_create(
|
||||
ogs_strdup(localMapObject->string), OpenAPI_{{complexType}}_parseFromJSON(localMapObject));
|
||||
} else if (cJSON_IsNull({{{name}}}_local_map)) {
|
||||
} else if (cJSON_IsNull(localMapObject)) {
|
||||
localMapKeyPair = OpenAPI_map_create(ogs_strdup(localMapObject->string), NULL);
|
||||
} else {
|
||||
ogs_error("OpenAPI_{{classname}}_parseFromJSON() failed [{{{name}}}]");
|
||||
goto end;
|
||||
}
|
||||
{{/isPrimitiveType}}
|
||||
OpenAPI_list_add({{{name}}}List , localMapKeyPair);
|
||||
{{/items}}
|
||||
OpenAPI_list_add({{{name}}}List, localMapKeyPair);
|
||||
}
|
||||
{{/isMap}}
|
||||
{{/isContainer}}
|
||||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue