[Release-17] Upgrade SBI to v17.x.0

This commit is contained in:
Sukchan Lee 2023-03-01 19:56:49 +09:00
parent 969c116e77
commit 4d44b1843e
1687 changed files with 121604 additions and 9310 deletions

View file

@ -5,13 +5,15 @@
#include "report_item.h"
OpenAPI_report_item_t *OpenAPI_report_item_create(
char *path
char *path,
char *reason
)
{
OpenAPI_report_item_t *report_item_local_var = ogs_malloc(sizeof(OpenAPI_report_item_t));
ogs_assert(report_item_local_var);
report_item_local_var->path = path;
report_item_local_var->reason = reason;
return report_item_local_var;
}
@ -27,6 +29,10 @@ void OpenAPI_report_item_free(OpenAPI_report_item_t *report_item)
ogs_free(report_item->path);
report_item->path = NULL;
}
if (report_item->reason) {
ogs_free(report_item->reason);
report_item->reason = NULL;
}
ogs_free(report_item);
}
@ -50,6 +56,13 @@ cJSON *OpenAPI_report_item_convertToJSON(OpenAPI_report_item_t *report_item)
goto end;
}
if (report_item->reason) {
if (cJSON_AddStringToObject(item, "reason", report_item->reason) == NULL) {
ogs_error("OpenAPI_report_item_convertToJSON() failed [reason]");
goto end;
}
}
end:
return item;
}
@ -59,6 +72,7 @@ OpenAPI_report_item_t *OpenAPI_report_item_parseFromJSON(cJSON *report_itemJSON)
OpenAPI_report_item_t *report_item_local_var = NULL;
OpenAPI_lnode_t *node = NULL;
cJSON *path = NULL;
cJSON *reason = NULL;
path = cJSON_GetObjectItemCaseSensitive(report_itemJSON, "path");
if (!path) {
ogs_error("OpenAPI_report_item_parseFromJSON() failed [path]");
@ -69,8 +83,17 @@ OpenAPI_report_item_t *OpenAPI_report_item_parseFromJSON(cJSON *report_itemJSON)
goto end;
}
reason = cJSON_GetObjectItemCaseSensitive(report_itemJSON, "reason");
if (reason) {
if (!cJSON_IsString(reason) && !cJSON_IsNull(reason)) {
ogs_error("OpenAPI_report_item_parseFromJSON() failed [reason]");
goto end;
}
}
report_item_local_var = OpenAPI_report_item_create (
ogs_strdup(path->valuestring)
ogs_strdup(path->valuestring),
reason && !cJSON_IsNull(reason) ? ogs_strdup(reason->valuestring) : NULL
);
return report_item_local_var;